Some library packages in tree use libtool to create library files. While compilation via libtool works flawlessly, linking stage had wrong gcc bug problem: libtool tries to use host compiler not cross-compiler. Debugging libtool I found that variable $archive_cmds, which contains commands needed to link library. It use non-overridable $CC or $LD (in fact compiler name from commandline doesn't in use at all), which point to host compiler. I make hack that allows to override $CC or $LD from commandline, so cross compilation with libtool became possible. Reproducible: Always Steps to Reproduce:
Created attachment 241731 [details, diff] problem fix
Created attachment 241733 [details, diff] portage ebuild diff
Created attachment 241735 [details, diff] embedded-cross overlay ebuild diff
post an actual build log (as an attachment) of a package failing to cross-compile. i cross-compile packages that use libtool every day without problems. i'm not going to add random patches based on vague problem descriptions.
Created attachment 241969 [details] example build log of dev-libs/libtommath-0.41 build fails because libtool call host compiler (i686-pc-linux-gnu-gcc) instead of cross-compiler (armv7a-softfloat-linux-gnueabi-gcc) for linking
attachment posted
libtommath shouldnt be using `libtool` in PATH, it should be. many other aspects of libtool arent going to work correctly. since --mode=compile is respecting the specified compiler, then --mode=link probably should as well, but this still doesnt mean that libtommath is doing the right thing. any package using `libtool` from PATH is broken.
looks like i truncated my last comment. first sentence: ..., it should be bundling a local version and configuring/running that.
testing libtool-2.2.10 seems to work fine for me $ echo 'main(){}' > test.c $ CHOST=alpha-unknown-linux-gnu $ libtool --mode=compile --tag=CC ${CHOST}-gcc -c test.c libtool: compile: alpha-unknown-linux-gnu-gcc -c test.c -fPIC -DPIC -o .libs/test.o libtool: compile: alpha-unknown-linux-gnu-gcc -c test.c -o test.o >/dev/null 2>&1 $ libtool --mode=link --tag=CC ${CHOST}-gcc test.o -o test libtool: link: alpha-unknown-linux-gnu-gcc test.o -o test