Skip to main content

Installing Developer Toolset on RHEL-based Distributions

Technical
Author
Kuan-Yi Li

Comes in handy when you need newer versions of developer tools such as GCC, GDB, Valgrind, etc.

Hidden Perk
#

Executables built with the Red Hat Developer Toolset toolchain can then also be deployed and run on multiple versions of Red Hat Enterprise Linux; on the other hand, executables built with self-compiled GCC often require another copy of runtime libraries to run due to GLIBC/GLIBCXX ABI incompatibility, leaves deployment complicated even for systems with identical OS version.

Install Software Collections
#

In order to install Developer Toolset, Software Collections must be installed first.

RHEL 8
#

yum-config-manager --enable rhel-server-rhscl-8-rpms

RHEL 7
#

yum-config-manager --enable rhel-server-rhscl-7-rpms

RHEL 6
#

yum-config-manager --enable rhel-server-rhscl-6-rpms

CentOS
#

yum install centos-release-scl

Scientific Linux 7
#

yum install yum-conf-repos
yum install yum-conf-softwarecollections

Scientific Linux 6 (EOL)
#

yum install "http://ftp.scientificlinux.org/linux/scientific/6/external_products/softwarecollections/yum-conf-softwarecollections-2.0-1.el6.noarch.rpm"

Install Developer Toolset
#

Install the version(s) of your choice. Yes, they can co-exist.

Developer Toolset 10 (GCC 10, etc.)
#

yum install devtoolset-10

Developer Toolset 9 (GCC 9, etc.)
#

yum install devtoolset-9

Developer Toolset 8 (GCC 8, etc.)
#

yum install devtoolset-8

Developer Toolset 7 (GCC 7, etc.)
#

yum install devtoolset-7

Developer Toolset 6 (GCC 6, etc.)
#

yum install devtoolset-6

Developer Toolset 4 (GCC 5, etc.)
#

yum install devtoolset-4

Developer Toolset 3 (GCC 4, etc.)
#

yum install devtoolset-3

Use Installed Developer Toolset
#

Say you want to use Developer Toolset 8, you can run

scl enable devtoolset-10 bash

to invoke a BASH shell with environment variables setup to run Developer Toolset 10, check it yourself with

gcc --version

References
#