Welcome to the most active Linux Forum on the web.
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 07-12-2007, 12:17 PM   #1
LQ Newbie
Registered: Jul 2007
Distribution: Debian
Posts: 15

Rep: Reputation: 2
Updating gcc while keeping the old version


I use Debian 3.4, and I'm quite new to Linux.

I'm wondering if it is possible to upgrade the gcc compiler on my system from version 3.3 to 3.4, but without completely erasing version 3.3. Many source packages are very specific about what compiler version they use, and I do not want to lose the ability to compile them.

I tried simply doing apt-get install gcc-3.4 and then changing the symbolic link /usr/bin/gcc to point to /usr/bin/gcc-3.4 instead of /usr/bin/gcc-3.3. But I suspect that this method isn't the proper way to do this, since I got a bunch of compiler errors when I tried to build something.

The apt-get install gcc-3.4 command does not wipe out gcc-3.3, which is good. But it does not update what version of gcc is used when the gcc command is run. Because of this, I have a suspicion that the install command is not all there is to it to update the compiler.

So, specifically, my questions are:

1. On Debain, is the apt-get install gcc-3.4 command sufficient to update the compiler? What other steps may be necessary?

2. What is the proper way to specify what compiler version is used when gcc is called?

3. How can I temporarily revert to an older compiler version if a specific source package requires it?

Keep in mind that I am somewhat new to Linux, but I do have some experience in programming. Thank you in advance for help.
Old 07-12-2007, 10:03 PM   #2
Registered: Oct 2006
Posts: 460

Rep: Reputation: 31
it is fairly unusual for something to not compile with 3.4 and to work with 3.3.
the real changes are between 2.9 3.x and 4.x
don't mess with the sim links but use the shell variable CC like
export CC=/path/to/some/gcc
or put the gcc you want in the front of the PATH variabe
export PATH=/opt/gcc-3.3.6/bin:"${PATH}"
you can use the compiler you have to build any version you like if you use --prefix=/opt/gcc.x.x.x
in the configuration so you don't overwrite anything important
if you build one compiler with another use the "bootstrap" target so it can get all the code cleaned up with subsequent passes.
Old 07-13-2007, 12:29 AM   #3
Registered: Jun 2007
Location: India
Distribution: Ubuntu, Slackware
Posts: 157

Rep: Reputation: 15
I too have a similar query. I am using CentOS 32 bit OS and have installed a minimal base system. I want to compile all the major packages using source codes and maybe recompile some of the base packages also.

I tried to install xineui-0.99.3 with gcc-4.2 but it gave syntax errors during make. So I installed gcc-3.4.3 through source codes using bootstrap and compiled xineui-0.99.3 successfully. But when I was installing libX11 for xorg-7.1, I got compile errors with gcc-3.4.3. Maybe now I need to use gcc-4.2.

Suppose I have the gcc build directories for both gcc-3.4.3 and gcc-4.2 in separate directories. Both have been compiled with the make bootstrap command. If I want to switch between these two could it be possible to get inside the gcc-build directories and issue a make install command as root?



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
Regarding distribution + kernel version + gcc version + glib version. JCipriani Linux - General 8 04-19-2008 02:54 PM
Keeping two versions of gcc with apt4rpm bio71 Linux - Software 0 05-03-2006 10:12 AM
dpkg and keeping the old version eltongeoff Debian 4 09-24-2003 11:36 AM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 12:07 AM
Sample Driver Module incompatibility with Kernel version (or gcc version) jvs Linux - General 1 06-07-2002 01:40 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:28 PM.

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