LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Updating gcc while keeping the old version (https://www.linuxquestions.org/questions/linux-software-2/updating-gcc-while-keeping-the-old-version-568794/)

serg.kr 07-12-2007 12:17 PM

Updating gcc while keeping the old version
 
Hello,

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.

studioj 07-12-2007 10:03 PM

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.

shivkiyer 07-13-2007 12:29 AM

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?


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