Chapter 4. Additional toolsets for development
GCC Toolset and related toolsets provide newer compilers and debuggers for C, C++, and Fortran. Use these topics to install, use, and run container images for development.
4.1. Using the GCC Toolset Copy linkLink copied to clipboard!
4.1.1. What is the GCC Toolset Copy linkLink copied to clipboard!
Red Hat Enterprise Linux 8 introduces the GCC Toolset, a compiler toolset that provides a variety of development and performance analysis tools. GCC Toolset is similar to Red Hat Developer Toolset.
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 the 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 by using the scl utility. Unless noted otherwise for specific tools or features, the GCC Toolset is available for all architectures supported by Red Hat Enterprise Linux.
For information about the length of support, see Red Hat Enterprise Linux Application Streams Life Cycle.
4.1.2. Installing the GCC Toolset Copy linkLink copied to clipboard!
Installing the 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 the GCC Toolset version N:
# yum install gcc-toolset-N
4.1.3. Installing individual packages from the GCC Toolset Copy linkLink copied to clipboard!
To install only certain tools from the GCC Toolset instead of the whole toolset, list the available packages and install the selected ones with the yum package management tool. Use selective installation to access packages not installed by default with the full toolset.
Procedure
List the packages available in the GCC Toolset version N:
$ yum list available gcc-toolset-N-\*To install any of these packages:
# yum install package_nameReplace package_name with a space-separated list of packages to install. For example, to install the
gcc-toolset-13-annobin-annocheckandgcc-toolset-13-binutils-develpackages:# yum install gcc-toolset-13-annobin-annocheck gcc-toolset-13-binutils-devel
4.1.4. Uninstalling the GCC Toolset Copy linkLink copied to clipboard!
To remove the GCC Toolset from your system, uninstall it by using the yum package management tool.
Procedure
To uninstall the GCC Toolset version N:
# yum remove gcc-toolset-N\*
4.1.5. Accessing the GCC Toolset Copy linkLink copied to clipboard!
To access the GCC Toolset, you can run a specific tool using the scl utility, or start a shell session where the toolset versions override the system versions.
Procedure
To run a single tool from the GCC Toolset version N:
$ scl enable gcc-toolset-N toolReplace tool with the command provided by the tool you want to run.
To run a shell session where tool versions from the GCC Toolset version N override system versions of these tools:
$ scl enable gcc-toolset-N bash
4.2. GCC Toolset 9 Copy linkLink copied to clipboard!
Learn about information specific to the GCC Toolset version 9 and the tools contained in this version.
4.2.1. Tools and versions provided by the GCC Toolset 9 Copy linkLink copied to clipboard!
GCC Toolset 9 provides the following tools and versions.
| Name | Version | Description |
|---|---|---|
| GCC | 9.2.1 | A portable compiler suite with support for C, C++, and Fortran. |
| GDB | 8.3 | A command-line debugger for programs written in C, C++, and Fortran. |
| Valgrind | 3.15.0 | An instrumentation framework and several tools to profile applications in order to detect memory errors, identify memory management problems, and report any use of improper arguments in system calls. |
| SystemTap | 4.1 | A tracing and probing tool to monitor the activities of the entire system without the need to instrument, recompile, install, and reboot. |
| Dyninst | 10.1.0 | A library for instrumenting and working with user-space executables during their execution. |
| binutils | 2.32 | A collection of binary tools and other utilities to inspect and manipulate object files and binaries. |
| elfutils | 0.176 | A collection of binary tools and other utilities to inspect and manipulate ELF files. |
| dwz | 0.12 | A tool to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size. |
| make | 4.2.1 | A dependency-tracking build automation tool. |
| strace | 5.1 | A debugging tool to monitor system calls that a program uses and signals it receives. |
| ltrace | 0.7.91 | A debugging tool to display calls to dynamic libraries that a program makes. It can also monitor system calls executed by programs. |
| annobin | 9.08 | A build security checking tool. |
4.2.2. C++ compatibility in the GCC Toolset 9 Copy linkLink copied to clipboard!
The GNU Compiler Collection (GCC) in the GCC Toolset 9 supports multiple C++ language standards.
The compatibility information presented here apply only to the GCC from the GCC Toolset 9.
- C++14
-
This is the default language standard setting for the GCC Toolset 9, with GNU extensions, equivalent to explicitly using option
-std=gnu++14.
Using the C++14 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 6 or later.
- C++11
- This language standard is available in the GCC Toolset 9.
Using the C++11 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 5 or later.
- C++98
- This language standard is available in the GCC Toolset 9. Binaries, shared libraries and objects built using this standard can be freely mixed regardless of being built with GCC from the GCC Toolset, Red Hat Developer Toolset, and RHEL 5, 6, 7 and 8.
- C++17, C++2a
- These language standards are available in the GCC Toolset 9 only as an experimental, unstable, and unsupported capability. Additionally, compatibility of objects, binary files, and libraries built using these standards cannot be guaranteed.
All of the language standards are available in both the standard compliant variant or with GNU extensions.
When mixing objects built by using the GCC Toolset with those built with the RHEL toolchain (particularly .o or .a files), the GCC Toolset toolchain should be used for any linkage. This ensures any newer library features provided only by the GCC Toolset are resolved at link time.
4.2.3. Specifics of GCC in the GCC Toolset 9 Copy linkLink copied to clipboard!
Certain behaviors and requirements of the GCC Toolset 9 differ from the base Red Hat Enterprise Linux GNU Compiler Collection (GCC). These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-9 'gcc -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-9 'gcc objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of GCC.
4.2.4. Specifics of binutils in the GCC Toolset 9 Copy linkLink copied to clipboard!
Certain behaviors and requirements of binutils in the GCC Toolset 9 differ from the base Red Hat Enterprise Linux binutils. These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-9 'ld -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice, and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-9 'ld objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of binutils.
4.3. GCC Toolset 10 Copy linkLink copied to clipboard!
Learn about information specific to the GCC Toolset version 10 and the tools contained in this version.
4.3.1. Tools and versions provided by the GCC Toolset 10 Copy linkLink copied to clipboard!
GCC Toolset 10 provides the following tools and versions.
| Name | Version | Description |
|---|---|---|
| GCC | 10.2.1 | A portable compiler suite with support for C, C++, and Fortran. |
| GDB | 9.2 | A command-line debugger for programs written in C, C++, and Fortran. |
| Valgrind | 3.16.0 | An instrumentation framework and several tools to profile applications in order to detect memory errors, identify memory management problems, and report any use of improper arguments in system calls. |
| SystemTap | 4.4 | A tracing and probing tool to monitor the activities of the entire system without the need to instrument, recompile, install, and reboot. |
| Dyninst | 10.2.1 | A library for instrumenting and working with user-space executables during their execution. |
| binutils | 2.35 | A collection of binary tools and other utilities to inspect and manipulate object files and binaries. |
| elfutils | 0.182 | A collection of binary tools and other utilities to inspect and manipulate ELF files. |
| dwz | 0.12 | A tool to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size. |
| make | 4.2.1 | A dependency-tracking build automation tool. |
| strace | 5.7 | A debugging tool to monitor system calls that a program uses and signals it receives. |
| ltrace | 0.7.91 | A debugging tool to display calls to dynamic libraries that a program makes. It can also monitor system calls executed by programs. |
| annobin | 9.29 | A build security checking tool. |
4.3.2. C++ compatibility in the GCC Toolset 10 Copy linkLink copied to clipboard!
The GNU Compiler Collection (GCC) in the GCC Toolset can use the following C++ standards:
The compatibility information presented here apply only to the GCC from the GCC Toolset 10.
- C++14
This is the default language standard setting for the GCC Toolset 10, with GNU extensions, equivalent to explicitly using option
-std=gnu++14.Using the C++14 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 6 or later.
- C++11
This language standard is available in the GCC Toolset 10.
Using the C++11 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 5 or later.
- C++98
- This language standard is available in the GCC Toolset 10. Binaries, shared libraries and objects built using this standard can be freely mixed regardless of being built with GCC from the GCC Toolset, Red Hat Developer Toolset, and RHEL 5, 6, 7 and 8.
- C++17
- This language standard is available in the GCC Toolset 10.
- C++20
- This language standard is available in the GCC Toolset 10 only as an experimental, unstable, and unsupported capability. Additionally, compatibility of objects, binary files, and libraries built using this standard cannot be guaranteed.
All of the language standards are available in both the standard compliant variant or with GNU extensions.
When mixing objects built by using the GCC Toolset with those built with the RHEL toolchain (particularly .o or .a files), the GCC Toolset toolchain should be used for any linkage. This ensures any newer library features provided only by the GCC Toolset are resolved at link time.
4.3.3. Specifics of GCC in the GCC Toolset 10 Copy linkLink copied to clipboard!
Certain behaviors and requirements of the GCC Toolset 10 differ from the base Red Hat Enterprise Linux GNU Compiler Collection (GCC). These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-10 'gcc -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-10 'gcc objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of GCC.
4.3.4. Specifics of binutils in the GCC Toolset 10 Copy linkLink copied to clipboard!
Certain behaviors and requirements of binutils in the GCC Toolset 10 differ from the base Red Hat Enterprise Linux binutils. These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-10 'ld -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice, and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-10 'ld objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of binutils.
4.4. GCC Toolset 11 Copy linkLink copied to clipboard!
Learn about information specific to the GCC Toolset version 11 and the tools contained in this version.
4.4.1. Tools and versions provided by the GCC Toolset 11 Copy linkLink copied to clipboard!
GCC Toolset 11 provides the following tools and versions.
| Name | Version | Description |
|---|---|---|
| GCC | 11.2.1 | A portable compiler suite with support for C, C++, and Fortran. |
| GDB | 10.2 | A command-line debugger for programs written in C, C++, and Fortran. |
| Valgrind | 3.17.0 | An instrumentation framework and several tools to profile applications in order to detect memory errors, identify memory management problems, and report any use of improper arguments in system calls. |
| SystemTap | 4.5 | A tracing and probing tool to monitor the activities of the entire system without the need to instrument, recompile, install, and reboot. |
| Dyninst | 11.0.0 | A library for instrumenting and working with user-space executables during their execution. |
| binutils | 2.36.1 | A collection of binary tools and other utilities to inspect and manipulate object files and binaries. |
| elfutils | 0.185 | A collection of binary tools and other utilities to inspect and manipulate ELF files. |
| dwz | 0.14 | A tool to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size. |
| make | 4.3 | A dependency-tracking build automation tool. |
| strace | 5.13 | A debugging tool to monitor system calls that a program uses and signals it receives. |
| ltrace | 0.7.91 | A debugging tool to display calls to dynamic libraries that a program makes. It can also monitor system calls executed by programs. |
| annobin | 10.23 | A build security checking tool. |
4.4.2. C++ compatibility in the GCC Toolset 11 Copy linkLink copied to clipboard!
The GNU Compiler Collection (GCC) in the GCC Toolset can use the following C++ standards:
The compatibility information presented here apply only to the GCC from the GCC Toolset 11.
- C++14
This language standard is available in the GCC Toolset 11.
Using the C++14 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 6 or later.
- C++11
This language standard is available in the GCC Toolset 11.
Using the C++11 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 5 or later.
- C++98
- This language standard is available in the GCC Toolset 11. Binaries, shared libraries and objects built using this standard can be freely mixed regardless of being built with GCC from the GCC Toolset, Red Hat Developer Toolset, and RHEL 5, 6, 7 and 8.
- C++17
This language standard is available in the GCC Toolset 11.
This is the default language standard setting for the GCC Toolset 11, with GNU extensions, equivalent to explicitly using option
-std=gnu++17.Using the C++17 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 10 or later.
- C++20 and C++23
This language standard is available in the GCC Toolset 11 only as an experimental, unstable, and unsupported capability. Additionally, compatibility of objects, binary files, and libraries built using this standard cannot be guaranteed.
To enable C++20 support, add the command-line option
-std=c++20to your g++ command line.To enable C++23 support, add the command-line option
-std=c++2bto your g++ command line.
All of the language standards are available in both the standard compliant variant or with GNU extensions.
When mixing objects built by using the GCC Toolset with those built with the RHEL toolchain (particularly .o or .a files), the GCC Toolset toolchain should be used for any linkage. This ensures any newer library features provided only by the GCC Toolset are resolved at link time.
4.4.3. Specifics of GCC in the GCC Toolset 11 Copy linkLink copied to clipboard!
Certain behaviors and requirements of the GCC Toolset 11 differ from the base Red Hat Enterprise Linux GNU Compiler Collection (GCC). These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-11 'gcc -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-11 'gcc objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of GCC.
4.4.4. Specifics of binutils in the GCC Toolset 11 Copy linkLink copied to clipboard!
Certain behaviors and requirements of binutils in the GCC Toolset 11 differ from the base Red Hat Enterprise Linux binutils. These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-11 'ld -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice, and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-11 'ld objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of binutils.
4.5. GCC Toolset 12 Copy linkLink copied to clipboard!
Learn about information specific to the GCC Toolset version 12 and the tools contained in this version.
4.5.1. Tools and versions provided by the GCC Toolset 12 Copy linkLink copied to clipboard!
GCC Toolset 12 provides the following tools and versions.
| Name | Version | Description |
|---|---|---|
| GCC | 12.2.1 | A portable compiler suite with support for C, C++, and Fortran. |
| GDB | 11.2 | A command-line debugger for programs written in C, C++, and Fortran. |
| binutils | 2.38 | A collection of binary tools and other utilities to inspect and manipulate object files and binaries. |
| dwz | 0.14 | A tool to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size. |
| annobin | 11.08 | A build security checking tool. |
4.5.2. C++ compatibility in the GCC Toolset 12 Copy linkLink copied to clipboard!
The GNU Compiler Collection (GCC) in the GCC Toolset can use the following C++ standards:
The compatibility information presented here apply only to the GCC from the GCC Toolset 12.
- C++14
This language standard is available in the GCC Toolset 12.
Using the C++14 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 6 or later.
- C++11
This language standard is available in the GCC Toolset 12.
Using the C++11 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 5 or later.
- C++98
- This language standard is available in the GCC Toolset 12. Binaries, shared libraries and objects built using this standard can be freely mixed regardless of being built with GCC from the GCC Toolset, Red Hat Developer Toolset, and RHEL 5, 6, 7 and 8.
- C++17
This language standard is available in the GCC Toolset 12.
This is the default language standard setting for the GCC Toolset 12, with GNU extensions, equivalent to explicitly using option
-std=gnu++17.Using the C++17 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 10 or later.
- C++20 and C++23
This language standard is available in the GCC Toolset 12 only as an experimental, unstable, and unsupported capability. Additionally, compatibility of objects, binary files, and libraries built using this standard cannot be guaranteed.
To enable C++20 support, add the command-line option
-std=c++20to your g++ command line.To enable C++23 support, add the command-line option
-std=c++23to your g++ command line.
All of the language standards are available in both the standard compliant variant or with GNU extensions.
When mixing objects built by using the GCC Toolset with those built with the RHEL toolchain (particularly .o or .a files), the GCC Toolset toolchain should be used for any linkage. This ensures any newer library features provided only by the GCC Toolset are resolved at link time.
4.5.3. Specifics of GCC in the GCC Toolset 12 Copy linkLink copied to clipboard!
Certain behaviors and requirements of the GCC Toolset 12 differ from the base Red Hat Enterprise Linux GNU Compiler Collection (GCC). These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-12 'gcc -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-12 'gcc objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of GCC.
4.5.4. Specifics of binutils in the GCC Toolset 12 Copy linkLink copied to clipboard!
Certain behaviors and requirements of binutils in the GCC Toolset 12 differ from the base Red Hat Enterprise Linux binutils. These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-12 'ld -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice, and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-12 'ld objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of binutils.
4.5.5. Specifics of annobin in the GCC Toolset 12 Copy linkLink copied to clipboard!
Under some circumstances, due to a synchronization issue between annobin and gcc in the GCC Toolset 12, your compilation can fail with an error message that looks similar to the following:
cc1: fatal error: inaccessible plugin file
opt/rh/gcc-toolset-12/root/usr/lib/gcc/architecture-linux-gnu/12/plugin/gcc-annobin.so
expanded from short plugin name gcc-annobin: No such file or directory
To work around the problem, create a symbolic link in the plugin directory from the annobin.so file to the gcc-annobin.so file:
Change to the plugin directory:
# cd /opt/rh/gcc-toolset-12/root/usr/lib/gcc/architecture-linux-gnu/12/pluginCreate the symbolic link:
# ln -s annobin.so gcc-annobin.so
Replace architecture with the architecture you use in your system:
-
aarch64 -
i686 -
ppc64le -
s390x -
x86_64
4.6. GCC Toolset 13 Copy linkLink copied to clipboard!
Learn about information specific to the GCC Toolset version 13 and the tools contained in this version.
4.6.1. Tools and versions provided by the GCC Toolset 13 Copy linkLink copied to clipboard!
GCC Toolset 13 provides the following tools and versions.
| Name | Version | Description |
|---|---|---|
| GCC | 13.2.1 | A portable compiler suite with support for C, C++, and Fortran. |
| GDB | 12.1 | A command-line debugger for programs written in C, C++, and Fortran. |
| binutils | 2.40 | A collection of binary tools and other utilities to inspect and manipulate object files and binaries. |
| dwz | 0.14 | A tool to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size. |
| annobin | 12.32 | A build security checking tool. |
4.6.2. C++ compatibility in the GCC Toolset 13 Copy linkLink copied to clipboard!
The GNU Compiler Collection (GCC) compiler in the GCC Toolset can use the following C++ standards:
The compatibility information presented here apply only to the GCC from the GCC Toolset 13.
- C++14
This language standard is available in the GCC Toolset 13.
Using the C++14 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 6 or later.
- C++11
This language standard is available in the GCC Toolset 13.
Using the C++11 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 5 or later.
- C++98
- This language standard is available in the GCC Toolset 13. Binaries, shared libraries and objects built using this standard can be freely mixed regardless of being built with GCC from the GCC Toolset, Red Hat Developer Toolset, and RHEL 5, 6, 7 and 8.
- C++17
This language standard is available in the GCC Toolset 13.
This is the default language standard setting for the GCC Toolset 13, with GNU extensions, equivalent to explicitly using option
-std=gnu++17.Using the C++17 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 10 or later.
- C++20 and C++23
These language standards are available in the GCC Toolset 13 only as an experimental, unstable, and unsupported capability. Additionally, compatibility of objects, binary files, and libraries built using this standard cannot be guaranteed.
To enable the C++20 standard, add the command-line option
-std=c++20to your g++ command line.To enable the C++23 standard, add the command-line option
-std=c++23to your g++ command line.
All of the language standards are available in both the standard compliant variant or with GNU extensions.
When mixing objects built by using the GCC Toolset with those built with the RHEL toolchain (particularly .o or .a files), the GCC Toolset toolchain should be used for any linkage. This ensures any newer library features provided only by the GCC Toolset are resolved at link time.
4.6.3. Specifics of GCC in the GCC Toolset 13 Copy linkLink copied to clipboard!
Certain behaviors and requirements of the GCC Toolset 13 differ from the base Red Hat Enterprise Linux GNU Compiler Collection (GCC). These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-13 'gcc -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-13 'gcc objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of GCC.
4.6.4. Specifics of binutils in the GCC Toolset 13 Copy linkLink copied to clipboard!
Certain behaviors and requirements of binutils in the GCC Toolset 13 differ from the base Red Hat Enterprise Linux binutils. These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-13 'ld -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice, and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-13 'ld objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of binutils.
4.6.5. Specifics of annobin in the GCC Toolset 13 Copy linkLink copied to clipboard!
Under some circumstances, due to a synchronization issue between annobin and gcc in the GCC Toolset 13, your compilation can fail with an error message that looks similar to the following:
cc1: fatal error: inaccessible plugin file
opt/rh/gcc-toolset-13/root/usr/lib/gcc/architecture-linux-gnu/13/plugin/gcc-annobin.so
expanded from short plugin name gcc-annobin: No such file or directory
To work around the problem, create a symbolic link in the plugin directory from the annobin.so file to the gcc-annobin.so file:
Change to the plugin directory:
# cd /opt/rh/gcc-toolset-13/root/usr/lib/gcc/architecture-linux-gnu/13/pluginCreate the symbolic link:
# ln -s annobin.so gcc-annobin.so
Replace architecture with the architecture you use in your system:
-
aarch64 -
i686 -
ppc64le -
s390x -
x86_64
4.7. GCC Toolset 14 Copy linkLink copied to clipboard!
Learn about information specific to the GCC Toolset version 14 and the tools contained in this version.
4.7.1. Tools and versions provided by the GCC Toolset 14 Copy linkLink copied to clipboard!
GCC Toolset 14 provides the following tools and versions.
| Name | Version | Description |
|---|---|---|
| GCC | 14.2.1 | A portable compiler suite with support for C, C++, and Fortran. |
| GDB | 14.2 | A command-line debugger for programs written in C, C++, and Fortran. |
| binutils | 2.41 | A collection of binary tools and other utilities to inspect and manipulate object files and binaries. |
| dwz | 0.14 | A tool to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size. |
| annobin | 12.70 | A build security checking tool. |
4.7.2. C++ compatibility in the GCC Toolset 14 Copy linkLink copied to clipboard!
The GNU Compiler Collection (GCC) in the GCC Toolset can use the following C++ standards:
The compatibility information presented here apply only to the GCC from the GCC Toolset 14.
- C++14
This language standard is available in the GCC Toolset 14.
Using the C++14 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 6 or later.
- C++11
This language standard is available in the GCC Toolset 14.
Using the C++11 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 5 or later.
- C++98
- This language standard is available in the GCC Toolset 14. Binaries, shared libraries and objects built using this standard can be freely mixed regardless of being built with GCC from the GCC Toolset, Red Hat Developer Toolset, and RHEL 5, 6, 7 and 8.
- C++17
This language standard is available in the GCC Toolset 14.
This is the default language standard setting for the GCC Toolset 14, with GNU extensions, equivalent to explicitly using option
-std=gnu++17.Using the C++17 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 10 or later.
- C++20 and C++23
These language standards are available in the GCC Toolset 14 only as an experimental, unstable, and unsupported capability. Additionally, compatibility of objects, binary files, and libraries built using this standard cannot be guaranteed.
To enable the C++20 standard, add the command-line option
-std=c++20to your g++ command line.To enable the C++23 standard, add the command-line option
-std=c++23to your g++ command line.
All of the language standards are available in both the standard compliant variant or with GNU extensions.
When mixing objects built by using the GCC Toolset with those built with the RHEL toolchain (particularly .o or .a files), the GCC Toolset toolchain should be used for any linkage. This ensures any newer library features provided only by the GCC Toolset are resolved at link time.
4.7.3. Specifics of GCC in the GCC Toolset 14 Copy linkLink copied to clipboard!
Certain behaviors and requirements of the GCC Toolset 14 differ from the base Red Hat Enterprise Linux GNU Compiler Collection (GCC). These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-14 'gcc -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-14 'gcc objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of GCC.
4.7.4. Specifics of binutils in the GCC Toolset 14 Copy linkLink copied to clipboard!
Certain behaviors and requirements of binutils in the GCC Toolset 14 differ from the base Red Hat Enterprise Linux binutils. These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
Static linking of libraries
Certain more recent library features are statically linked into applications built with the GCC Toolset to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
Specify libraries after object files when linking
In the GCC Toolset, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-14 'ld -lsomelib objfile.o'
Using a library from the GCC Toolset in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice, and specify the option adding the library after the options specifying the object files:
$ scl enable gcc-toolset-14 'ld objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of binutils.
4.7.5. Specifics of annobin in the GCC Toolset 14 Copy linkLink copied to clipboard!
Builds that use the GCC Toolset 14 and annobin can fail due to a synchronization issue between the annobin plugin and gcc. This causes the compiler to fail locating the gcc-annobin.so plugin file.
cc1: fatal error: inaccessible plugin file
opt/rh/gcc-toolset-14/root/usr/lib/gcc/architecture-linux-gnu/14/plugin/gcc-annobin.so
expanded from short plugin name gcc-annobin: No such file or directory
To work around the problem, create a symbolic link in the plugin directory from the annobin.so file to the gcc-annobin.so file:
Change to the plugin directory:
# cd /opt/rh/gcc-toolset-14/root/usr/lib/gcc/architecture-linux-gnu/14/pluginCreate the symbolic link:
# ln -s annobin.so gcc-annobin.so
Replace architecture with the architecture you use in your system:
-
aarch64 -
i686 -
ppc64le -
s390x -
x86_64
4.8. GCC Toolset 15 Copy linkLink copied to clipboard!
GCC Toolset 15 in Red Hat Enterprise Linux offers updated compilers and debuggers for C, C++, and Fortran. It enables building, testing, and optimizing applications with current features while maintaining system stability and support.
4.8.1. GCC Toolset 15 tools and versions Copy linkLink copied to clipboard!
The GCC Toolset 15 offers updated versions of development tools for building and debugging applications on Red Hat Enterprise Linux 8.
| Name | Version | Description |
| GCC | 15.1.1 | A portable compiler suite with support for C, C++, and Fortran. |
| GDB | 16.3 | A command-line debugger for programs written in C, C++, and Fortran. |
| binutils | 2.44 | A collection of binary tools and other utilities to inspect and manipulate object files and binaries. |
| annobin | 12.93 | A build security checking tool. |
| dwz | 0.16 | A tool to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size. |
4.8.2. C++ compatibility in the GCC Toolset 15 Copy linkLink copied to clipboard!
The GNU Compiler Collection (GCC) Toolset 15 supports multiple C++ language standards. The default is C++17, with options for C++98, C++11, C++14, and experimental versions such as C++20, C++23, and C++26.
This compatibility information applies only to GCC from the GCC Toolset 15.
The GCC compiler in the GCC Toolset 15 can use the following C++ standards:
- C++98
- This language standard is available in the GCC Toolset 15. Binaries, shared libraries, and objects built using this standard can be freely mixed regardless of being built with GCC from the GCC Toolset 15, Red Hat Developer Toolset, and RHEL 5, 6, 7, and 8.
- C++11
- This language standard is available in the GCC Toolset 15.
- C++14
- This language standard is available in the GCC Toolset 15.
Using the C++14 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 6 or later.
- C++17
- This language standard is available in the GCC Toolset 15.
This is the default language standard setting for the GCC Toolset 15, with GNU extensions, equivalent to explicitly using option -std=gnu++17.
Using the C++17 language version is supported when all C++ objects compiled with the appropriate flag have been built using GCC version 10 or later.
- C++20 and C++23, and C++26
- These language standards are available in the GCC Toolset 15 only as an experimental, unstable, and unsupported capabilities. Additionally, the compatibility of objects, binary files, and libraries built using these standards cannot be guaranteed.
To enable the C++20 standard, add the command-line option -std=c++20 to your g++ command line.
To enable the C++23 standard, add the command-line option -std=c++23 to your g++ command line.
To enable the C++26 standard, add the command-line option -std=c++26 to your g++ command line. All of the language standards are available in both the standard compliant variant or with GNU extensions.
Use the GCC Toolset 15 for linking when you combine objects built by using the GCC Toolset 15 with objects built by using the system toolchain, particularly .o or .a files. This ensures any newer library features provided only by the GCC Toolset 15 are resolved at link time.
4.8.3. Specifics of GCC in the GCC Toolset 15 Copy linkLink copied to clipboard!
Certain behaviors and requirements of the GCC Toolset 15 differ from the base Red Hat Enterprise Linux GNU Compiler Collection (GCC). These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
- Static linking of libraries
- Certain more recent library features are statically linked into applications built with the GCC Toolset 15 to support execution on multiple versions of Red Hat Enterprise Linux. This creates an additional minor security risk because standard Red Hat Enterprise Linux errata do not change this code. If the need arises for developers to rebuild their applications due to this risk, Red Hat will communicate this using a security erratum.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
- Specify libraries after object files when linking
- In the GCC Toolset 15, libraries are linked using linker scripts, which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-15 'gcc -lsomelib objfile.o'
Using a library from the GCC Toolset 15 in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice and specify the option by adding the library after the options specifying the object files:
+
$ scl enable gcc-toolset-15 'gcc objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of GCC.
4.8.4. Specifics of binutils in the GCC Toolset 15 Copy linkLink copied to clipboard!
Certain behaviors and requirements of binutils in the GCC Toolset 15 differ from the base Red Hat Enterprise Linux binutils. These include automatic static linking of certain library features and the requirement to specify libraries after object files during linking.
- Static linking of libraries
- GCC Toolset 15 statically links newer library features into applications to ensure compatibility across multiple Red Hat Enterprise Linux versions. Statically linked code can introduce minor security risks, because security updates require applications to be rebuilt. If a security vulnerability is discovered, Red Hat will notify developers to rebuild affected applications through a security advisory.
Because of this additional security risk, developers are strongly advised not to statically link their entire application for the same reasons.
- Specify libraries after object files when linking
- In the GCC Toolset 15, libraries are linked using linker scripts which might specify some symbols through static archives. This is required to ensure compatibility with multiple versions of Red Hat Enterprise Linux. However, the linker scripts use the names of the corresponding shared object files. As a consequence, the linker uses different symbol handling rules than expected, and does not recognize symbols required by object files when the option adding the library is specified before options specifying the object files:
$ scl enable gcc-toolset-15 'ld -lsomelib objfile.o'
Using a library from the GCC Toolset 15 in this manner results in the linker error message undefined reference to symbol. To prevent this problem, follow the standard linking practice, and specify the option adding the library after the options specifying the object files:
+
$ scl enable gcc-toolset-15 'ld objfile.o -lsomelib'
Note that this recommendation also applies when using the base Red Hat Enterprise Linux version of binutils.
4.8.5. Specifics of annobin in the GCC Toolset 15 Copy linkLink copied to clipboard!
Builds that use the GCC Toolset 15 and annobin can fail due to a synchronization issue between the annobin plugin and gcc. This causes the compiler to fail locating the gcc-annobin.so plugin file.
cc1: fatal error: inaccessible plugin file
opt/rh/gcc-toolset-15/root/usr/lib/gcc/_architecture_-linux-gnu/15/plugin/gcc-annobin.so
expanded from short plugin name gcc-annobin: No such file or directory
To work around the issue, create a symbolic link in the plugin directory from annobin.so to gcc-annobin.so:
Change to the plugin directory:
$ cd /opt/rh/gcc-toolset-15/root/usr/lib/gcc/architecture-linux-gnu/15/pluginCreate the symbolic link:
$ ln -s annobin.so gcc-annobin.so
Replace architecture with the architecture used on your system:
-
aarch64 -
i686 -
ppc64le -
s390x -
x86_64
4.9. Using the gcc-toolset container image Copy linkLink copied to clipboard!
Only the two latest GCC Toolset container images are supported. Container images of earlier GCC Toolset versions are unsupported.
The GCC Toolset 13 and the GCC Toolset 14 components are available in the GCC Toolset 13 Toolchain and GCC Toolset 14 Toolchain container images, respectively.
The GCC Toolset container image is based on the rhel8 base image and is available for all architectures supported by RHEL 8:
- AMD and Intel 64-bit architectures
- The 64-bit ARM architecture
- IBM Power Systems, Little Endian
- 64-bit IBM Z
4.9.1. GCC Toolset container image contents Copy linkLink copied to clipboard!
Tools versions provided in the GCC Toolset 14 container image match the GCC Toolset 14 components versions.
- GCC Toolset 14 toolchain contents
-
The
rhel8/gcc-toolset-14-toolchaincontainer image consists of the following components:
| Component | Package |
|---|---|
|
| gcc-toolset-14-gcc |
|
| gcc-toolset-14-gcc-c++ |
|
| gcc-toolset-14-gcc-gfortran |
|
| gcc-toolset-14-gdb |
4.9.2. Accessing and running the GCC Toolset container image Copy linkLink copied to clipboard!
To access and run the GCC Toolset container image, use a standard container engine like Podman. Authenticate with the registry, pull the image, and launch a container to access an isolated, pre-configured toolchain for development.
Prerequisites
- Podman is installed.
Procedure
Access the Red Hat Container Registry by using your Customer Portal credentials:
$ podman login registry.redhat.ioUsername: username Password: **Pull the container image you require by running a relevant command as root:
# podman pull registry.redhat.io/rhel8/gcc-toolset-<toolset_version>-toolchainReplace toolset_version with the GCC Toolset version, for example 14.
NoteOn RHEL 8.1 and later versions, you can set up your system to work with containers as a non-root user. For details, see Setting up rootless containers.
Optional: Check that pulling was successful by running a command that lists all container images on your local system:
# podman imagesRun a container by launching a bash shell inside a container:
# podman run -it image_name /bin/bashThe
-ioption creates an interactive session; without this option the shell opens and instantly exits.The
-toption opens a terminal session; without this option you cannot type anything to the shell.
4.9.3. Example: Using the GCC Toolset 14 Toolchain container image Copy linkLink copied to clipboard!
To pull and start using the GCC Toolset 14 Toolchain container image, access the registry, pull the image, and launch it.
Prerequisites
- Podman is installed.
Procedure
Access the Red Hat Container Registry by using your Customer Portal credentials:
$ podman login registry.redhat.ioUsername: username Password: **Pull the container image as root:
# podman pull registry.redhat.io/rhel{ProductNumber}/gcc-toolset-14-toolchainLaunch the container image with an interactive shell as root:
# podman run -it registry.redhat.io/rhel{ProductNumber}/gcc-toolset-14-toolchain /bin/bashRun the GCC Toolset tools as expected. For example, to verify the
gcccompiler version, run:bash-4.4$ gcc -v... gcc version 14.2.1 20240801 (Red Hat 14.2.1-1) (GCC)To list all packages provided in the container, run:
bash-4.4$ rpm -qa
4.10. Using the gcc-toolset-15 container image Copy linkLink copied to clipboard!
The gcc-toolset-15 container image provides a complete toolchain for building, testing, and troubleshooting C and C++ applications in a containerized environment.
4.10.1. Introduction to the gcc-toolset-15 container image Copy linkLink copied to clipboard!
The gcc-toolset-15 container image provides a GCC Toolset 15 toolchain for building, testing, and troubleshooting C and C++ applications on Red Hat Enterprise Linux (RHEL). By using this image, you can maintain a reproducible environment without installing packages directly on the host.
The image is part of the RHEL container collection. All included RPM packages originate from official RHEL repositories, ensuring the image follows standard RHEL lifecycle and support policies. This provides a portable, containerized alternative to traditional RPM-based delivery.
Deployment scenarios include:
- Interactive development on a RHEL host by running an interactive container that mounts source code from the host.
- Noninteractive builds in CI pipelines or scheduled jobs, with build scripts running inside the container and writing artifacts to host-mounted directories.
- Evaluation and troubleshooting of GCC Toolset 15 behavior in an isolated environment without installing the toolchain on the host.
4.10.2. Supported platforms and architectures for the gcc-toolset-15 container image Copy linkLink copied to clipboard!
The gcc-toolset-15 image targets the same architectures provided by Red Hat Enterprise Linux (RHEL), including AMD64 and Intel 64 (x86_64), 64-bit ARM (aarch64), IBM Power, little endian (ppc64le), and 64-bit IBM Z (s390x).
For image-specific metadata, supported architectures, and tags, see the Red Hat container catalog entry for the gcc-toolset-15 container image.
If you plan to deploy the image across multiple architectures, ensure that you choose a tag that includes multi-architecture support or use architecture-specific tags according to your organization’s standards.
The gcc-toolset-15 image is available from Red Hat container registries. The exact path can differ depending on whether you use public registries, internal mirrors, or both. Placeholders for image locations are used below:
-
<REGISTRY>for the registry hostname. -
<NAMESPACE>for the registry namespace that contains thegcc-toolset-15image. -
<TAG>for the image tag that corresponds to the GCC Toolset 15 level that you require.
Use your product documentation, internal image catalog, or registry UI to determine the correct values for <REGISTRY>, <NAMESPACE>, and <TAG>. Record these values for use in the procedures that follow.
4.10.3. Preparing a RHEL host for the gcc-toolset-15 container image Copy linkLink copied to clipboard!
To configure hosts to use the gcc-toolset-15 image, verify system requirements and install necessary container tools. For comprehensive guidelines, see Building, running, and managing containers.
Prerequisites
- Administrator access to the RHEL host.
- The host is registered and has access to required Red Hat Enterprise Linux repositories.
- The host runs a supported Red Hat Enterprise Linux variant and architecture.
- Ensure that the host has adequated resources for CPU, memory, and storage for build workloads.
- The host has network access to the container registry or to an internal mirror.
Procedure
Install the container management tools:
$ sudo dnf install -y container-toolsVerify that
podmanis available:$ podman --versionIf the command completes successfully, it prints the version. For example:
podman version 5.4.1Verify subscription and repository access:
$ sudo dnf repolistIf required, configure subscription settings according to your environment so that the host can consume RHEL content and container registries.
4.10.4. Authenticating to the container registry Copy linkLink copied to clipboard!
To pull the gcc-toolset-15 image, you must log in to the container registry.
Prerequisites
-
container-toolsare installed on the RHEL host. - You have the registry hostname and valid credentials.
Procedure
Log in to the registry by using
podman:$ podman login <REGISTRY>Replace
<REGISTRY>with your registry hostname.- When prompted, enter your user name and password, or use the authentication mechanism that your organization provides.
Verification
Verify that the login and registry access were successful by searching for the
gcc-toolset-15image:$ podman search <REGISTRY>/<NAMESPACE>/gcc-toolset-15**
4.10.5. Pulling the gcc-toolset-15 container image Copy linkLink copied to clipboard!
To use the gcc-toolset-15 image, pull it to your local system after authenticating to the registry.
Prerequisites
- You have authenticated to the container registry.
-
You know the
<REGISTRY>,<NAMESPACE>, and<TAG>values for the image. You can determine these details from the Red Hat Container Catalog or your internal image catalog.
Procedure
Pull the image:
$ podman pull <REGISTRY>/<NAMESPACE>/gcc-toolset-15:<TAG>Replace
<REGISTRY>,<NAMESPACE>, and<TAG>with the values you determined earlier.
Verification
Verify that the image is available locally:
$ podman images <REGISTRY>/<NAMESPACE>/gcc-toolset-15The output should display a table row containing the repository, tag, image ID, and size. For example:
REPOSITORY TAG IMAGE ID CREATED SIZE registry.redhat.io/.../gcc-toolset-15 latest a1b2c3d4e5f6 2 days ago 540MB
4.10.6. Using the gcc-toolset-15 to run interactive development containers Copy linkLink copied to clipboard!
To use the gcc-toolset-15 image for interactive development, run an interactive container that mounts source code from the host.
Prerequisites
-
The
gcc-toolset-15image is available locally. -
You have a host directory containing the application source code, for example,
/home/devuser/src. - You have read and write permissions for the host directory.
Procedure
Start an interactive container that mounts the source directory and uses it as the working directory:
$ podman run --rm -it -v /home/devuser/src:/src -w /src <REGISTRY>/<NAMESPACE>/gcc-toolset-15:<TAG> /bin/bashReplace
<REGISTRY>,<NAMESPACE>, and<TAG>with your specific values.Inside the container, verify that the source code is available:
# ls /srcBuild an application using GCC Toolset 15:
# gcc -o myapp main.cBuild artifacts created in
/srcare stored on the host in/home/devuser/src.When the interactive session completes, exit the shell:
# exitBecause the container was started with the
--rmflag, it is removed automatically.
4.10.7. Running noninteractive builds with gcc-toolset-15 Copy linkLink copied to clipboard!
To perform noninteractive builds, run the gcc-toolset-15 image with a predefined build script that exits upon completion.
In CI systems, you can integrate this pattern by running podman run as part of a pipeline step. Use pipeline variables or configuration files to provide the values for <REGISTRY>, <NAMESPACE>, <TAG>, and host paths.
Ensure build scripts write logs and artifacts to host-mounted directories. This practice enables CI systems and administrators to inspect outputs after the container exits and to archive them as needed.
Prerequisites
-
The
gcc-toolset-15image is available locally. -
A host directory for source and build scripts, for example,
/srv/src. -
A host directory for build output, for example,
/srv/build-output. -
A build script, for example,
build.sh, that runs GCC Toolset 15 commands.
Procedure
- Prepare your build workflow. Ensure both the source and output directories on the host have appropriate permissions.
Run the container in noninteractive mode:
$ podman run --rm -v /srv/src:/src -v /srv/build-output:/build-output -w /src <REGISTRY> / <NAMESPACE> /gcc-toolset-15: <TAG> /src/build.shIn this example:
-
/src/build.shis a script inside the container that performs the build. -
Build artifacts and logs are written to
/build-output, which maps to/srv/build-outputon the host.
-
4.10.8. Maintaining the gcc-toolset-15 container image Copy linkLink copied to clipboard!
To maintain the gcc-toolset-15 image, monitor for updates including security fixes, bug fixes, and dependency changes. Track updates and errata by monitoring RHEL release notes, or internal advisories for new images that contain updated GCC Toolset 15 content.
- If you use an internal registry, mirror the updated image into the internal registry or rely on existing synchronization mechanisms.
-
Use internal paths for
<REGISTRY>and<NAMESPACE>in all procedures. - Coordinate with the team that manages the internal registry to ensure that mirrors are updated inline with your rollout schedule.
Procedure
Update to a new image tag: Consult the Red Hat Ecosystem Catalog or your internal registry to find the new image tag.
-
Determine the
<NEW_TAG>that corresponds to the updatedgcc-toolset-15image. Pull the new tag to your environment:
$ podman pull <REGISTRY>/<NAMESPACE>/gcc-toolset-15:<NEW_TAG>-
Update scripts, CI jobs, and documentation to reference
<NEW_TAG>as appropriate.
-
Determine the
Remove outdated image tags after you complete validation and roll out the new tag, according to your retention policy:
$ podman rmi <REGISTRY>/<NAMESPACE>/gcc-toolset-15:<OLD_TAG>
4.10.9. Troubleshooting the gcc-toolset-15 container image Copy linkLink copied to clipboard!
Identify and resolve common issues when pulling or running the gcc-toolset-15 container image.
- Common issues when pulling images
If
podman pullfails:-
Check registry login by running
podman login <REGISTRY>. - Verify network connectivity to the registry.
-
Confirm that
<REGISTRY>,<NAMESPACE>, and<TAG>values are correct. -
If access is denied, verify that your subscription and registry permissions allow access to the
gcc-toolset-15image.
-
Check registry login by running
- Common issues when running containers
If
podman runfails:-
Verify that the image is available locally by running
podman images <REGISTRY>/<NAMESPACE>/gcc-toolset-15.
-
Verify that the image is available locally by running
The output should display a table row containing the repository, tag, image ID, and size. For example:
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.redhat.io/.../gcc-toolset-15 latest a1b2c3d4e5f6 2 days ago 540MB
- Check volume mount paths to ensure that host directories exist and that you have appropriate permissions.
Review container exit codes and logs to identify script or compiler errors.
- Collecting data for support
- When opening a support case, collect the following data:
-
The exact
podmancommands that you ran. - Full command output and error messages.
-
The values of
<REGISTRY>,<NAMESPACE>, and<TAG>that you used. - Information about the host, including Red Hat Enterprise Linux version and architecture.
4.10.10. Operational and security considerations for the gcc-toolset-15 container image Copy linkLink copied to clipboard!
Review the following operational and security guidelines when using the gcc-toolset-15 container image in your environment.
- Network and registry access control
- Ensure that hosts can access the required registries or internal mirrors and that firewall settings allow necessary connections. Use internal registries where possible to centralize control of images. Consult your internal documentation for details on your organization’s registry layout and CI integration patterns.
- Resource management for build workloads
-
Build containers can be resource-intensive. Use cgroup controls,
systemdintegration, or container runtime options to manage CPU, memory, and I/O usage on shared hosts. - Logging and auditing containerized builds
- Configure build scripts to write logs to host-mounted directories. Integrate these logs with your logging and auditing infrastructure to track build activity and diagnose issues.
- Security and compliance guidelines
Because the
gcc-toolset-15image is built from Red Hat Enterprise Linux (RHEL) repositories, it follows RHEL security practices. However, you should still follow these practicies:- Limit who can run containers on shared hosts.
- Periodically review and update image tags to consume security fixes.
- Use internal registries and scanning tools according to your organization’s policies.
4.11. Compiler toolsets Copy linkLink copied to clipboard!
RHEL 8 provides the following compiler toolsets as Application Streams. You can use these toolsets to build applications with different versions of languages and tools.
- LLVM Toolset provides the LLVM compiler infrastructure framework, the Clang compiler for the C and C++ languages, the LLDB debugger, and related tools for code analysis.
-
Rust Toolset provides the Rust programming language compiler
rustc, thecargobuild tool and dependency manager, thecargo-vendorplugin, and required libraries. -
Go Toolset provides the Go programming language tools and libraries. Go is alternatively known as
golang.
For more details and information about usage, see the compiler toolsets user guides on the Red Hat Developer Tools page.
4.12. The Annobin project Copy linkLink copied to clipboard!
The Annobin project is an implementation of the Watermark specification project. Watermark specification project intends to add markers to Executable and Linkable Format (ELF) objects to determine their properties. The Annobin project consists of the annobin plugin and the annockeck program.
The annobin plugin scans the GNU Compiler Collection (GCC) command line, the compilation state. The compilation process, and generates the ELF notes. The ELF notes record how the binary was built and provide information for the annocheck program to perform security hardening checks.
The security hardening checker is part of the annocheck program and is enabled by default. It checks the binary files to determine whether the program was built with necessary security hardening options and compiled correctly. annocheck is able to recursively scan directories, archives, and RPM packages for ELF object files.
The files must be in ELF format. annocheck does not handle any other binary file types.
The following section describes how to:
-
Use the
annobinplugin -
Use the
annocheckprogram
4.12.1. Using the annobin plugin Copy linkLink copied to clipboard!
The following section describes how to:
-
Enable the
annobinplugin -
Pass options to the
annobinplugin
4.12.1.1. Enabling the annobin plugin Copy linkLink copied to clipboard!
To add build security notes to binaries, enable the annobin plug-in by using command-line options with gcc or clang utilities.
Procedure
To enable the
annobinplugin withgcc, use:$ gcc -fplugin=annobinIf
gccdoes not find theannobinplugin, use:$ gcc -iplugindir=/path/to/directory/containing/annobin/Replace /path/to/directory/containing/annobin/ with the absolute path to the directory that contains
annobin.To find the directory containing the
annobinplugin, use:$ gcc --print-file-name=plugin
To enable the
annobinplugin withclang, use:$ clang -fplugin=/path/to/directory/containing/annobin/Replace /path/to/directory/containing/annobin/ with the absolute path to the directory that contains
annobin.Optional: To remove the redundant
annobinnotes, use theobjcopyutility:$ objcopy --merge-notes file-name
4.12.1.2. Passing options to the annobin plugin Copy linkLink copied to clipboard!
To pass options to the annobin plugin, use the appropriate command-line arguments with gcc or clang.
Procedure
To pass options to the
annobinplugin withgcc, use:$ gcc -fplugin=annobin -fplugin-arg-annobin-option file-nameReplace option with the
annobincommand line arguments and replace file-name with the name of the file.- Example: verbose option with GCC
To display additional details about what
annobinit is doing, use:$ gcc -fplugin=annobin -fplugin-arg-annobin-verbose file-nameReplace file-name with the name of the file.
To pass options to the
annobinplugin withclang, use:$ clang -fplugin=/path/to/directory/containing/annobin/ -Xclang -plugin-arg-annobin -Xclang option file-nameReplace option with the
annobincommand line arguments and replace /path/to/directory/containing/annobin/ with the absolute path to the directory containingannobin.- Example: verbose option with Clang
To display additional details about what
annobinit is doing, use:$ clang -fplugin=/usr/lib64/clang/10/lib/annobin.so -Xclang -plugin-arg-annobin -Xclang verbose file-nameReplace file-name with the name of the file.
4.12.2. Using the annocheck program Copy linkLink copied to clipboard!
The following section describes how to use annocheck to examine:
- Files
- Directories
- RPM packages
-
annocheckextra tools
annocheck recursively scans directories, archives, and RPM packages for ELF object files. The files have to be in the ELF format. annocheck does not handle any other binary file types.
4.12.2.1. Using annocheck to examine files Copy linkLink copied to clipboard!
To verify hardening options and build security notes of ELF files, examine the files by using the annocheck tool.
Procedure
To examine a file, use:
$ annocheck file-nameReplace file-name with the name of a file.
The files must be in ELF format. annocheck does not handle any other binary file types. annocheck processes static libraries that contain ELF object files.
Additional resources
-
For more information about
annocheckand possible command line options, see theannocheckman page on your system.
4.12.2.2. Using annocheck to examine directories Copy linkLink copied to clipboard!
To examine ELF files in a directory, use the annocheck tool, which recursively scans directories, subdirectories, and archives.
Procedure
To scan a directory, use:
$ annocheck directory-nameReplace directory-name with the name of a directory.
annocheckautomatically examines the contents of the directory, its sub-directories, and any archives and RPM packages within the directory.
annocheck only looks for ELF files. Other file types are ignored.
Additional resources
-
For more information about
annocheckand possible command line options, see theannocheckman page on your system.
4.12.2.3. Using annocheck to examine RPM packages Copy linkLink copied to clipboard!
To examine ELF files in an RPM package, use the annocheck tool, which recursively scans all ELF files inside the package.
Procedure
To scan an RPM package, use:
$ annocheck rpm-package-nameReplace rpm-package-name with the name of an RPM package.
annocheckrecursively scans all the ELF files inside the RPM package.
annocheck only looks for ELF files. Other file types are ignored.
To scan an RPM package with provided debug info RPM, use:
$ annocheck rpm-package-name --debug-rpm debuginfo-rpmReplace rpm-package-name with the name of an RPM package, and debuginfo-rpm with the name of a debug info RPM associated with the binary RPM.
Additional resources
-
For more information about
annocheckand possible command line options, see theannocheckman page on your system.
4.12.2.4. Using annocheck extra tools Copy linkLink copied to clipboard!
annocheck includes multiple tools for examining binary files. You can enable these tools with the command-line options.
The following section describes how to enable the:
-
built-bytool -
notestool -
section-sizetool
You can enable multiple tools at the same time.
The hardening checker is enabled by default.
4.12.2.4.1. Enabling the built-by tool Copy linkLink copied to clipboard!
To find the name of the compiler that built a specific binary file, you can use the annocheck built-by tool.
Procedure
To enable the
built-bytool, use:$ annocheck --enable-built-by
Additional resources
-
For more information about the
built-bytool, see the--helpcommand-line option.
4.12.2.4.2. Enabling the notes tool Copy linkLink copied to clipboard!
To display the notes stored inside a binary file created by the annobin plug-in, you can use the annocheck notes tool.
Procedure
To enable the
notestool, use:$ annocheck --enable-notesThe notes are displayed in a sequence sorted by the address range.
Additional resources
-
For more information about the
notestool, see the--helpcommand-line option.
4.12.2.4.3. Enabling the section-size tool Copy linkLink copied to clipboard!
To display the size of named sections, you can use the annocheck section-size tool.
Procedure
To enable the
section-sizetool, use:$ annocheck --section-size=nameReplace name with the name of the named section. The output is restricted to specific sections. A cumulative result is produced at the end.
Additional resources
-
For more information about the
section-sizetool, see the--helpcommand-line option.
4.12.2.4.4. Hardening checker basics Copy linkLink copied to clipboard!
The hardening checker is enabled by default. You can disable the hardening checker with the --disable-hardened command-line option.
4.12.2.4.4.1. Hardening checker options Copy linkLink copied to clipboard!
The annocheck tool verifies binaries for various hardening options, such as stack protection, PIC/PIE usage, and secure linker settings. The following options are checked:
-
Lazy binding is disabled using the
-z nowlinker option. - The program does not have a stack in an executable region of memory.
- The relocations for the GOT table are set to read only.
- No program segment has all three of the read, write and execute permission bits set.
- There are no relocations against executable code.
- The runpath information for locating shared libraries at runtime includes only directories rooted at /usr.
-
The program was compiled with
annobinnotes enabled. -
The program was compiled with the
-fstack-protector-strongoption enabled. -
The program was compiled with
-D_FORTIFY_SOURCE=2. -
The program was compiled with
-D_GLIBCXX_ASSERTIONS. -
The program was compiled with
-fexceptionsenabled. -
The program was compiled with
-fstack-clash-protectionenabled. -
The program was compiled at
-O2or higher. - The program does not have any relocations held in a writeable.
- Dynamic executables have a dynamic segment.
-
Shared libraries were compiled with
-fPICor-fPIE. -
Dynamic executables were compiled with
-fPIEand linked with-pie. -
If available, the
-fcf-protection=fulloption was used. -
If available, the
-mbranch-protectionoption was used. -
If available, the
-mstackrealignoption was used.
4.12.2.4.4.2. Disabling the hardening checker Copy linkLink copied to clipboard!
To skip security checks during binary analysis, disable the hardening checker by using the annocheck utility.
Procedure
To scan the notes in a file without the hardening checker, use:
$ annocheck --enable-notes --disable-hardened file-nameReplace file-name with the name of a file.
4.12.3. Specifics of annobin in the GCC Toolset 12 Copy linkLink copied to clipboard!
Under some circumstances, due to a synchronization issue between annobin and gcc in the GCC Toolset 12, your compilation can fail with an error message that looks similar to the following:
cc1: fatal error: inaccessible plugin file
opt/rh/gcc-toolset-12/root/usr/lib/gcc/architecture-linux-gnu/12/plugin/gcc-annobin.so
expanded from short plugin name gcc-annobin: No such file or directory
To work around the problem, create a symbolic link in the plugin directory from the annobin.so file to the gcc-annobin.so file:
Change to the plugin directory:
# cd /opt/rh/gcc-toolset-12/root/usr/lib/gcc/architecture-linux-gnu/12/pluginCreate the symbolic link:
# ln -s annobin.so gcc-annobin.so
Replace architecture with the architecture you use in your system:
-
aarch64 -
i686 -
ppc64le -
s390x -
x86_64