I want to install several gcc with different versions in centos. The default version of gcc in centos6 is 4.9.3. So I use devtoolset install a higher version of gcc. Then I switch to the higher version of gcc by executing "source /opt/rh/devtoolset-5/enable". But now if I want to switch back to the default gcc, how should I do? By the way, is there any solution to install multiple gcc with different versions in centos 5?
On Sat, 2018-12-01 at 11:03 +0800, yf chu wrote:
I want to install several gcc with different versions in centos. The default version of gcc in centos6 is 4.9.3. So I use devtoolset install a higher version of gcc. Then I switch to the higher version of gcc by executing "source /opt/rh/devtoolset-5/enable". But now if I want to switch back to the default gcc, how should I do?
Exit the shell and start a new one.
If you want to frequently shift between the different versions then probably the best way is to use the instructions in the devtoolset docs - i.e. do
scl enable devtoolset-5 bash
This will start a shell with the correct environment. You can then just terminate the shell that's just been started to get back the the original environment.
By the way, is there any solution to install multiple gcc with different versions in centos 5?
CentOS 5 is no longer a supported operating system - you should not be using it since it hasn't had any security or bug fixes for a while. As such you won't find any repositories with updated versions of software for it. The only way you are going to get updated versions of GCC on it is by compiling them yourself - and even then you may need dependencies that aren't available for such an old distro.
P.