Building A Native Toolchain


Mar 8, 2010
I have been trying to build a native toolchain for the Wiz (not intended to run on the device, but rather in qemu). I'm currently trying to match version 10.02 of the GPH SDK, using the following components:

  • binutils-2.16.1
  • glibc-2.3.6
  • gcc-4.0.2

I started out by building a cross-compiling toolchain using crosstool. This required finding/modifying some patches, but I eventually got it to work.
I then used that toolchain to build a native toolchain (--build=i686-linux-gnu --host=arm-softfloat-linux-gnu --target=arm-softfloat-linux-gnu).

I then set up a Debian/Arm system in qemu and created a chroot environment in it, containing busybox and the toolchain I built.

Now when I try to link a trivial C program, I get the following error message:

debian-arm:~/wiz-native# chroot . /bin/ash
debian-arm:/# cd root/
debian-arm:/root# gcc -o foo foo.c 
/usr/lib/gcc/arm-softfloat-linux-gnu/4.0.2/../../../../arm-softfloat-linux-gnu/bin/ld: warning:, needed by /lib/, not found (try using -rpath or -rpath-link)
/lib/ undefined reference to `__libc_stack_end@GLIBC_2.1'
/lib/ undefined reference to `_r_debug@GLIBC_2.0'
/lib/ undefined reference to `_dl_argv@GLIBC_PRIVATE'
/lib/ undefined reference to `_rtld_global_ro@GLIBC_PRIVATE'
/lib/ undefined reference to `_dl_out_of_memory@GLIBC_PRIVATE'
/lib/ undefined reference to `_rtld_global@GLIBC_PRIVATE'
/lib/ undefined reference to `__libc_enable_secure@GLIBC_PRIVATE'
collect2: ld returned 1 exit status

If I follow the advice given in the error message, it works:

debian-arm:/root# gcc -o foo foo.c -Wl,-rpath=/lib

Some googling revealed that this could mean that the toolchain I've built does not know it is a native toolchain,
therefore making no assumptions on library locations... I have not found a way to fix this yet. One hint I found was to change the "specs" file, but my toolchain
has not installed any such file. Also "gcc -dumpspecs" says:


Any ideas on how to proceed?
Turns out that you must not compile the native toolchain (or at least binutils) using "--with-sysroot". :D
I have now succeeded in setting this up. I've put the resulting toolchain (along with busybox, make and the libs/headers from GPH_SDK) in a chroot on the Debian/Arm qemu and was able to natively compile Python and Pygame :)
In case someone is interested, here is the crosstool patch/config and build script I used.
Last edited:
thanks for your effort. downloaded your script, maybe when i need to compile some third party libs, i'll try this method, as cross-compilation always drives me crazy! :)
As a bonus, here is my qemu launch script, because it took me a while to get it to work the way I wanted :)
qemu-system-arm \
    -M versatilepb \
    -kernel kernel/vmlinuz \
    -initrd kernel/initrd.img \
    -append "root=/dev/sda1" \
    -hda debian_lenny_arm_small.qcow2 \
    -net user,hostfwd=tcp: \
    -net nic,model=smc91c111