[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug libctf/28545] cross compile incorrectly using host libraries in ins
From: |
nick.alcock at oracle dot com |
Subject: |
[Bug libctf/28545] cross compile incorrectly using host libraries in install relink |
Date: |
Thu, 11 Nov 2021 14:25:24 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=28545
Nick Alcock <nick.alcock at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |WAITING
--- Comment #11 from Nick Alcock <nick.alcock at oracle dot com> ---
Hm. This is not easy to replicate. A straight cross build, even one with
--prefix=/usr and --disable-fast-install to force relinking, does not go wrong.
Looking at your compile command, what's breaking it is that something is
forcing
"-L/mnt/pool_ssd/code/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-11.2.0_musl_eabi/usr/lib
-L/mnt/pool_ssd/code/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-11.2.0_musl_eabi/lib
-L/mnt/pool_ssd/code/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/lib
-Wl,-rpath-link=/mnt/pool_ssd/code/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/lib
-L/mnt/pool_ssd/code/openwrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/usr/lib/libintl-stub/lib"
in front of the -o in the libtool command.
Looking at the compile log, the openwrt build scripts are passing *this* in:
LDFLAGS="-L/mnt/pool_ssd/code/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-11.2.0_musl_eabi/usr/lib
-L/mnt/pool_ssd/code/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-11.2.0_musl_eabi/lib
-znow -zrelro "
This is a disaster waiting to happen (and now it has happened). You can't set
up sysroots by just passing in -L arguments in LDFLAGS like this! The problem
is that the resulting library search order is wrong: LDFLAGS is injected early
in link lines, and libraries are searched for in order of -L arguments, so any
libraries specified in -L will take precedence over any -L arguments specified
by binutils's actual makefiles to find its own libraries in the build tree, and
there's nothing we can do about it. -L arguments should only ever appear in
LIBS, accompanying specific libraries found in nonstandard paths.
The compiler should have been configured to find libraries suitably without
needing a massive spray of -L arguments like this: GCC has a --sysroot argument
for a reason (and --sysroot does not mess up the library search order). You
should probably raise this with OpenWRT (and link to this bug).
I am tempted to mark this INVALID right away, but I'll leave it as WAITING
until we see what the OpenWRT people say (since they probably do a lot more
cross-compiling than me, to be honest).
(But I clearly need to backport bug 27360 to the 2.37 branch. I'm on that.)
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, (continued)
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, bugs.sourceware at johnthomson dot fastmail.com.au, 2021/11/05
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, bugs.sourceware at johnthomson dot fastmail.com.au, 2021/11/05
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, bugs.sourceware at johnthomson dot fastmail.com.au, 2021/11/05
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, bugs.sourceware at johnthomson dot fastmail.com.au, 2021/11/06
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, address@hidden, 2021/11/06
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, bugs.sourceware at johnthomson dot fastmail.com.au, 2021/11/06
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, address@hidden, 2021/11/06
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, bugs.sourceware at johnthomson dot fastmail.com.au, 2021/11/06
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, address@hidden, 2021/11/07
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, nick.alcock at oracle dot com, 2021/11/09
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink,
nick.alcock at oracle dot com <=
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, bugs.sourceware at johnthomson dot fastmail.com.au, 2021/11/11
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, bugs.sourceware at johnthomson dot fastmail.com.au, 2021/11/11
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, da_audiophile at yahoo dot com, 2021/11/14
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, da_audiophile at yahoo dot com, 2021/11/14
- [Bug libctf/28545] cross compile incorrectly using host libraries in install relink, bugs.sourceware at johnthomson dot fastmail.com.au, 2021/11/18