Installing a Modern GCC Quickly with Software Collections

From GlueXWiki
Revision as of 20:02, 3 March 2016 by Nsparks (Talk | contribs)

Jump to: navigation, search

Software Collections technology provides a simple non-intrusive way to install modern/non-default software packages on CentOS/RHEL 6. GCC is notorious for taking a long time to build from source. This guide will help you quickly install a software collection named devtoolset-3-toolchain, which includes GCC 4.9.2. These instructions are based on the instructions at https://www.softwarecollections.org/en/scls/rhscl/devtoolset-3/. If you are working on a RHEL machine, follow the instructions at that page, except you should install devtoolset-3-toolchain (like below) unless you want to install the entire collection.

For CentOS, the following instructions avoid needing to manually download the devtoolset-3 RPM.

First, install the CentOS software collections repository, and then install the toolchain part of the Devtoolset-3 software collection.

yum update
yum install centos-release-scl-rh
yum install devtoolset-3-toolchain

To enable the devtoolset software collection in a bash shell do the following:

scl enable devtoolset-3 bash

Alternatively, you can run a single command in the software collection like this

scl enable devtoolset-3 "gcc -v"

or more generally

scl enable devtoolset-3 <cmd>

where <cmd> is any command that uses a package in the software collection.