The following error occurs when compiling "x86_64 to powerpc64" cross compiler, as soon as the libgcc_s.so.1 has appeared in obj/gcc directory:
... # Now that we have built all the objects, we need to copy # them back to the GCC directory. Too many things (other # in-tree libraries, and DejaGNU) know about the layout # of the build tree, for now. make install-leaf DESTDIR=../.././gcc \ slibdir= libsubdir= MULTIOSDIR=. make[5]: Entering directory `/a/linux/.powerpc/gcc/obj/powerpc64-unknown-linux-gnu/libgcc' /bin/bash ../../../src/libgcc/../mkinstalldirs ../.././gcc /usr/bin/install -c -m 644 libgcc_eh.a ../.././gcc/ chmod 644 ../.././gcc/libgcc_eh.a /a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/bin/ranlib ../.././gcc/libgcc_eh.a /bin/bash ../../../src/libgcc/../mkinstalldirs ../.././gcc; /usr/bin/install -c -m 644 ./libgcc_s.so.1 ../.././gcc/libgcc_s.so.1; rm -f ../.././gcc/libgcc_s.so; ln -s libgcc_s.so.1 ../.././gcc/libgcc_s.so /bin/bash ../../../src/libgcc/../mkinstalldirs ../.././gcc /usr/bin/install -c -m 644 libgcc.a ../.././gcc/ chmod 644 ../.././gcc/libgcc.a /a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/bin/ranlib ../.././gcc/libgcc.a /usr/bin/install -c -m 644 libgcov.a ../.././gcc/ chmod 644 ../.././gcc/libgcov.a /a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/bin/ranlib ../.././gcc/libgcov.a parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o ecrti.o ecrtn.o ncrti.o ncrtn.o"; \ for file in $parts; do \ rm -f ../.././gcc/$file; \ /usr/bin/install -c -m 644 $file ../.././gcc/; \ done make[5]: Leaving directory `/a/linux/.powerpc/gcc/obj/powerpc64-unknown-linux-gnu/libgcc' make[4]: Leaving directory `/a/linux/.powerpc/gcc/obj/powerpc64-unknown-linux-gnu/libgcc' Checking multilib configuration for libgomp... mkdir -p -- powerpc64-unknown-linux-gnu/libgomp Configuring in powerpc64-unknown-linux-gnu/libgomp configure: creating cache ./config.cache checking for --enable-version-specific-runtime-libs... no checking for --enable-generated-files-in-srcdir... no checking build system type... x86_64-unknown-linux-gnu checking host system type... powerpc64-unknown-linux-gnu checking target system type... powerpc64-unknown-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for powerpc64-unknown-linux-gnu-strip... /a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/bin/strip checking for powerpc64-unknown-linux-gnu-gcc... /a/linux/.powerpc/gcc/obj/./gcc/xgcc -B/a/linux/.powerpc/gcc/obj/./gcc/ -B/a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/bin/ -B/a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/lib/ -isystem /a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/include -isystem /a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/sys-include checking for C compiler default output file name... configure: error: in `/a/linux/.powerpc/gcc/obj/powerpc64-unknown-linux-gnu/libgomp': configure: error: C compiler cannot create executables See `config.log' for more details. make[3]: *** [configure-target-libgomp] Error 1 make[3]: Leaving directory `/a/linux/.powerpc/gcc/obj' The obj/powerpc64-unknown-linux-gnu/libgomp/config.log content is: ... configure:2569: checking for C compiler default output file name configure:2572: /a/linux/.powerpc/gcc/obj/./gcc/xgcc -B/a/linux/.powerpc/gcc/obj/./gcc/ -B/a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/bin/ -B/a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/lib/ -isystem /a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/include -isystem /a/linux/.powerpc/cross-tools/powerpc64-unknown-linux-gnu/sys-include -g -O2 conftest.c >&5 /a/linux/.powerpc/gcc/obj/./gcc/cc1: error while loading shared libraries: /a/linux/.powerpc/gcc/obj/./gcc/libgcc_s.so.1: ELF file data encoding not little-endian configure:2575: $? = 1 configure: failed program was: | /* confdefs.h. */ | | #define PACKAGE_NAME "GNU OpenMP Runtime Library" | #define PACKAGE_TARNAME "libgomp" | #define PACKAGE_VERSION "1.0" | #define PACKAGE_STRING "GNU OpenMP Runtime Library 1.0" | #define PACKAGE_BUGREPORT "" | #define PACKAGE "libgomp" | #define VERSION "1.0" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:2613: error: in `/a/linux/.powerpc/gcc/obj/powerpc64-unknown-linux-gnu/libgomp': configure:2616: error: C compiler cannot create executables See `config.log' for more details. ... It seems that host cc1 executable tries to load target libgcc_s.so.1 from obj/gcc directory, rather than host libgcc_s.so.1 from /lib. I have successfully build the cross-compiler with overriden RPATH_ENVVAR variable, as following: make RPATH_ENVVAR=MY_LD_LIBRARY_PATH So error was indeed caused by changing LD_LIBRARY_PATH environment variable during the build HOST gcc version is: Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-4ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu4) gcc versions I was tried to build are 4.4.1 and 4.5.0 (rev 153504) -- Summary: Error building cross compiler caused by changing LD_LIBRARY_PATH environment variable in Makefile Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: denis dot onischenko at gmail dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: powerpc64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41818