TL/DR: Where can I find more information about building a GCC 4.7.0 cross-compiling toolchain for ARM (gnueabi) platform (intended to run on
Here is a step-by-step guide How to build Raspberry Pi cross-compiler in Windows. The reason you are getting Illegal Instruction
error is latest Raspbian is hardfp-enabled and requires appropriate patches for gcc and eglibc to support hardfp. Otherwise generated code will use different ABI, i.e. pass function arguments in different registers, so crash at runtime.
Also misconfiguring GCC for ARMv7 (Raspebby Pi is ARMv6) may lead to Illegal Instruction
error. Be sure to specify --with-arch=armv6
option when configuring GCC.
The guide linked above is based on GCC 4.6.3 though. But I guess it should work with GCC 4.7 too.
http://github.com/dwelch67/raspberrypi buildgcc directory there is a script for both 4.7 gcc/gnu and 3.0 clang/llvm. gnu one derived from the script at the mpx project at opencores, I cut out gdb and libgcc, glibc, etc took it down to a compiler. if you want that other stuff cut and paste arm for mips.
I found these instructions How to build a cross compiler for your Raspberry Pi. It is a great walk through using a crosstool-ng
tool which simplifies configuring a cross-compiler build A LOT (it has a nice curses-based interface) and it supports GCC 4.7.
Seems to work great!
You could try the Raspberry-GCC-4.7.3 toolchain.
It's a pre-built gcc-4.7.3 toolchain for armv6 with hardfp using gnueabi. I'm using it to cross compile c++11 for a raspberrian target.
Please note it only works on linux x86_64 hosts.
As you've noted, building on the Raspberry Pi itself is slow, but reliable (since it's not cross-compiling), provided you don't run out of memory. Perhaps it's possible to tweak the memory and swap settings to make larger builds possible (if not fast). I know on the forums, people are talking about putting root partitions on SD, user partitions on USB drives, and of course it will probably make a difference to get a fast (class 6 or better) SD card. It's possible, over time, that the compilation performance will improve as the software improves. Or, maybe Raspberry Pi 2 will have an improved chipset and more RAM. :-)
The dockcross project is a great starting point for a completely deodorized tool chain, you could build not just for Pi but for anything else. Here are the commands:
docker run --rm dockcross/linux-armv7 > ./dockcross-linux-armv7
chmod +x ./dockcross-linux-armv7
./dockcross-linux-armv7 bash -c '$CC test/C/hello.c -o hello_arm'
It has cmake
built in as well.