The GNU Compiler Collection, commonly abbreviated as GCC, is a portable compiler suite with support for a wide selection of programming languages.
Red Hat Enterprise Linux (RHEL) offers the flexibility of choosing from many different versions of GCC, depending on your needs. These different versions have different support life cycles and intended uses. This article breaks down how these work and explains the rationale behind Red Hat's approach.
System GCC (built-in version)
The system version of GCC (packaged as the gcc
RPM) is the compiler that ships with RHEL at General Availability (GA) of a major release (e.g. RHEL 8, RHEL 9) and is used to build the operating system itself. This compiler receives full support for the entire life cycle of the major version of RHEL:
- RHEL 8: GCC 8
- RHEL 9: GCC 11
- RHEL 10 Beta: GCC 14
Even though the upstream GCC project might no longer support these versions (such as GCC 8), Red Hat takes responsibility for maintaining them throughout RHEL’s life cycle. This includes backporting security fixes and bug fixes as needed.
For example, GCC 8 in RHEL 8 received a backported fix for CVE-2020-11023, demonstrating our commitment to maintaining these older GCC versions. It is worth noting that many of the top contributors to GCC are in fact Red Hat employees, equipped with the experience and skills to perform this important maintenance work.
Read more about Red Hat’s approach to security here: Red Hat Enterprise Linux security
gcc-toolset (Application Streams versions)
Red Hat also provides newer versions of GCC and associated development tools via the gcc-toolset
Application Streams, giving flexibility to application developers who might not want to remain bound to the system GCC version.
Key differences from the system GCC include:
- Shorter support life cycle:
gcc-toolset
versions are supported for only about 2 years from release, following the Application Streams life cycle. - More frequent updates: New
gcc-toolset
versions are released more often, typically starting 6 months after a major version of RHEL is released, providing access to newer GCC features. - Package dependencies:
gcc-toolset
installs a full suite of dependent packages (e.g.,gcc-toolset-9-*
), while the built-ingcc
does not force installation of these additional packages.
For example, gcc-toolset-12
is available in RHEL 9, but its support ended in November 2024 (after two years) as part of the Application Streams life cycle.
Choosing between system GCC and gcc-toolset
Red Hat's guidance is straightforward:
- For long-term stability and support: Use the built-in system GCC (8.x in RHEL 8) if you need a compiler that's supported for the entire RHEL life cycle.
- For newer features: Use
gcc-toolset
if you need access to the latest GCC features, but be aware of the shorter 2-year support window.
Note that you can install gcc
and multiple versions of gcc-toolset
(e.g., gcc-toolset-12
and gcc-toolset-14
) concurrently on the same system, as they install to different paths. For example:
gcc
binaries live in/usr/bin
gcc-toolset-12
binaries live in/opt/rh/gcc-toolset-12/root/usr/bin
gcc-toolset-14
binaries live in/opt/rh/gcc-toolset-14/root/usr/bin
The logic behind this approach
Red Hat's approach balances stability with access to newer features:
- Stability for the core OS: The system GCC provides long-term stability for the operating system itself and for applications that need consistent behavior over many years.
- Flexibility for developers:
gcc-toolset
provides access to newer compiler features for developers who need them, without disrupting the stability of the core system.
This approach aligns with Red Hat's Red Hat Enterprise Linux Application Compatibility Policies, which aim to provide both stability and innovation within the same platform.
Conclusion
GCC is an essential component of both the build of Red Hat Enterprise Linux and for developers building applications on Red Hat Enterprise Linux. The long life cycle RHEL provides introduces a need to ensure stability for vendor-provided and in-house developed workloads without preventing developers from accessing the features that newer GCC versions enable. This capability is part of the core promise of Red Hat Enterprise Linux and a key reason why enterprises worldwide choose RHEL.
Happy coding!
Explore ways to try RHEL on the Red Hat Enterprise Linux product page.