Friday, October 15, 2010

How to change your gcc compiler in Ubuntu 10.10 32Bit to another gcc version

Ubuntu 10.10 comes by default with gcc 4.4 (at least when this post was written)
You might need to change the gcc to an older version for whatever reasons (installing SCoPE simulator for example)
Go to Synaptic and install the desired gcc version ( gcc-4.3, gcc-4.5, etc.) also install cpp and g++ for the same version. If you need gcc-4.1 skip the g++ (I did not find it)
After installing these packages open a terminal and run the following commands (replace 4.4 to your desired version of gcc - with the code below you go back to the original settings):

cd /usr/bin
sudo rm cpp gcc g++
sudo ln -s g++-4.4 g++
sudo ln -s gcc-4.4 gcc
sudo ln -s cpp-4.4 cpp

If you want to install gcc-4.1 do this:

cd /usr/bin
sudo rm cpp gcc
sudo ln -s gcc-4.1 gcc
sudo ln -s cpp-4.1 cpp

This works for Ubuntu 10.10 on 32 bits. You might have to do other steps on 64 bits. See this post about this

No comments: