-   Linux - Software (
-   -   Cross compiling gcc 4.x (

mks_jangra 05-17-2007 05:10 AM

Cross compiling gcc 4.x

I need a step-by-step guide to use an amd64-machine (RHEL 4, x86_64) to compile an gcc 4.x for both amd64 and i386 arch.

Thanks & Regards

osor 05-17-2007 08:32 PM

If you have a multilib setup, it would generally go something like this:

$ OPTIONS="--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=all"
$ wget
$ tar xf gcc-4.2.0.tar.bz2
$ cd gcc-4.2.0
$ mkdir build-amd64 build-i386
$ cd build-amd64
$ ../configure $OPTIONS
$ make
$ make install
$ cd ../build-i386
$ ../configure $OPTIONS --enable-bootstrap --target=i386-pc-linux-gnu
$ make bootstrap
$ make install

Of course you can change OPTIONS to whatever you need. You can also change --target (e.g., you might want i686-pc-linux-gnu instead). You also might want to do the “make install” steps in a sandbox so you can package it up for redistribution (which is what I assume this is for).

If you want more information on cross compiling, I suggest you check out CLFS.

All times are GMT -5. The time now is 05:41 PM.