LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-09-2004, 01:45 AM   #1
khermans
Member
 
Registered: Sep 2001
Distribution: Ubuntu, Debian, Gentoo
Posts: 162

Rep: Reputation: 30
How to compile GCC if you don't have GCC?


I was wondering the other day. How do you compile GCC if you don't have GCC and GCC is a dependency? And how did the first version of GCC get compiled? And how do future versions of GCC get compiled, by older versions? And then after they finish compiling the new version of GCC with the old version of GCC, do they then go ahead and recompile the new version of GCC with the newly compiled version of GCC which they just built??? /me brain explodes just thinking about it

khermans
 
Old 05-09-2004, 01:58 AM   #2
Shade
Senior Member
 
Registered: Mar 2003
Location: Burke, VA
Distribution: RHEL, Slackware, Ubuntu, Fedora
Posts: 1,418
Blog Entries: 1

Rep: Reputation: 46
I've done it

You use a host system with gcc already installed. I suppose you could do it without gcc, with say, the intel compiler. But when I did LFS, I use my host system's gcc to compile my own gcc.

--Shade
 
Old 05-09-2004, 06:59 AM   #3
crashmeister
Senior Member
 
Registered: Feb 2002
Distribution: t2 - trying to anyway
Posts: 2,541

Rep: Reputation: 47
There is a very confusing howto at the gcc website.
 
Old 05-09-2004, 08:27 AM   #4
khermans
Member
 
Registered: Sep 2001
Distribution: Ubuntu, Debian, Gentoo
Posts: 162

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by crashmeister
There is a very confusing howto at the gcc website.
Do you have a link? I could not find one ;-(

khermans
 
Old 05-10-2004, 07:07 AM   #5
crashmeister
Senior Member
 
Registered: Feb 2002
Distribution: t2 - trying to anyway
Posts: 2,541

Rep: Reputation: 47
Can't even get to their site right now - seems to be down.
 
Old 05-10-2004, 01:58 PM   #6
khermans
Member
 
Registered: Sep 2001
Distribution: Ubuntu, Debian, Gentoo
Posts: 162

Original Poster
Rep: Reputation: 30
Yeah, I noticed that gcc.gnu.org was down. Can you post a link from Google cache?

Kristian Hermansen
 
Old 05-10-2004, 04:20 PM   #7
Inexactitude
Member
 
Registered: Oct 2003
Distribution: Slackware 12.2, Ubuntu 9.04
Posts: 477

Rep: Reputation: 30
There site seems to be up again as I was just able to get to it at gcc.gnu.org.
 
Old 05-10-2004, 10:59 PM   #8
khermans
Member
 
Registered: Sep 2001
Distribution: Ubuntu, Debian, Gentoo
Posts: 162

Original Poster
Rep: Reputation: 30
I still couldn't find anything in depth on the GCC site. I noticed something about the prerequisites, but they don't say how they build new versions of GCC. Did they use GCC 2.xx to build the GCC 3.xx compiler? And then after they built the GCC 3.xx compiler, did they rebuild the 3.xx compiler again with the new 3.xx binary?!?!?!

Kristian Hermansen
 
Old 05-12-2004, 12:41 AM   #9
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
i have a sorta related question that i'm hoping one of you can help me with...

how do you compile something on slackware 9.1 using gcc 2.95.x which comes with slackware 8.1, instead of slackware 9.1's gcc 3.2.x???

here's the thread i started for this question last month:

http://www.linuxquestions.org/questi...hreadid=174925


any clue you can throw my way would be greatly appreciated... thanks so much...
 
Old 05-12-2004, 01:45 AM   #10
vinay_s_s
Member
 
Registered: Jul 2003
Posts: 659

Rep: Reputation: 30
actually, the gcc tarball has its own static compiler which is used for compiling once.
afterwards, it uses the now compiled gcc to compile itself again,
i think the loop repeates for abt 3 times (and the process is called as bootstraping or something like that)
 
Old 05-12-2004, 04:06 AM   #11
crashmeister
Senior Member
 
Registered: Feb 2002
Distribution: t2 - trying to anyway
Posts: 2,541

Rep: Reputation: 47
Thats how gentoo does it but you can also build it from scratch if you follow the steps on the gcc site but I already get lost with the configuration part.
If you ever loose your compiler with gentoo best thing is to either install rpm's,compile the compiler and get rid of the rpm's after or chroot from a installation cd and install it.
 
Old 05-12-2004, 08:30 AM   #12
khermans
Member
 
Registered: Sep 2001
Distribution: Ubuntu, Debian, Gentoo
Posts: 162

Original Poster
Rep: Reputation: 30
Thanks for the replies, that clears things up a bit!!! Still, if anyone does locate that GCC link to the bootstrapping process let me know. Also, others who browse this thread may be interested in the link as well ;-)

Kristian Hermansen
 
Old 05-12-2004, 05:51 PM   #13
crashmeister
Senior Member
 
Registered: Feb 2002
Distribution: t2 - trying to anyway
Posts: 2,541

Rep: Reputation: 47
http://gcc.gnu.org/install/build.html
should be it
 
Old 05-12-2004, 06:42 PM   #14
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"And how do future versions of GCC get compiled, by older versions?"

Yes

"And then after they finish compiling the new version of GCC with the old version of GCC, do they then go ahead and recompile the new version of GCC with the newly compiled version of GCC which they just built???"

This is possible but unnecessary.

"And how did the first version of GCC get compiled?"

It was compiled on some other compiler.

The first C compiler was probably written in an assembly language.

The first assembler was written in octal machine code about 1946.

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites
 
  


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
Compile GCC 3.3 mullins Linux - Software 1 08-04-2005 06:44 PM
Compile with GCC occ Solaris / OpenSolaris 6 10-29-2004 10:19 AM
gcc can't compile noir911 Programming 1 09-25-2004 10:35 AM
gcc 3.4.1 want not to compile, but 3.2.2 does BorisB Linux - Software 3 07-27-2004 06:53 PM
Can't compile GCC Mikessu Linux - Software 2 05-05-2004 03:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration