I have gcc 4.8 installed but I also need to install gcc 3.4.3. I have followed these steps:
- Downloaded gcc 3.4.3 from gcc.parentingamerica.com/releases.
- Extracted the tar.
- ./configure
- make
Then it throws this error: http://paste.ubuntu.com/24807240/
Please can anyone suggest what's wrong and also how to ask gcc to use the older version once installed?
OS: Ubuntu 14.04 LTS, 64-bit
Best Answer
Check your current version by running
gcc -v
.Next, You want to install a previous version.
gcc-3.4
Since this version is available in the older releases of Ubuntu, we need to have the appropriate repositories for the version. From some search, I found them to be the following, which have to be added to the
/etc/apt/sources.list
Then after doing
sudo apt-get update
the new repositories will be available.Next, install the required compiler. I usually install
gcc
andg++
of the same version for inter-operability. For general purpose it is recommended.Hence,
sudo apt-get install gcc-3.4 g++-3.4
2. Checking the available compilers
At this stage one will have two set of compilers (one each for
g++
andgcc
). These can be checked bydpkg --list | grep compiler
,You can check the installation location if you need that.
Important is the location of the two set of compilers, which can be listed by,
and
After having required compilers installed one can simply switch among compilers. This is done by updating the list of alternative versions of an application. To do this, the
update-alternative
command has to be run with certain parameters.This will link
g++
togcc
and on changing onlygcc
theg++
will change automatically.Then whenever you want to change the compiler enter this:
Then, user is asked which compiler to choose.
Here you can choose by pressing the key(0,1) and then pressing enter. The change in the current selected version can be checked by
gcc -v
Removing the
update-alternative
update-alternative
that is option 0.sudo apt-get remove gcc-3.4 g++-3.4
then runsudo update-alternatives --config gcc
The program
update-alternatives
will look for links and found them to be missing and will automatically remove the alternative, going back to the other available option.