====== Source Packages and Build Instruction for GCC 4.5.2 for Linux ====== [[start#compiling_for_linux_on_macos_x|Go to the binary package download page.]] 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: - compile natively GLIBC on Linux ; this provides a 32-bit archive on a 32-bit Linux, and a 64-bit archive on a 64-bit Linux; - copy theses archives on the Mac, and cross compile BINUTILS and then GCC. ===== The archives ===== [[http://crossgcc.rts-software.org/download/gcc-4.5.2-for-linux32-linux64/headers-glibc-for-linux.tar.bz2|The ''headers-glibc-for-linux.tar.bz2'' archive (4 KB)]] compiles GLIBC natively on Linux. [[http://crossgcc.rts-software.org/download/gcc-4.5.2-for-linux32-linux64/headers-glibc-linux32.tar.gz|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. [[http://crossgcc.rts-software.org/download/gcc-4.5.2-for-linux32-linux64/headers-glibc-linux64.tar.gz|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. [[http://crossgcc.rts-software.org/download/gcc-4.5.2-for-linux32-linux64/gcc-4.5.2-for-linux32-linux64.tar.bz2|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. ===== First stage : Compiling GLIBC ===== Using the ''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. ===== Second stage : Cross Compiling BINUTILS and GCC ===== The ''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.command'' that 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.command'' that 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.command'' that 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.command'' that 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 ''archive'' directory. 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 ''makefile.mak'' file).