Skip to contentSkip to conversation

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

PATCH RESEND Superseded Arnout Vandecappelle (Essensium/Mind) 3 participants 6 messages Sep 25, 2012 – Oct 4, 2012

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v3 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_TARGET_NAME to buildroot.

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

---
RESEND I hit this again while compiling xserver_xorg-server...

v3: modify GNU_TARGET_NAME instead of GNU_HOST_NAME, which makes a lot
more sense of course. Thank you ThomasP!

I only tested this one with xserver_xorg-server on a Sourcery x86_64 toolchain and with a simple config and an internal toolchain.

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

 package/Makefile.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/Makefile.in +1 -1
index 64508b2..30a542a 100644
@@ -20,7 +20,7 @@ MAKE1:=$(HOSTMAKE) -j1
 MAKE:=$(HOSTMAKE) -j$(PARALLEL_JOBS)
 
 # Compute GNU_TARGET_NAME
-GNU_TARGET_NAME=$(ARCH)-unknown-linux-$(LIBC)$(ABI)
+GNU_TARGET_NAME=$(ARCH)-buildroot-linux-$(LIBC)$(ABI)
 
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG_uClibc)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
 LIBC=uclibc
Signature · 1 line
tg: (919dca5..) t/force-cross (depends on: master)
#1 lore raw

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

Dear Arnout Vandecappelle (Essensium/Mind),

Quoted 9 lines · Arnout Vandecappelle (Essensium/Mind)

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_TARGET_NAME to buildroot.

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

I confirm the problem, and I think this is the right solution, but I haven't had the time to test it. But anyway:

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 v3 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_TARGET_NAME to buildroot.

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

---
RESEND I hit this again while compiling xserver_xorg-server... RESEND-2 And again, after testing the xorg updates.
Added ThomasP's Acked-by as well.

v3: modify GNU_TARGET_NAME instead of GNU_HOST_NAME, which makes a lot
more sense of course. Thank you ThomasP!

I only tested this one with xserver_xorg-server on a Sourcery x86_64 toolchain and with a simple config and an internal toolchain.

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

 package/Makefile.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/Makefile.in +1 -1
index 64508b2..30a542a 100644
@@ -20,7 +20,7 @@ MAKE1:=$(HOSTMAKE) -j1
 MAKE:=$(HOSTMAKE) -j$(PARALLEL_JOBS)
 
 # Compute GNU_TARGET_NAME
-GNU_TARGET_NAME=$(ARCH)-unknown-linux-$(LIBC)$(ABI)
+GNU_TARGET_NAME=$(ARCH)-buildroot-linux-$(LIBC)$(ABI)
 
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG_uClibc)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
 LIBC=uclibc
Signature · 1 line
tg: (b2e0d96..) t/force-cross (depends on: master)
#3 lore raw

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

Peter,

Could you apply this one? It has been around for a very long time.

Thanks!

Thomas

Quoted 43 lines · Arnout Vandecappelle (Essensium/Mind)

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_TARGET_NAME to buildroot.

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

---
RESEND I hit this again while compiling xserver_xorg-server... RESEND-2 And again, after testing the xorg updates.
Added ThomasP's Acked-by as well.

v3: modify GNU_TARGET_NAME instead of GNU_HOST_NAME, which makes a lot
more sense of course. Thank you ThomasP!

I only tested this one with xserver_xorg-server on a Sourcery x86_64 toolchain and with a simple config and an internal
toolchain.

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

 package/Makefile.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/Makefile.in +1 -1
index 64508b2..30a542a 100644
@@ -20,7 +20,7 @@ MAKE1:=$(HOSTMAKE) -j1
 MAKE:=$(HOSTMAKE) -j$(PARALLEL_JOBS)
 
 # Compute GNU_TARGET_NAME
-GNU_TARGET_NAME=$(ARCH)-unknown-linux-$(LIBC)$(ABI)
+GNU_TARGET_NAME=$(ARCH)-buildroot-linux-$(LIBC)$(ABI)
 
 ifeq
 ($(BR2_TOOLCHAIN_BUILDROOT)$(BR2_TOOLCHAIN_CTNG_uClibc)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)

LIBC=uclibc

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

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

In reply to Arnout Vandecappelle (Essensium/Mind)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle (Essensium/Mind) <[email protected]> writes:

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

Arnout> To solve this, set the vendor part in GNU_TARGET_NAME to buildroot.

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

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

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

Quoted 1 line · Peter Korsgaard

Committed, thanks.

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