LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   How to selectively use GCC 3.4 -OR- GCC 4.1 in FC6 when compiling? (https://www.linuxquestions.org/questions/fedora-35/how-to-selectively-use-gcc-3-4-or-gcc-4-1-in-fc6-when-compiling-503542/)

rylan76 11-21-2006 06:32 AM

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

tamal 11-21-2006 09:01 AM

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. :study:
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: :confused:
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. :tisk:

rylan76 11-21-2006 11:36 PM

Thanks Tamal!

That'll definitely help.


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