LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 11-21-2006, 06:32 AM   #1
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
How to selectively use GCC 3.4 -OR- GCC 4.1 in FC6 when compiling?


Hi

I'm upgrading to FC6 next month, and I've been reading up on possible problems I might encounter.

One thing that seems to pop up quite promintently is that GCC 4.1 in FC6 won't neccessarily compile GCC 3.4 compliant programs (especiall for C++) which means that I anticipate some trouble getting all the packages I need (that worked and compiled fine on FC3, on my old setup) to compile under FC6, with GCC 4.1, for my new setup.

I know about the

compat-libstdc++-33
compat-libstdc++-296

packages that gives GCC 3.4 "back" to you under FC6.

My question is simple: how do I use the "old" GCC 3.4 instead of GCC 4.1??? If I install these pacakges above, do they remove / overwrite GCC 4.1? Is there some way to have both on the system and then switch between them, for example to be able to try a compile with 4.1, and if it fails try 3.4 with GNU autotools packages? And also with non-autotools packages?

I. e. I want to try and compile everything I need for FC6 with GCC 4.1 (to take advantage of new features and optimisations), and if a compile fails for a vital C++ package,"fall back" on GCC 3.4 to compile that particular C++ package that won't compile under 4.1.

Possible? Apparently so. But how is it done? How can I
"change" the two GCC versions around at will so I can always fall back on 3.4 if 4.1 fails on a C++ package?

ANY help appreciated!

Thanks
 
Old 11-21-2006, 09:01 AM   #2
tamal
LQ Newbie
 
Registered: Mar 2006
Posts: 13

Rep: Reputation: 0
Quote:
Originally Posted by rylan76
My question is simple: how do I use the "old" GCC 3.4 instead of GCC 4.1??? If I install these pacakges above, do they remove / overwrite GCC 4.1? Is there some way to have both on the system and then switch between them, for example to be able to try a compile with 4.1, and if it fails try 3.4 with GNU autotools packages? And also with non-autotools packages?

I. e. I want to try and compile everything I need for FC6 with GCC 4.1 (to take advantage of new features and optimisations), and if a compile fails for a vital C++ package,"fall back" on GCC 3.4 to compile that particular C++ package that won't compile under 4.1.

Possible? Apparently so. But how is it done? How can I
"change" the two GCC versions around at will so I can always fall back on 3.4 if 4.1 fails on a C++ package?
1. You can edit your Makefile by replacing CC=gcc to CC=gcc34
2. You can configure gcc by using alternatives command.
3. you can manually create symbolic link to gcc34. In this case do the following:
# cd /usr/bin
# mv gcc gcc41
When you want gcc 3.4:
# ln -s /usr/bin/gcc34 /usr/bin/gcc
When you want gcc 4.1:
# ln -s /usr/bin/gcc41 /usr/bin/gcc

Now, the second part:
I had a bitter experience to implement "fall back". But it can be made. You know one thing: we can use the return value of a command to determine whether the command has ran successfully or not. So, we can write a bash or Perl script to implement this idea. I think, 'make' do not have such type of provision.
 
Old 11-21-2006, 11:36 PM   #3
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Original Poster
Rep: Reputation: 103Reputation: 103
Thanks Tamal!

That'll definitely help.
 
  


Reply



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
Error compiling gcc 3.3.6 with 64bit gcc 4.0.3 cs-cam Linux - Software 0 04-22-2006 05:20 AM
Compiling gcc without any gcc installed my_kappa Linux - Software 5 01-30-2006 12:15 AM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 11:38 AM
Various Compiling Errors (GCC compiling Openal, GUIlib, xmms-wma) gregorya Linux - Software 2 08-27-2004 05:03 AM
Compiling C++ GCC poeta_boy Linux - Newbie 14 10-14-2003 04:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

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

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