Skip to contentSkip to conversation

stubdom: make GMP aware that it's being cross-compiled

PATCH In review Wei Liu 5 participants 9 messages Oct 29, 2016 – Oct 31, 2016

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 stubdom: make GMP aware that it's being cross-compiled

Append --build and --host flags to GMP's configure script so that it knows it is being compiled for another architecture.

This should fix the issue that GMP doesn't compile with gcc 6, because configure script won't try to test the host environment anymore.

---
Cc: Ian Jackson <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 stubdom/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
stubdom/Makefile +1 -1
index d7a47f0..94ef540 100644
@@ -171,7 +171,7 @@ gmp-$(XEN_TARGET_ARCH): gmp-$(GMP_VERSION).tar.bz2 $(NEWLIB_STAMPFILE)
 	rm $@ -rf || :
 	mv gmp-$(GMP_VERSION) $@
 	#patch -d $@ -p0 < gmp.patch
-	cd $@; CPPFLAGS="-isystem $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include $(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" CC=$(CC) $(GMPEXT) ./configure --disable-shared --enable-static --disable-fft --without-readline --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf
+	cd $@; CPPFLAGS="-isystem $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include $(TARGET_CPPFLAGS)" CFLAGS="$(TARGET_CFLAGS)" CC=$(CC) $(GMPEXT) ./configure --disable-shared --enable-static --disable-fft --without-readline --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf --build=`gcc -dumpmachine` --host=$(GNU_TARGET_ARCH)-xen-elf
 	sed -i 's/#define HAVE_OBSTACK_VPRINTF 1/\/\/#define HAVE_OBSTACK_VPRINTF 1/' $@/config.h
 	touch $@
 
Signature · 7 lines
2.9.3


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 29.10.16 at 19:22, <[email protected]> wrote:

Append --build and --host flags to GMP's configure script so that it knows it is being compiled for another architecture.

Why --host and --build? Aiui,
- host is where the configure runs,
- build is where tool chain components being built are supposed to run,
- target is where the final binaries are intended to run.

We're talking about a simple cross build here afaict, not a Canadian cross, i.e. host == build, with only target being different, i.e. I'd assume you really want to specify --target (and leave host and build to be determined automatically), along the lines of e.g. a simple compiler cross build, which produces

S["target_os"]="linux-gnu"
S["target_vendor"]="pc"
S["target_cpu"]="x86_64"
S["target"]="x86_64-pc-linux-gnu"

S["host_os"]="linux-gnu"
S["host_vendor"]="pc"
S["host_cpu"]="i686"
S["host"]="i686-pc-linux-gnu"

S["build_os"]="linux-gnu"
S["build_vendor"]="pc"
S["build_cpu"]="i686"
S["build"]="i686-pc-linux-gnu"

among its awk expression to perform substitution in various other files/scripts (except that in the stubdom case it would be target_os to be different from host_os/build_os, and - on a 64-bit system - target_cpu matching host_cpu/build_cpu).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#2 lore raw
Quoted 8 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 29.10.16 at 19:22, <[email protected]> wrote:

Append --build and --host flags to GMP's configure script so that it knows it is being compiled for another architecture.

Why --host and --build? Aiui,
- host is where the configure runs,
- build is where tool chain components being built are supposed to run,
- target is where the final binaries are intended to run.

I think you got them wrong, in particular host and build semantics.

build is where the build runs, host is where the resulting binary runs, target is where the output of the resulting binary runs (assuming the binary is compiler).

https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Specifying-Target-Triplets.html

Since GMP is not a compiler, target is not relevant here.

Quoted 3 lines

We're talking about a simple cross build here afaict, not a Canadian cross,

Correct, it's a simple cross build, not a Canadian cross.

The rest is moot because it is based on wrong assumption.

Wei.

Quoted 20 lines

i.e. host == build, with only target being different, i.e. I'd assume you really want to specify --target (and leave host and build to be determined automatically), along the lines of e.g. a simple compiler cross build, which produces

