GCC has a "bootstrap" build process. So when you try to build gcc-11 with only gcc-8 installed, it will build a temporary "stage 1" version of gcc-11 using gcc-8, then compile gcc-11 again using gcc-11-stage1. Thus no matter what you start with, the version of gcc-11 that comes out of the build process was effectively compiled with itself.

So all that matters is that gcc-8, or whatever "system compiler" was previously installed, is able to build a stage1 version of gcc-11 that runs well enough to compile the stage 2 version. It doesn't matter whether your system compiler is good at optimizing, and gcc's source code is deliberately written to use a fairly minimal set of language feature (at least for stage 1), so you are not likely to run into trouble with your system compiler having missing or buggy support for obscure corners of the language. Historically, the "system compiler" was often not gcc at all, but some compiler provided by the computer vendor or an unrelated third party, and so one couldn't rely much on its quality; gcc was designed with that in mind.

Theoretically your system compiler could have a bug which miscompiles gcc-11-stage1 in such a way that it appears to work, but itself miscompiles stage2. This is unlikely, and it's even less likely that it would happen in a way that wasn't obvious (e.g. the stage2 compiler simply segfaulting). If worried, there's an option to have stage2 build a stage3 compiler, and then check that both versions are identical. So as long as the build completes, you can be pretty confident that the final installed compiler is fine and unaffected by bugs in the original system compiler. (All that said, a reference to Ken Thompson's "Reflections on Trusting Trust" is obligatory here.)

So in practice, you don't need to worry about the version of gcc used to build a new version. Whatever you happen to have installed already, within reason, will be fine.

Answer from Nate Eldredge on Stack Overflow
🌐
GNU
gcc.gnu.org › gcc-11 › changes.html
GCC 11 Release Series — Changes, New Features, and Fixes - GNU Project
When building GCC itself, the host compiler must now support C++11, rather than C++98. In particular bootstrapping GCC 11 using an older version of GCC requires a binary of GCC 4.8 or later, rather than of GCC 3.4 or later as was the case for bootstrapping GCC 10.
Top answer
1 of 1
5

GCC has a "bootstrap" build process. So when you try to build gcc-11 with only gcc-8 installed, it will build a temporary "stage 1" version of gcc-11 using gcc-8, then compile gcc-11 again using gcc-11-stage1. Thus no matter what you start with, the version of gcc-11 that comes out of the build process was effectively compiled with itself.

So all that matters is that gcc-8, or whatever "system compiler" was previously installed, is able to build a stage1 version of gcc-11 that runs well enough to compile the stage 2 version. It doesn't matter whether your system compiler is good at optimizing, and gcc's source code is deliberately written to use a fairly minimal set of language feature (at least for stage 1), so you are not likely to run into trouble with your system compiler having missing or buggy support for obscure corners of the language. Historically, the "system compiler" was often not gcc at all, but some compiler provided by the computer vendor or an unrelated third party, and so one couldn't rely much on its quality; gcc was designed with that in mind.

Theoretically your system compiler could have a bug which miscompiles gcc-11-stage1 in such a way that it appears to work, but itself miscompiles stage2. This is unlikely, and it's even less likely that it would happen in a way that wasn't obvious (e.g. the stage2 compiler simply segfaulting). If worried, there's an option to have stage2 build a stage3 compiler, and then check that both versions are identical. So as long as the build completes, you can be pretty confident that the final installed compiler is fine and unaffected by bugs in the original system compiler. (All that said, a reference to Ken Thompson's "Reflections on Trusting Trust" is obligatory here.)

So in practice, you don't need to worry about the version of gcc used to build a new version. Whatever you happen to have installed already, within reason, will be fine.

🌐
Reddit
reddit.com › r/c_programming › how important are gcc versions?
r/C_Programming on Reddit: How important are gcc versions?
May 13, 2024 -

I have started getting unto assembly and optimising code and I was wandering how important if at all is it to upgrade the computer I am using.

Currently I am on gcc 11.4 which feels fairly old at this point when I am looking at what's out there.

Are the differences between versions thst big or is it generally fairly unimportant

🌐
Reddit
reddit.com › r/gcc › gcc version mismatch warning, but the versions are the same...
r/gcc on Reddit: gcc version mismatch warning, but the versions are the same...
December 19, 2023 -

