Disclaimer: I am fairly new to Ubuntu. I have a reasonable amount of experience with RHEL and SLES, and have had to learn Ubuntu LTS versions recently because of some ARM64 hardware that doesn't want to boot anything else.

Summary

Ubuntu releases do, indeed, often come with some components from a later GCC than the releases' default GCC. They apparently do this so that they can provide later compiler versions, if you want to use them.

  • The gcc-10-base package just provides documentation.
  • The libgcc-s1 package provides an important library, libgcc_s.so.1. That provides helper functions for code generated by the compiler: I know it as important for handling C++ exceptions being thrown through a C call stack.
  • Another important library is libstdc++.so.6. That provides C++ support functions.
  • Glibc (libc.so.6, libm.so.6 and other libraries) is also important, but is not tied to a GCC version.

All of these libraries have very strong compatibility rules. Essentially, a later version of the library will always be compatible with earlier versions, discounting some ancient versions from the early history of GCC and Linux.

It isn’t obvious at first why Ubuntu and Debian provide run-times that are later than the compiler, but it gets clearer when you look at the range of GCC versions available on recent Ubuntu LTS versions:

Distribution Released Debian GCC run-times Default GCC Additional GCCs
Ubuntu 16.04 Apr 2016 9.x 5.x 5.4 4.7, 4.8, 4.9
Ubuntu 18.04 Apr 2018 10.x 8.x 7.5 4.8, 5.5, 6.5. 8.4
Ubuntu 20.04 Apr 2020 11.x 9.x & 10.x 9.3 7.4, 8.4, 10.3
Ubuntu 22.04 Apr 2022 12.x 12.x 11.4 9.5, 10.5, 12.3

At that that point, it becomes reasonably obvious. Ubuntu 20.04 has the run-times for code compiled with GCC 9.x and 10.x (GCC 10.x doesn't demand any additional library functions that GCC 9.x didn't use). You can install any mixture of GCC 7.4, 8.4 and 10.3 as extra compilers, and they'll all work. The run-time libraries on Ubuntu 20.04 will support code compiled with any of those compilers.

Why not ship GCC 10.3 with Ubuntu 20.04? Run-time libraries are generally more stable than compilers. GCC 10 would have been first released (as 10.1) about the time that 20.04 was being put together. Building an LTS release with a brand-new compiler would be foolhardy; shipping new run-time libraries, after testing them with code built with GCC 9, is a lot safer and allows GCC 10 to be added when it has stabilised.

Canonical don't provide GCC 11 for 20.04 because it doesn't have the necessary run-times. For those, you need a later Ubuntu.

How to find all this stuff out

/usr/share/doc/gcc/README.Debian has some information.

dpkg-query --listfiles gcc-10-base shows us that gcc-10-base only provides documentation.

dpkg-query --listfiles libgcc-s1 shows us that libgcc-s1 provides /lib/x86_64-linux-gnu/libgcc_s.so.1, which is one of the basic run-time libraries for GCC.

The other basic run-time libraries for C/C++ are glibc, which is independent of GCC, and libstdc++. dpkg-query -list | grep libstdc shows us two packages:

ii libstdc++-9-dev:amd64 9.3.0-17ubuntu1~20.04 amd64 GNU Standard C++ Library v3 ...
ii libstdc++6:amd64 10.3.0-1ubuntu1~20.04 amd64 GNU Standard C++ Library v3

libstdc++6 is the GCC 10.3 version; the -dev package is the GCC 9.3 version.

dpkg-query --listfiles libstdc++-9-dev shows us that this package provides header files, archive libraries and documentation for developing in C++ with GCC 9.

dpkg-query --listfiles libstdc++6 shows us that this package provides documentation, some Python scripts and two really important files:

/usr/lib/x86_64-linux-gnu/libstdc++.so.6
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28

