Red Hat Software Collections "Software Collections give you the power to build, install, and use multiple versions of software on the same system, without affecting system-wide installed packages"
For instance, RHEL6 comes with gcc 4.4.7, but also provides 4.9 and 5.2 via Software Collections (SCL)
And there are other related RPMs (fortran, c++, etc.). To see what is available run the command
yum list devtoolset-4\*
The yum repo for SCL is SLAC RHEL6 Server Software Collections (slac-rhel-x86_64-server-6-rhscl-1). These are installed on public login hosts, if you do not have sudo on a host where it is needed, please send an email to unix-admin@slac.stanford.edu.
For Red Hat Developer Toolset Product Life Cycle please see: https://access.redhat.com/support/policy/updates/dts/
The current RPM names (versions subject to change) for the versions of gcc are:
devtoolset-3-gcc-4.9.2-6.2.el6.x86_64
devtoolset-4-gcc-5.2.1-2.2.el6.x86_64
You can have the meta RPM "devtoolset-4-toolchain" installed to get all the devtoolset GCC related RPMs installed:
ksa@iris02 $ rpm -q --requires devtoolset-4-toolchain
devtoolset-4-runtime
devtoolset-4-gcc
devtoolset-4-gcc-c++
devtoolset-4-gcc-gfortran
devtoolset-4-binutils
devtoolset-4-gdb
devtoolset-4-strace
devtoolset-4-dwz
devtoolset-4-elfutils
devtoolset-4-memstomp
devtoolset-4-ltrace
To use the newer versions in a bash script after the RPMs are installed:
#-----------------------------------------
# to enable newer gcc from software collections:
# (replace devtoolset-4 with current version of devtoolset)
#-----------------------------------------
if [ -x /opt/rh/devtoolset-4/enable ]; then
echo Enabling GCC from Developer Toolset
source /opt/rh/devtoolset-4/enable
fi
To use the newer versions on the command line after the RPMs are installed:
user@host $ scl enable devtoolset-4 bash
bash-4.1$ gcc --version
gcc (GCC) 5.2.1 20150902 (Red Hat 5.2.1-2)
bash-4.1$ exitksa@iris02 $ scl enable devtoolset-4 'gcc --version'
gcc (GCC) 5.2.1 20150902 (Red Hat 5.2.1-2)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The Red Hat Developer Toolset (DTS) is intended to give developers access to updated compilers and tools for C and C++ development.
This fast-moving product will update frequently and will have a much shorter product life cycle and support term than Red Hat Enterprise Linux.
For more information on Red Hat Software Collections and Developer Toolset:
https://access.redhat.com/support/policy/updates/rhscl
https://access.redhat.com/support/policy/updates/dts/