Hello, I encountered a weird warning, as stated in the title, the warning is:

...
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
You are using:           gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
...

Other info:

$ cat /proc/version
Linux version 6.2.0-39-generic (buildd@lcy02-amd64-045) (x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
...
gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04)

Can anyone help? Thanks!

🌐
GNU
gcc.gnu.org › gcc-11
GCC 11 Release Series - GNU Project
July 19, 2024 - This release is a bug-fix release, containing fixes for regressions in GCC 11.4 relative to previous releases of GCC.
🌐
Red Hat
developers.redhat.com › articles › 2025 › 04 › 16 › gcc-and-gcc-toolset-versions-rhel-explainer
GCC and gcc-toolset versions in RHEL: An explainer | Red Hat Developer
April 16, 2025 - 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 ·
🌐
DevDocs
devdocs.io › gcc~11
DevDocs — GCC 11 documentation
GCC 11.4.0 API documentation with instant search, offline support, keyboard shortcuts, mobile version, and more.
🌐
Phoronix
phoronix.com › review › gcc8-gcc11-cxlx
GCC 8 Through GCC 11 Stable Plus GCC 12 Compiler Benchmarks - Phoronix
July 8, 2021 - For today's benchmarking is a look at how the GNU Compiler Collection has performed over the past few years going from the GCC 8 stable series introduced in 2018 through the recently released GCC 11.1 stable feature release plus also including the current early development snapshot of GCC 12.
Find elsewhere
🌐
STMicroelectronics Community
community.st.com › t5 › stm32cubeide-mcus › gcc-11-3-vs-gcc-12-3 › td-p › 628433
Solved: GCC 11.3 vs GCC 12.3 - STMicroelectronics Community
January 15, 2024 - Should I mantain 11.3 or pass to 12.3? ... Solved! Go to Solution. ... This discussion is locked. Please start a new topic to ask your question. ... If you have no reason to choose one over the other, stick with the default to make your life easier. All versions of GCC are stable.
🌐
Reddit
reddit.com › r/cpp › gcc 8 through gcc 11 stable plus gcc 12 compiler benchmarks
r/cpp on Reddit: GCC 8 Through GCC 11 Stable Plus GCC 12 Compiler Benchmarks
July 9, 2021 - 4 in front of version, before the ':' is a "epoch" - it is Debian's way to correct errors in version numbers, and is not related to upstream version of the package. ... Any sites that compare compile time benchmarks for different CPUs? Or are general CPU benchmark sites enough? ... Cinebench causes ryzen 5900x to go cookoo bananas and hit 90c - other synthetic benchmarks are fine though?? ... GCC 11 now in core!
🌐
GNU
gcc.gnu.org › gcc-12 › changes.html
GCC 12 Release Series — Changes, New Features, and Fixes - GNU Project
December 29, 2025 - -Wattributes has been extended ... (in C++11 and C2X). Similarly, #pragma GCC diagnostic ignored_attributes "vendor::attr" can be used to achieve the same effect (PR101940) Some new features from the upcoming C2X revision of the ISO C standard are supported with -std=c2x and -std=gnu2x. Some of these features are also supported as extensions when compiling for older language versions...
🌐
GNU
gcc.gnu.org › gcc-11 › porting_to.html
Porting to GCC 11 - GNU Project
GCC 11 defaults to -std=gnu++17 instead of -std=gnu++14: the C++17 standard, plus GNU extensions. This brings several changes that users should be aware of.
🌐
SUSE
documentation.suse.com › sbp › devel-tools › html › SBP-GCC-11 › index.html
Advanced Optimization and New Capabilities of GCC 11 | SUSE Linux Enterprise Server 15 SP3
March 14, 2022 - All necessary runtime libraries ... document at hand, we use the term GCC 11 as synonym for any minor version of the major version 11 and GCC 11.2, to refer to specifically that version....
🌐
Ubuntu
packages.ubuntu.com › jammy › gcc-11
Ubuntu – Details of package gcc-11 in jammy
dep: cpp-11 (= 11.4.0-1ubuntu1~22.04.3) [amd64, i386] dep: gcc-11-base (= 11.2.0-19ubuntu1) [not amd64, i386] GCC, the GNU Compiler Collection (base package) dep: gcc-11-base (= 11.4.0-1ubuntu1~22.04.3) [amd64, i386] dep: libc6 (>= 2.34) GNU C Library: Shared libraries ·
🌐
GNU
gcc.gnu.org › releases.html
GCC Releases - GNU Project
April 30, 2026 - GCC releases may be downloaded from our mirror sites · Important: these are source releases, so will be of little use if you do not already have a C++ compiler installed. As one option, there are pre-compiled binaries. for various platforms
Top answer
1 of 1
2

