LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

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

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

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


Reply


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


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

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