The .so.6 file is what programs are linked against. It is actually a softlink to the .so.6.028 file. That’s the name of the GCC 10 version of libstdc++, the GCC support library for C++. You can get the mapping between those names and GCC versions here. Scroll down, and you’ll find some tables.

GCC used for building Ubuntu

The easiest thing to check is glibc. Building this with a different compiler from the rest of the OS would be crazy, and you can find out what compiler was used to build it just by asking:

/usr/lib/x86_64-linux-gnu/libc.so.6
GNU C Library (Ubuntu GLIBC 2.31-0ubuntu9.7) stable release version 2.31.
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 9.3.0.
libc ABIs: UNIQUE IFUNC ABSOLUTE
For bug reporting instructions, please see:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs.

Answer from John Dallman on askubuntu.com
Top answer
1 of 1
3

Disclaimer: I am fairly new to Ubuntu. I have a reasonable amount of experience with RHEL and SLES, and have had to learn Ubuntu LTS versions recently because of some ARM64 hardware that doesn't want to boot anything else.

Summary

Ubuntu releases do, indeed, often come with some components from a later GCC than the releases' default GCC. They apparently do this so that they can provide later compiler versions, if you want to use them.

  • The gcc-10-base package just provides documentation.
  • The libgcc-s1 package provides an important library, libgcc_s.so.1. That provides helper functions for code generated by the compiler: I know it as important for handling C++ exceptions being thrown through a C call stack.
  • Another important library is libstdc++.so.6. That provides C++ support functions.
  • Glibc (libc.so.6, libm.so.6 and other libraries) is also important, but is not tied to a GCC version.

All of these libraries have very strong compatibility rules. Essentially, a later version of the library will always be compatible with earlier versions, discounting some ancient versions from the early history of GCC and Linux.

It isn’t obvious at first why Ubuntu and Debian provide run-times that are later than the compiler, but it gets clearer when you look at the range of GCC versions available on recent Ubuntu LTS versions:

Distribution Released Debian GCC run-times Default GCC Additional GCCs
Ubuntu 16.04 Apr 2016 9.x 5.x 5.4 4.7, 4.8, 4.9
Ubuntu 18.04 Apr 2018 10.x 8.x 7.5 4.8, 5.5, 6.5. 8.4
Ubuntu 20.04 Apr 2020 11.x 9.x & 10.x 9.3 7.4, 8.4, 10.3
Ubuntu 22.04 Apr 2022 12.x 12.x 11.4 9.5, 10.5, 12.3

At that that point, it becomes reasonably obvious. Ubuntu 20.04 has the run-times for code compiled with GCC 9.x and 10.x (GCC 10.x doesn't demand any additional library functions that GCC 9.x didn't use). You can install any mixture of GCC 7.4, 8.4 and 10.3 as extra compilers, and they'll all work. The run-time libraries on Ubuntu 20.04 will support code compiled with any of those compilers.

Why not ship GCC 10.3 with Ubuntu 20.04? Run-time libraries are generally more stable than compilers. GCC 10 would have been first released (as 10.1) about the time that 20.04 was being put together. Building an LTS release with a brand-new compiler would be foolhardy; shipping new run-time libraries, after testing them with code built with GCC 9, is a lot safer and allows GCC 10 to be added when it has stabilised.

Canonical don't provide GCC 11 for 20.04 because it doesn't have the necessary run-times. For those, you need a later Ubuntu.

How to find all this stuff out

/usr/share/doc/gcc/README.Debian has some information.

dpkg-query --listfiles gcc-10-base shows us that gcc-10-base only provides documentation.

dpkg-query --listfiles libgcc-s1 shows us that libgcc-s1 provides /lib/x86_64-linux-gnu/libgcc_s.so.1, which is one of the basic run-time libraries for GCC.

The other basic run-time libraries for C/C++ are glibc, which is independent of GCC, and libstdc++. dpkg-query -list | grep libstdc shows us two packages:

