Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For instance, RHEL6 comes with gcc 4.4.7, but also provides 4.9 and 5.2 6.3.1 (and later) via Software Collections (SCL).  

ksa@rhel6-64 $ scl enable devtoolset-6 'gcc --version' | head -1
gcc (GCC) 6.3.1 20170216 (Red Hat 6.3.1-3)
ksa@rhel6-64 $ scl enable devtoolset-7 'gcc --version' | head -1
gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
ksa@rhel6-64 $ scl enable devtoolset-8 'gcc --version' | head -1
gcc (GCC) 8.2.1 20180905 (Red Hat 8.2.1-3)

Newer versions of build-time package are available (eg, gcc, valgrind, make, etc) and run-time packages too (python, ruby, php, git, mariadb, maven, nodejs, perl, java, nginx, mysql, mongodb, postgresql, redis, etc).

And there are other related RPMs (fortran, c++, etc.). To see what is available run the command

scl -l
 yumyum list devtoolset-4\* installed | grep rhscl | grep -v '^ '

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. 

...

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
ksa@rhel6-64l $ rpm -q devtoolset-6
devtoolset-6-6.1-1.el6.x86_64

You can have the 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  

 

6" will install other meta RPMs: devtoolset-6-{perftools, runtime, toolchain}.  Here's an example with devtoolset-6:

ksa@rhel6-64l $ rpm -q --requires devtoolset-6
devtoolset-6-perftools 
devtoolset-6-runtime 
devtoolset-6-toolchain  

To use the newer versions in a bash script after the RPMs are installed :(or see below for another method)

#-----------------------------------------
# to enable newer gcc from software collections:
# (replace devtoolset-46 with current version of devtoolset)
#-----------------------------------------
if [ -x /opt/rh/devtoolset-46/enable ]; then
echo Enabling GCC from Developer Toolset
source /opt/rh/devtoolset-46/enable
fi

...

To use the newer versions on the command line after the RPMs are installed
(this example is from devtoolset-4, but the same idea works for devtoolset-6):

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$ exit
ksa@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.

 

How to install Developer Toolset / Software Collections on CentOS 7:

$ sudo yum install centos-release-scl
$ sudo yum install devtoolset-6
$ scl enable devtoolset-6  'gcc --version | head -1'
gcc (GCC) 6.2.1 20160916 (Red Hat 6.2.1-3)

How to use the Software Collections version of a runtime program (eg, perl, python) from a script (the alternative process above might be safer since it checks to see if the software collection is installed first)

#!/usr/bin/scl enable rh-perl524 -- perl
print "$^V\n";
The output of that script shows the version of perl found and used is perl 5.24 from SCL:
ksa@cdlogin3 $ scl --list | grep perl
rh-perl524

ksa@cdlogin3 $ cat ~ksa/public/perl.scl.example.pl
#!/usr/bin/scl enable rh-perl524 -- perl
print "$^V\n";

ksa@cdlogin3 $ ~ksa/public/perl.scl.example.pl
v5.24.0

Here is a python 3.7 example:

ksa@lnxcron $ cat ~ksa/bin/python-scl-test.py
#!/usr/bin/scl enable rh-python36 -- python
from platform import python_version
print('Hello, this is Python', python_version())
ksa@lnxcron $ ~ksa/bin/python-scl-test.py
Hello, this is Python 3.6.3

 Here is an example of how to write a script for a cronjob which enables a Software Collections (mysql)

...

and also accepts parameters:

[ksa@mysql01b ~]$ cat ~ksa/t.sh
#!/usr/bin/scl enable rh-mysql57 -- bash
echo hi, you entered $1 and this is the mysql version:
mysql --version

[ksa@mysql01b ~]$ ~ksa/t.sh Karl
hi, you entered Karl and this is the mysql version:
mysql Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using EditLine wrapper

You can see that it accepts the parameter to the script, and also that the mysql 5.7 SCL is enabled.

...

 

 

...


The Red Hat Developer Toolset (DTS) is intended to give developers access to updated compilers and tools for C and C++ development.

...

https://access.redhat.com/support/policy/updates/rhscl
https://access.redhat.com/support/policy/updates/dts/
https://www.softwarecollections.org/