The main difficulty of building a cross-compiler for Linux is the cross-compilation of GLIBC. I did not succeed, I don't known if it is even possible. So I cheated. First, I have compiled GLIBC natively on Linux, and used the resulting package for cross compiling BINUTILS and then GCC.
The cross compilation is then a two stage road:
The ''headers-glibc-for-linux.tar.bz2'' archive (4 KB) compiles GLIBC natively on Linux.
The ''headers-glibc-linux32.tar.gz'' archive (19.6 MB) is the compiled GLIBC, ran on a 32-Bit Linux. You can use it if yopu do not have a Linux Computer.
The ''headers-glibc-linux64.tar.gz'' archive (21.3 MB) is the compiled GLIBC, ran on a 64-Bit Linux. You can use it if yopu do not have a Linux Computer.
The ''gcc-4.5.2-for-linux32-linux64'' archive (66 KB) contains the script to be ran to cross compile BINUTILS and GCC on Mac OS X.
headers-glibc-for-linux.tar.bz2 archive, you can compile GLIBC natively on Linux. It automatically download the needed archives, builds Linux headers, and then compiles GLIBC. It provides a
headers-glibc-linux32.tar.gz file on a 32-bit Linux, and a
headers-glibc-linux64.tar.gz on a 64-bit Linux. The script runs in user account, so you need not to enter the administrator password.
gcc-4.5.2-for-linux32-linux64.tar.bz2 contains the build script.
If you have performed the first stage, copy the build archive into the
headers-glibc-for-linux directory. Otherwise, uses those provided in this archive.
Actually, you need only the
headers-glibc-linux32.tar.gz' archive if you plan to get an i386 cross compiler, and the headers-glibc-linux64.tar.gz' archive if you plan to get an x86_64 cross compiler.
Four build commands are provided:
-build-sandbox-linux32.commandthat builds the distribution (SANDBOX-linux32) for a 32-bit Linux in the current directory; sudo is not invoked, no administrator password is required;
-build-sandbox-linux64.commandthat builds the distribution (SANDBOX-linux64) for a 64-bit Linux in the current directory; sudo is not invoked, no administrator password is required;
-build-usr-local-linux32.commandthat builds the distribution for a 32-bit Linux in
/usr/local/gcc-4.5.2-for-linux32; sudo is invoked, so administrator password is required;
-build-usr-local-linux64.commandthat builds the distribution for a 64-bit Linux in
/usr/local/gcc-4.5.2-for-linux64; sudo is invoked, so administrator password is required.
Needed archives are download when they are required, and stored in the local
You can run the 4 build commands in parallel, once the archives have been downloaded.
By default, the script makes gcc to compile and link against 10.5 SDK. You can change CC variable definition for using an other SDK (see CC variable definition, in the