Chapter 12. Using GCC Toolset

12.1. What is GCC Toolset

Red Hat Enterprise Linux 8 introduces GCC Toolset, an Application Stream containing more up-to-date versions of development and performance analysis tools. GCC Toolset is similar to Red Hat Developer Toolset for RHEL 7.

GCC Toolset is available as an Application Stream in the form of a software collection in the AppStream repository. GCC Toolset is fully supported under Red Hat Enterprise Linux Subscription Level Agreements, is functionally complete, and is intended for production use. Applications and libraries provided by GCC Toolset do not replace the Red Hat Enterprise Linux system versions, do not override them, and do not automatically become default or preferred choices. Using a framework called software collections, an additional set of developer tools is installed into the /opt/ directory and is explicitly enabled by the user on demand using the scl utility. Unless noted otherwise for specific tools or features, GCC Toolset is available for all architectures supported by Red Hat Enterprise Linux.

12.2. Installing GCC Toolset

Installing GCC Toolset on a system installs the main tools and all necessary dependencies. Note that some parts of the toolset are not installed by default and must be installed separately.

Procedure

  • To install GCC Toolset version N:

    # yum install gcc-toolset-N

12.3. Installing individual packages from GCC Toolset

To install only certain tools from GCC Toolset instead of the whole toolset, list the available packages and install the selected ones with the yum package management tool. This procedure is useful also for packages that are not installed by default with the toolset.

Procedure

  1. List the packages available in GCC Toolset version N:

    $ yum list available gcc-toolset-N-\*
  2. To install any of these packages:

    # yum install package_name

    Replace package_name with a space-separated list of packages to install. For example, to install the gcc-toolset-9-gdb-gdbserver and gcc-toolset-9-gdb-doc packages:

    # yum install gcc-toolset-9-gdb-gdbserver gcc-toolset-9-gdb-doc

12.4. Uninstalling GCC Toolset

To remove the GCC Toolset from your system, uninstall it using the yum package management tool.

Procedure

  • To uninstall GCC Toolset version N:

    # yum remove gcc-toolset-N\*

12.5. Running a tool from GCC Toolset

To run a tool from GCC Toolset, use the scl utility.

Procedure

  • To run a tool from GCC Toolset version N:

    $ scl enable gcc-toolset-N tool

12.6. Running a shell session with GCC Toolset

GCC Toolset allows running a shell session where the GCC Toolset tool versions are used instead of system versions of these tools, without explicitly using the scl command. This is useful when you need to interactively start the tools many times, such as when setting up or testing a development setup.

Procedure

  • To run a shell session where tool versions from GCC Toolset version N take precedence over system versions of these tools:

    $ scl enable gcc-toolset-N bash