Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-17-2007, 05:10 AM   #1
LQ Newbie
Registered: Oct 2005
Location: Gurgaon
Posts: 7

Rep: Reputation: 0
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
Old 05-17-2007, 08:32 PM   #2
HCL Maintainer
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 76
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Compiling GCC as cross comp (mkdir issue) elyk1212 Linux - Desktop 3 10-01-2006 03:46 AM
cross compiler -> ppc_405-gcc marri Programming 0 08-19-2005 08:28 AM
GCC cross compiling to alpha sparc? jon_k Linux - Software 2 12-07-2004 02:23 PM
help: gcc cross-compiler for m68000 worthij Linux - Software 0 11-09-2004 01:32 PM
Setting up GCC for cross-compile ugenn Linux - Software 0 02-20-2003 09:08 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:03 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration