Skip to content

How to install devtoolset

William Zhang edited this page Aug 31, 2016 · 5 revisions

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