S["target_os"]="linux-gnu"
S["target_vendor"]="pc"
S["target_cpu"]="x86_64"
S["target"]="x86_64-pc-linux-gnu"

S["host_os"]="linux-gnu"
S["host_vendor"]="pc"
S["host_cpu"]="i686"
S["host"]="i686-pc-linux-gnu"

S["build_os"]="linux-gnu"
S["build_vendor"]="pc"
S["build_cpu"]="i686"
S["build"]="i686-pc-linux-gnu"

Quoted 7 lines

among its awk expression to perform substitution in various other files/scripts (except that in the stubdom case it would be target_os to be different from host_os/build_os, and - on a 64-bit system - target_cpu matching host_cpu/build_cpu).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 31.10.16 at 11:14, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 29.10.16 at 19:22, <[email protected]> wrote:

Append --build and --host flags to GMP's configure script so that it knows it is being compiled for another architecture.

Why --host and --build? Aiui,
- host is where the configure runs,
- build is where tool chain components being built are supposed to run,
- target is where the final binaries are intended to run.

I think you got them wrong, in particular host and build semantics.

Quoted 8 lines

build is where the build runs, host is where the resulting binary runs, target is where the output of the resulting binary runs (assuming the binary is compiler).

https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Specifyi
ng-Target-Triplets.html

Since GMP is not a compiler, target is not relevant here.

Oh, indeed, I've been confused. Sorry for the noise.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
In reply to Wei Liu

Wei Liu writes ("Re: [Xen-devel] [PATCH for-4.8] stubdom: make GMP aware that it's being cross-compiled"):

Quoted 12 lines · Jan Beulich
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 29.10.16 at 19:22, <[email protected]> wrote:

Append --build and --host flags to GMP's configure script so that it knows it is being compiled for another architecture.

Why --host and --build? Aiui,
- host is where the configure runs,
- build is where tool chain components being built are supposed to run,
- target is where the final binaries are intended to run.

I think you got them wrong, in particular host and build semantics.

Quoted 7 lines

build is where the build runs, host is where the resulting binary runs, target is where the output of the resulting binary runs (assuming the binary is compiler).

https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Specifying-Target-Triplets.html

Since GMP is not a compiler, target is not relevant here.

This very unfortunate terminology has, sadly, become the de facto standard. It is very confusing, but Wei has it right.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 1/1
#5 lore raw
In reply to Wei Liu
Quoted 7 lines · Wei Liu

Append --build and --host flags to GMP's configure script so that it knows it is being compiled for another architecture.

This should fix the issue that GMP doesn't compile with gcc 6, because configure script won't try to test the host environment anymore.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 1/1
#6 lore raw
In reply to Wei Liu

Wei Liu writes ("[PATCH for-4.8] stubdom: make GMP aware that it's being cross-compiled"):

Quoted 5 lines

Append --build and --host flags to GMP's configure script so that it knows it is being compiled for another architecture.

This should fix the issue that GMP doesn't compile with gcc 6, because configure script won't try to test the host environment anymore.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw
Quoted 8 lines · Ian Jackson, on Mon 31 Oct 2016 10:21:04 +0000, wrote:

Wei Liu writes ("[PATCH for-4.8] stubdom: make GMP aware that it's being cross-compiled"):

Quoted 5 lines

Append --build and --host flags to GMP's configure script so that it knows it is being compiled for another architecture.

This should fix the issue that GMP doesn't compile with gcc 6, because configure script won't try to test the host environment anymore.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author Applied
#8 lore raw
Quoted 11 lines · Samuel Thibault
Quoted 8 lines · Ian Jackson, on Mon 31 Oct 2016 10:21:04 +0000, wrote:

Wei Liu writes ("[PATCH for-4.8] stubdom: make GMP aware that it's being cross-compiled"):

Quoted 5 lines

Append --build and --host flags to GMP's configure script so that it knows it is being compiled for another architecture.

This should fix the issue that GMP doesn't compile with gcc 6, because configure script won't try to test the host environment anymore.

Applied.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel