Skip to content

How to install devtoolset

Wenliang ZHANG edited this page Feb 28, 2022 · 5 revisions

Ubuntu?

https://linuxconfig.org/how-to-switch-between-multiple-gcc-and-g-compiler-versions-on-ubuntu-20-04-lts-focal-fossa https://github.com/zedware/notebook/wiki/Ubuntu:-live-with-multiple-versions-of-gcc-etc.

CentOS: devtoolset-7 & 8

https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/ https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/

CentOS: devtoolset-2/3/4 for C++11

Read the excellent summary here link.

The development machine is too old, but more and more projects need c++11 support. Red Hat creates the tool sets, devtoolset-2(gcc-4.8.2)、devtoolset-3(gcc-4.9.2)、devtoolset-4(gcc-5.2.1). They have gcc, gdb, eclipse packaged.

$ sudo wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo
$ sudo rpm --import http://ftp.scientificlinux.org/linux/scientific/5x/x86_64/RPM-GPG-KEYs/RPM-GPG-KEY-cern
$ sudo yum install devtoolset-2 

We can choose the packages, for example,

$ sudo yum install devtoolset-2-toolchain

Switch to the devtoolset. NB: no sudo here.

$ scl enable devtoolset-2 bash

Or we can add the line to .bash_profile.

$ source /opt/rh/devtoolset-2/enable

Or we can make it the default tool chain.

$ sudo ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
$ sudo hash -r
Clone this wiki locally