LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Cross compiling gcc 4.x (http://www.linuxquestions.org/questions/linux-software-2/cross-compiling-gcc-4-x-554582/)

mks_jangra 05-17-2007 05:10 AM

Cross compiling gcc 4.x
 
Hi

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
Mahesh

osor 05-17-2007 08:32 PM

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

$ OPTIONS="--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=all"
$ wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.2.0/gcc-4.2.0.tar.bz2
$ 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 10:35 PM.