Skip to main content

Cross compiling for x86 on a ppc box

Since I don't have an easy access to a non x86 box at home, I had to setup a toolchain for x86 on my laptop. Things are fairly simple if you follow the Emdebian instructions. The only glitch I encountered was the failure of gcc 3.4 while compiling:

_ /tmp/gcc-3.4-3.4.3/build/gcc/xgcc -B/tmp/gcc-3.4-3.4.3/build/gcc/ ...snip... libgcc/64/unwind-c.o -lc && rm -f libgcc_s_64.so && if [ -f 64/libgcc_s.so.1 ]; then mv -f 64/libgcc_s.so.1 64/libgcc_s.so.1.backup; else true; fi && mv 64/libgcc_s.so.1.tmp 64/libgcc_s.so.1 && ln -s 64/libgcc_s.so.1 libgcc_s_64.so/usr/i386-linux/bin/ld: skipping incompatible /usr/i386-linux/lib/libc.so when searching for -lc /usr/i386-linux/bin/ld: skipping incompatible /usr/i386-linux/lib/libc.a when searching for -lc /usr/i386-linux/bin/ld: skipping incompatible /usr/lib/gcc/../../i386-linux/lib/libc.so when searching for -lc /usr/i386-linux/bin/ld: skipping incompatible /usr/lib/gcc/../../i386-linux/lib/libc.a when searching for -lc /usr/i386-linux/bin/ld: skipping incompatible /usr/i386-linux/bin/../../lib/libc.so when searching for -lc /usr/i386-linux/bin/ld: skipping incompatible /usr/i386-linux/bin/../../lib/libc.a when searching for -lc /usr/i386-linux/bin/ld: cannot find -lc collect2: ld returned 1 exit status _

Which is due to the fact that biarch, libgcc64 and libgcc64cxx get compiled in. So all you have to do is edit debian/rules.defs and make sure that you have the following:

...
ifeq ($(DEB_TARGET_GNU_TYPE),i386-linux)
biarch := no
with_lib64gcc := no
with_lib64cxx := no
...

Paolo Conte - Tango