Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

GCC 5 in Fedora

February 10, 2015
Jeff Law Jonathan Wakely Matt Newsome Jakub Jelínek Jason Merrill

    gnu logoFedora 22 will ship with GCC 5, which brings a whole host of enhancements, among which is a new default C++ ABI. In this article, we'll cover how that ABI transition will work in Fedora.

    Background - what's an ABI, why is it changing, and what does this mean for developers?

    Put simply, binary compatibility means applications that are compiled on a combination of an operating system and a particular hardware architecture will load and run similarly across different instances of the operating environment. Application binaries consist of executable files and Dynamic Shared Objects (DSOs - the formal name for shared libraries), and the level of compatibility is defined by a specific application binary interface (ABI).

    The development of new features in compilers, libraries and related tools - and notably any new language standard those tools support - can result in changes to the ABI, requiring that certain binaries need to be re-built, or that newly built binaries are not directly compatible with existing binaries.

    GCC 5 implements such an ABI change when the compiler is built with default options from the upstream community sources. It does this order to implement the new C++11 language standard. That provides new features to developers at the cost of binary compatibility - the C++11 requirements on certain C++ core classes requires an ABI change.

    GCC 5 also provides, out of the box, a compiler switch to switch back to using the older ABI by default, at the cost of some C++11 conformance. Whichever ABI GCC is configured to use by default, developers can use the other one on a per-file basis by defining a macro to override the default.

    FESCo's decision and rationale around GCC 5 and Fedora 22

    In mid-January, the maintainer of GCC in Fedora made a proposal for GCC 5 to be included in Fedora 22. That proposal was made to FESCo,the body that has overall authority to determine what major features get into each release of Fedora.

    The issue was debated during the recent FESCo meetings, which the maintainer attended, and ultimately the decision was made to ship GCC 5, but with
    the old ABI enabled by default.

    At the heart of this decision was the priority placed by FESCo on the Fedora 22 schedule.  A mass rebuild of all Fedora packages would not be possible if Fedora 22 is to ship on time. A "mini-mass-rebuild" was considered, where only C++ packages would be rebuilt (so Fedora could move to using C++11 and the new ABI).  The idea here would be to reduce the number of packages that must be rebuilt to save time.  That proposal was also rejected, however, as FESCo felt even the mini-mass-rebuild would impact the Fedora 22 schedule.

    That left FESCO with two options.  Either to remain with GCC 4.9 through the Fedora 22 cycle, then upgrade to GCC 5 in Fedora 23, or to use GCC 5, but with the old C++ ABI in Fedora 22, then step forward with the new ABI in Fedora 23.

    Staying with GCC 4.9 would have minimized the work required for Fedora 22 GCC packaging, Fedora 22. The Fedora and GCC development cycles are mutually beneficial, however, and so removing GCC 5 from Fedora has side effects in terms of GCC 5's development upstream.

    Staying with GCC 4.9 would also leave Fedora users without easy access to all the other benefits GCC 5 brings. The removal of GCC 5 could even be misconstrued as signalling that GCC 5 wasn't ready for production use.

    Finally, staying with GCC 4.9 would also impact developers using Red Hat's tools for RHEL, such as Red Hat Developer Toolset - GCC 5 wouldn't have the widespread Fedora testing Red Hat desires before addition to Red Hat's product portfolio.

    The option to use GCC 5, but with the old ABI, allows developers to benefit from all the upstream community's work on features and bugfixes. Those active users in turn benefit both the GCC and Fedora projects directly. Fedora will not enable the new C++11 ABI by default, but that will also allow developers to handle the general upgrade to GCC 5 separately to the new ABI, which is expected to be enabled in Fedora 23.

    So what do I need to know about Fedora 22 and Fedora 23 as a developer?

    One consequence of this decision will be that Fedora 22 and Fedora 23 will both have GCC 5, but they'll be fundamentally different. The C++ library (libstdc++.so) will be
    compatible between F22 and F23 (in fact, it will be almost exactly the same,
    modulo some extra patches from upstream that might be pulled into the later F23 build). The difference will be all the other DSOs that link to it. That's important for Fedora developers to note.

    Specifically, FESCo's decision means the C++ standard library headers installed by the
    libstdc++-devel RPM will have a different default value for the _GLIBCXX_USE_CXX11_ABI macro (0 in F22 and 1 in F23) but the libstdc++.so library will be largely the same in F22 and F23, because that library contains all the symbol definitions for both the old ABI and the new ABI, so that the same library works for both cases.

    However, when another DSO such as libboost_filesystem.so is compiled with GCC 5 it will be compiled using either the old ABI or the new one, but not both, and programs linking to that DSO will usually need to use the same ABI to avoid linker errors. The C++ libraries that are part of Fedora 22 will be built using the old ABI, but they will be built using the new ABI in Fedora 23. Developers might need to recompile their programs using the new ABI in order to link to C++ libraries in Fedora 23. Similarly, developers who use the _GLIBCXX_USE_CXX11_ABI macro to override the default might need to rebuild other libraries they depend on to ensure those libraries are also built with the non-default ABI.

    If you happen to maintain a package in Fedora that provides a library for consumption by other packages, you might even consider doing something similar to libstdc++ for Fedora 22/23, i.e. provide two sets of your public symbols - one for the old ABI and one for the new ABI. Whether that would be worth the effort to implement depends largely on the number of consumers of your library, the number of symbols your library contains, and how sensitive your users are to ABI changes. Essentially, you need to work out which symbols are affected. One way to do this is to build for C++98 [gcc -D_GLIBCXX_USE_CXX11_ABI=0 -Wabi-tags in your rpmbuild], then separately for C++11 [gcc -D_GLIBCXX_USE_CXX11_ABI=1 -Wabi-tags in your rpmbuild], and then compare the two DSOs with abidiff (part of libabigail) [abidiff old-abi/libfoo.so new-abi/libfoo.so]. Having identified the symbols affected, make sure those symbols are compiled in their own files separately from unaffected symbols, so you can compile them twice (without duplicates of the unaffected symbols). It's non-trivial, but something to consider.

    Overall, there are three key things to keep in mind about GCC 5 in Fedora 22. Firstly, the Fedora 22 GCC component will still be from a full upstream release. Secondly, selection of the ABI is done by way of a standard configure time flag - the option is there to rebuild with that switch reversed. Thirdly, ABI compatibility with F21 is actually maintained in Fedora 22 (though developers will have the option to enable the newer C++11 ABI via -D_GLIBCXX_USE_CXX11_ABI=1).

    What does this mean for RHEL developers?

    Developers building applications for Red Hat Enterprise Linux, using Red Hat tools to build binaries and shared libraries, are unaffected by these changes.

    Final Thoughts

    Hopefully this article has been useful in explaining what the plan is for GCC 5's release in Fedora, how FESCo arrived at their decision, and what it means for Fedora and Red Hat Enterprise Linux developers.

    Feel free to ask questions or provide feedback.

    Last updated: June 11, 2017

    Recent Posts

    • Protect data offloaded to GPU-accelerated environments with OpenShift sandboxed containers

    • Case study: Measuring energy efficiency on the x64 platform

    • How to prevent AI inference stack silent failures

    • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

    • How to manage TLS certificates used by OpenShift GitOps operator

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.