This is not recommended but you can install version 11.3 by downloading gcc-11 (version 11.3) from here. And downloading the dependencies gcc-11-base and libgcc-11-dev.

Then, run sudo apt install /path/to/file where /path/to/file is the path to the actual downloaded file. If it can't find the file, you may need to put it in double quotes like "/path/to/file".

You will need to install the gcc-11-base package first, then libgcc-11-dev and finally, gcc-11.

For example, if it's downloaded to your Downloads directory:

sudo apt install $HOME/Downloads/gcc-11-base_11.3.0-6ubuntu1_amd64.deb

and

sudo apt install $HOME/Downloads/libgcc-11-dev_11.3.0-6ubuntu1_amd64.deb

and

sudo apt install $HOME/Downloads/gcc-11_11.3.0-6ubuntu1_amd64.deb

I'm pretty sure gcc only requires gcc-11 >11.2 so this should downgrade your version of gcc and when you're done compiling or whatever you need it for, simply run:

sudo apt update
sudo apt install --reinstall gcc-11 gcc-11-base libgcc-11-dev

to upgrade back to the current version of gcc-11 (11.4).

Granted, the installation isn't guaranteed to work, could be insecure or lacking security updates. Also, you may run into dependency issues. If that's the case, you'd have to tread carefully or install each dependency one by one but always pay attention to what, if any, packages would need to uninstall when installing weird versions because you don't want to inadvertently uninstall a bunch of stuff you want or need.


EDIT: you will need to install dependencies (included above) but you can run the following commands to do it more quickly.

Run the following commands to create a working directory and download the packages:

cd
mkdir GCC11.3
cd GCC11.3
wget 'http://mirrors.kernel.org/ubuntu/pool/main/g/gcc-11/gcc-11-base_11.3.0-6ubuntu1_amd64.deb'
wget 'http://mirrors.kernel.org/ubuntu/pool/main/g/gcc-11/libgcc-11-dev_11.3.0-6ubuntu1_amd64.deb'
wget 'http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-11/gcc-11_11.3.0-6ubuntu1_amd64.deb'

Now, install the packages. Again, however, remember to pay attention to what, if any packages will be uninstalled when you install these weird versions. Review the list before you select Y to accept the changes!:

sudo apt install ./gcc*.deb

And again, when you're done compiling or whatever you need gcc 11.3 for, simply run:

sudo apt install --reinstall gcc-11 gcc-11-base libgcc-dev

to upgrade back to gcc 11.4.

🌐
Stack Overflow
stackoverflow.com › questions › 77298654 › why-gcc-12-takes-6-times-larger-disk-space-than-11-in-a-linux-distro
Why gcc 12 takes 6 times larger disk space than 11 in a linux distro? - Stack Overflow
I've recently tried to move from Linux Mint 21 to 21.2. I've downloaded distro and noted 3Gb vs 2.4 Gb size of ISO file. From comparison major single difference is inclusion of GCC 12 along with GCC 11. 11 takes 66Mb, 12 - 411 Mb !
🌐
Reddit
reddit.com › r/cpp_questions › multiple versions of gcc installed
r/cpp_questions on Reddit: Multiple versions of GCC installed
May 18, 2023 -

My distro comes with gcc 11 and clang 14 - meanwhile the real world is on gcc 13 and clang 16.

I would like to install the newer versions of gcc and clang, but I would also like to avoid namespace collision.

(I ask about gcc and clang because I'm on r/cpp_questions but to be honest this is a problem I have for multiple languages - I also maintain python 2.7 and write python 3.newest, and other languages as well)

Are there any good solutions for this? The only think I know will work is to install separate virtual machines for separate compilers but that seems exceedingly expensive in terms of disk space.