Building PowerPC cross compilers on X86 Linux

Matt Brandt justmattb at walkingdog.net
Sat Feb 17 09:46:04 PST 2007


I've been checking out D for quite a while now and I would really like to use it for some embedded stuff I do. We compile for powerpc-linux on x86-linux boxen and so I've been trying to generate a cross compiler. I did the obvious hack of using crosstool and repacking the gcc tarball with the D patches applied and then trying to run that. It gets a long way (all the way to trying to compile the Phobos libs) but then fails with:

checking If /home/mbrandt/Desktop/crosstool-0.43/build/powerpc-603-linux-gnu/gcc-4.1.1-glibc-2.3.6/build-gcc/./gcc/gdc -B/home/mbrandt/Desktop/crosstool-0.43/build/powerpc-603-linux-gnu/gcc-4.1.1-glibc-2.3.6/build-gcc/./gcc/ -B/lifesize/tools/cross/gcc-4.1.1-glibc-2.3.6/powerpc-603-linux-gnu/powerpc-603-linux-gnu/bin/ -B/lifesize/tools/cross/gcc-4.1.1-glibc-2.3.6/powerpc-603-linux-gnu/powerpc-603-linux-gnu/lib/ -isystem /lifesize/tools/cross/gcc-4.1.1-glibc-2.3.6/powerpc-603-linux-gnu/powerpc-603-linux-gnu/include -isystem /lifesize/tools/cross/gcc-4.1.1-glibc-2.3.6/powerpc-603-linux-gnu/powerpc-603-linux-gnu/sys-include can compile D sources... /home/mbrandt/Desktop/crosstool-0.43/build/powerpc-603-linux-gnu/gcc-4.1.1-glibc-2.3.6/build-gcc/./gcc/cc1d: error while loading shared libraries: /home/mbrandt/Desktop/crosstool-0.43/build/powerpc-603-linux-gnu/gcc-4.1.1-glibc-2.3.6/build-gcc/./gcc/libgcc_s.so.1: ELF file data encoding not little-endian
no
configure: error: can't compile D sources!
make[1]: *** [configure-target-libphobos] Error 1
make[1]: Leaving directory `/home/mbrandt/Desktop/crosstool-0.43/build/powerpc-603-linux-gnu/gcc-4.1.1-glibc-2.3.6/build-gcc'
make: *** [all] Error 2

The cross compiled library ought to be big endian (and seems to be) but cc1d must be trying to load the target libraries instead of the native libraries when it runs the compiler passes. A cross compiler for c, c++, and objc builds fine with the same set of scripts, so this must be something specific to the D makefiles that is getting confused...

I just thought I would ask before I wade into this if the issue has come up before, or if anyone that has a working powerpc compiler running on x86 linux.

Thanks,

Matt



More information about the D.gnu mailing list