Skip to contentSkip to conversation

pkg-infra: make sure cross compiling is enabled when host == target

PATCH Superseded Arnout Vandecappelle (Essensium/Mind) 2 participants 4 messages Jul 10, 2012 – Jul 14, 2012 Kbuild

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pkg-infra: make sure cross compiling is enabled when host == target

When compiling for the same architecture and libc as the host, GNU_TARGET_NAME and GNU_HOST_NAME are equal. configure scripts use these to detect cross-compilation, and will decide that we're doing native compilation. This may trigger running of executables, which fail because of missing libraries in the host environment.

To solve this, set the vendor part in GNU_HOST_NAME to buildroot_cross.

This problem exists for instance in xserver_xorg-server on x86_64.

---
 Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index b80477f..9d1b9d6 100644
@@ -200,7 +200,7 @@ unexport CXXFLAGS
 unexport GREP_OPTIONS
 unexport CONFIG_SITE
 
-GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
+GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess | sed s/-unknown-/-buildroot_cross-/)
 
 ##############################################################
 #
Signature · 1 line
tg: (b8b57bb..) t/force-cross (depends on: master)
#1 lore raw

PATCH 1/1 pkg-infra: make sure cross compiling is enabled when host == target

Le Wed, 11 Jul 2012 00:01:20 +0200,
"Arnout Vandecappelle (Essensium/Mind)" <[email protected]> a ?crit :

Quoted 7 lines

When compiling for the same architecture and libc as the host, GNU_TARGET_NAME and GNU_HOST_NAME are equal. configure scripts use these to detect cross-compilation, and will decide that we're doing native compilation. This may trigger running of executables, which fail because of missing libraries in the host environment.

To solve this, set the vendor part in GNU_HOST_NAME to buildroot_cross.

Do you see a problem with setting it just to "buildroot"? buildroot_cross looks a bit ugly to me.

Thanks,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH v2 1/1 pkg-infra: make sure cross compiling is enabled when host == target

When compiling for the same architecture and libc as the host, GNU_TARGET_NAME and GNU_HOST_NAME are equal. configure scripts use these to detect cross-compilation, and will decide that we're doing native compilation. This may trigger running of executables, which fail because of missing libraries in the host environment.

To solve this, set the vendor part in GNU_HOST_NAME to buildroot.

This problem exists for instance in xserver_xorg-server on x86_64.

---
v2: -buildroot- instead of -buildroot_cross-, as suggested by ThomasP.

 Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index b80477f..d1c4c2b 100644
@@ -200,7 +200,7 @@ unexport CXXFLAGS
 unexport GREP_OPTIONS
 unexport CONFIG_SITE
 
-GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess)
+GNU_HOST_NAME:=$(shell support/gnuconfig/config.guess | sed s/-unknown-/-buildroot-/)
 
 ##############################################################
 #
Signature · 1 line
tg: (b8b57bb..) t/force-cross (depends on: master)
#3 lore raw

PATCH v2 1/1 pkg-infra: make sure cross compiling is enabled when host == target

Le Sat, 14 Jul 2012 23:23:26 +0200,
"Arnout Vandecappelle (Essensium/Mind)" <[email protected]> a ?crit :

Quoted 9 lines

When compiling for the same architecture and libc as the host, GNU_TARGET_NAME and GNU_HOST_NAME are equal. configure scripts use these to detect cross-compilation, and will decide that we're doing native compilation. This may trigger running of executables, which fail because of missing libraries in the host environment.

To solve this, set the vendor part in GNU_HOST_NAME to buildroot.

This problem exists for instance in xserver_xorg-server on x86_64.

Hum, after thinking a bit more about this, why would we change GNU_HOST_NAME? It sounds strange to include "buildroot" in the name of the build machine tuple. Adding it to the target machine tuple would seem much more appropriate, no?

I.e:

GNU_TARGET_NAME=$(ARCH)-unknown-linux-$(LIBC)$(ABI)

changed to:

GNU_TARGET_NAME=$(ARCH)-buildroot-linux-$(LIBC)$(ABI)

No?

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com