Cross emerging i686-pc-linux-gnu toolchain on amd64 fails with the following message. * Messages for package cross-i686-pc-linux-gnu/glibc-2.16.0: * Could not find a gcc that supports the __thread directive! * Please update your binutils/gcc and try again. * ERROR: cross-i686-pc-linux-gnu/glibc-2.16.0 failed (unpack phase): * No __thread support in gcc! By inspecting "ebuild --debug glibc-2.16.0.ebuild unpack", tc-has-tls fails because a "-m64" is injected into CC: ++ tc-has-tls -c i686-pc-linux-gnu ++ local base=/dev/shm/portage/cross-i686-pc-linux-gnu/glibc-2.16.0/temp/test-tc-tls ++ cat ++ local flags ++ case $1 in ++ flags=-c ++ : -c ++ [[ -c == -* ]] ++ shift +++ tc-getCC i686-pc-linux-gnu +++ tc-getPROG CC gcc i686-pc-linux-gnu +++ _tc-getPROG CHOST CC gcc i686-pc-linux-gnu +++ local tuple=CHOST +++ local v var vars=CC +++ local prog=gcc +++ var=CC +++ for v in '${vars}' +++ [[ -n i686-pc-linux-gnu-gcc -m64 ]] +++ export 'CC=i686-pc-linux-gnu-gcc -m64' +++ CC='i686-pc-linux-gnu-gcc -m64' +++ echo 'i686-pc-linux-gnu-gcc -m64' +++ return 0 ++ i686-pc-linux-gnu-gcc -m64 -c /dev/shm/portage/cross-i686-pc-linux-gnu/glibc-2.16.0/temp/test-tc-tls.c -o /dev/shm/portage/cross-i686-pc-$ ++ local ret=1 ++ rm -f /dev/shm/portage/cross-i686-pc-linux-gnu/glibc-2.16.0/temp/test-tc-tls.c ++ return 1 Reproducible: Always
the flag is introduced in setup_env in common.eblt, which unconditionally apply "-m64" (from host ABI) to any CC even in crosscompile. http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-libs/glibc/files/eblits/common.eblit?r1=1.12&r2=1.13 @vapier, could please have a look at this? Attaching comment associated: Always get multilib info via multilib_env and move the CFLAGS_abi value from that explicitly into CFLAGS (rather than letting gcc-config do it magicallyin the backend via the env). This avoids ugly issues like distcc in a cross or multilib setup freaking out (#330423) as well as ccache pollution of wrong ELF types (such as #79519). Further, it fixes multilib building for glibc targets where the configure script detects the desired multilib based purely on the compiler flags since the target is the same (e.g. mips64-xxx and n32 vs n64, and probably others).
alternatively, the bug may be in multilib.eclass. in multilib_env, if CTARGET=i686-* DEFAULT_ABI is set to "default", which later is replaced with "amd64", not "x86"
for a amd64 profile, ABI and DEFAULT_ABI are hard-coded to "amd64". There is no chance for a crosscompile building environment to get its corrent ABI value.
Created attachment 339700 [details, diff] multilib.eclass.patch override DEFAULT_ABI in profile for cross toolchains
Created attachment 339702 [details, diff] common.ebilt.patch override ABI defined in profile when cross compiling
what version of crossdev are you using ? this should be handled already. when you first run `crossdev`, it'll calculate all the necessary ABI information and write it out to /etc/portage/env/cross-${CTARGET}/glibc.conf. then your host settings do not matter. `crossdev i686` works fine for me.