I am getting the following error when compiling "x86_64 to powerpc64" cross gcc, 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. The message "error while loading shared libraries: /a/linux/.powerpc/gcc/obj/./gcc/libgcc_s.so.1: ELF file data encoding not little-endian" is from glibc. Is this a bug ? And are there any workarounds ?