Enable recent gcc version using devtoolset on centOs
This is a trick we use for using various gcc
version on the same machine. The machine my advisor runs on centOs. Everyone has a different requirement for gcc. So, they have this wonderful option of devtoolset. Must be installed by root
user. Assuming that appropriate version is installed. Lets see how to enable it.
$ g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
$ scl enable devtoolset-7 bash
$ g++ --version
g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Usually the installation goes here.
$ ll
total 0
dr-xr-xr-x. 3 root root 32 Dec 20 2017 devtoolset-3
dr-xr-xr-x. 3 root root 32 Dec 20 2017 devtoolset-4
dr-xr-xr-x. 3 root root 32 Dec 20 2017 devtoolset-6
dr-xr-xr-x. 3 root root 32 Jun 1 2018 devtoolset-7
dr-xr-xr-x. 3 root root 32 Mar 19 2020 rh-python35
$ pwd
/opt/rh
Ref
For more info.