ii libstdc++-9-dev:amd64 9.3.0-17ubuntu1~20.04 amd64 GNU Standard C++ Library v3 ...
ii libstdc++6:amd64 10.3.0-1ubuntu1~20.04 amd64 GNU Standard C++ Library v3

libstdc++6 is the GCC 10.3 version; the -dev package is the GCC 9.3 version.

dpkg-query --listfiles libstdc++-9-dev shows us that this package provides header files, archive libraries and documentation for developing in C++ with GCC 9.

dpkg-query --listfiles libstdc++6 shows us that this package provides documentation, some Python scripts and two really important files:

/usr/lib/x86_64-linux-gnu/libstdc++.so.6
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28

The .so.6 file is what programs are linked against. It is actually a softlink to the .so.6.028 file. That’s the name of the GCC 10 version of libstdc++, the GCC support library for C++. You can get the mapping between those names and GCC versions here. Scroll down, and you’ll find some tables.

GCC used for building Ubuntu

The easiest thing to check is glibc. Building this with a different compiler from the rest of the OS would be crazy, and you can find out what compiler was used to build it just by asking:

/usr/lib/x86_64-linux-gnu/libc.so.6
GNU C Library (Ubuntu GLIBC 2.31-0ubuntu9.7) stable release version 2.31.
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 9.3.0.
libc ABIs: UNIQUE IFUNC ABSOLUTE
For bug reporting instructions, please see:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs.

🌐
Ubuntu
packages.ubuntu.com › jammy › libgcc-s1
Ubuntu – Details of package libgcc-s1 in jammy
Ubuntu Developers (Mail Archive) Please consider filing a bug or asking a question via Launchpad before contacting the maintainer directly. Debian GCC Maintainers (Mail Archive) Matthias Klose · It should generally not be necessary for users to contact the original maintainer. Homepage [gcc.gnu.org] libgcc-s1-armhf-cross ·
🌐
Ubuntu
launchpad.net › ubuntu › jammy › +package › libgcc-s1
libgcc-s1 : Jammy (22.04) : Ubuntu - Launchpad
gcc-12 12.3.0-1ubuntu1~22.04.3 source package in Ubuntu · libgcc-s1 12-20220319-1ubuntu1 in amd64 (Proposed)
🌐
Ubuntu
launchpad.net › ubuntu › noble › +package › libgcc-13-dev
libgcc-13-dev : Noble (24.04) : Ubuntu
This package contains the headers and static library files necessary for building C programs which use libgcc, libgomp, libquadmath, libssp or libitm. gcc-13 13.3.0-6ubuntu2~24.04.1 source package in Ubuntu
🌐
Ubuntu
packages.ubuntu.com › focal-updates › libgcc-9-dev
Package: libgcc-9-dev (9.4.0-1ubuntu1~20.04.2)
two or more packages specified (libgcc-9-dev focal-updates) Content Copyright © 2026 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
🌐
Ubuntu
packages.ubuntu.com › focal › libgcc-s1
Details of package libgcc-s1 in focal
two or more packages specified (libgcc-s1 focal) Content Copyright © 2026 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
🌐
Ubuntu
packages.ubuntu.com › focal › amd64 › libgcc-s1 › download
libgcc-s1_10.5.0-1ubuntu1~20.04_amd64.deb
two or more packages specified (libgcc-s1 focal) Content Copyright © 2025 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
🌐
Ubuntu
packages.ubuntu.com › jammy › libgcc-11-dev
Ubuntu – Details of package libgcc-11-dev in jammy
Download Source Package gcc-11: [gcc-11_11.4.0-1ubuntu1~22.04.dsc] [gcc-11_11.4.0.orig.tar.gz] [gcc-11_11.4.0-1ubuntu1~22.04.debian.tar.xz] Maintainer: Ubuntu Core developers (Mail Archive) · Please consider filing a bug or asking a question via Launchpad before contacting the maintainer directly
Find elsewhere
🌐
Ubuntu
documentation.ubuntu.com › ubuntu-for-developers › reference › availability › gcc
Available GCC versions - Ubuntu for Developers
April 5, 2026 - This page lists GCC versions available in Ubuntu releases. Ubuntu GCC (deb) packages:,,, Ubuntu version, available GCC versions, gcc-defaults version,,, 25.10 (Questing Quokka), 11, 12, 13, 14, 15,...
🌐
Ubuntu
packages.ubuntu.com › focal › libgcc-10-dev
libgcc-10-dev (10.3.0-1ubuntu1~20.04 and others) [security]
two or more packages specified (libgcc-10-dev focal) Content Copyright © 2025 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
🌐
Ubuntu
packages.ubuntu.com › bionic › libgcc-7-dev
Ubuntu – Error
two or more packages specified (libgcc-7-dev bionic) Content Copyright © 2025 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
🌐
Ubuntu
packages.ubuntu.com › search
Ubuntu – Package Contents Search Results -- libgcc_s.so.1
You have searched for files named libgcc_s.so.1 in suite trusty, all sections, and architecture(s) amd64. Found 34 results. This page is also available in the following languages: Български (Bəlgarski) Deutsch suomi français magyar 日本語 (Nihongo) Nederlands polski Русский (Russkij) slovensky svenska Türkçe українська (ukrajins'ka) 中文 (Zhongwen,简) 中文 (Zhongwen,繁) Content Copyright © 2026 Canonical Ltd.; See license terms. Ubuntu ...
🌐
Ubuntu
packages.ubuntu.com › focal › libgcc-7-dev
Package: libgcc-7-dev (7.5.0-6ubuntu2) [universe]
two or more packages specified (libgcc-7-dev focal) Content Copyright © 2025 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
🌐
DedicatedCore
dedicatedcore.com › home › how to install gcc compiler on ubuntu 22.04
How to Install GCC Compiler on Ubuntu 22.04 - DedicatedCore Blog
January 24, 2025 - On Ubuntu, installing the GCC Compiler is a simple procedure. Begin by opening the Terminal on your Ubuntu machine. Next, run a command to make sure your package lists are current.
🌐
UbuntuUpdates
ubuntuupdates.org › package › core › jammy › main › updates › libgcc-11-dev
UbuntuUpdates - Package "libgcc-11-dev" (jammy 22.04)
UbuntuUpdates.org · Raw Package Information · All versions of this package · Bug fixes · List of files in package · Repository home page · 32-bit deb package · 64-bit deb package · APT INSTALL · About - Send Feedback to @ubuntu_updates · google-chrome-beta 147.0.7727.3 ·
🌐
LinuxCapable
linuxcapable.com › home › ubuntu › how to install gcc on ubuntu 26.04, 24.04 and 22.04
How to Install GCC on Ubuntu 26.04, 24.04 and 22.04 - LinuxCapable
April 30, 2026 - Install GCC on Ubuntu 26.04, 24.04 and 22.04 via APT or the Toolchain PPA. Configure multiple versions with update-alternatives.
🌐
Ubuntu Forums
ubuntuforums.org › archive › index.php › t-2058020.html
[ubuntu] where is libgcc_s [Archive] - Ubuntu Forums
Mark, apt-file shows it's in a whole bunch of gcc packages (one for every arch possibly?) - I can paste them if it would help however on my 12.04 xubuntu box I get these specific locations: $ sudo find / -name 'libgcc_s*' 2>/dev/null /usr/lib/gcc/i686-linux-gnu/4.6/libgcc_s.so /lib/i386-linux-gnu/libgcc_s.so.1 Hope this helps
🌐
Ubuntu
documentation.ubuntu.com › ubuntu-for-developers › howto › gcc-setup
How to set up a development environment for GCC on Ubuntu - Ubuntu for Developers
2 weeks ago - This guide explains how to install GCC and related tooling on Ubuntu Desktop. The GNU Compiler Collection (GCC) is a set of compilers for programming languages, including C, C++, Assembly, and many...