๐ŸŒ
GNU
gcc.gnu.org โ€บ install โ€บ download.html
Downloading GCC - GNU Project
GCC is distributed via git and via HTTPS as tarballs compressed with gzip or bzip2. Please refer to the releases web page for information on how to obtain GCC.
๐ŸŒ
Red Hat
developers.redhat.com โ€บ articles โ€บ 2023 โ€บ 11 โ€บ 10 โ€บ install-gcc-and-build-hello-world-application-rhel-8
Install GCC and build a Hello World application on RHEL 8 | Red Hat Developer
November 10, 2023 - โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹โ€‹$ gcc -v gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-7) 1. As a developer, how can I get a Red Hat Enterprise Linux subscription that includes the Clang/LLVM, Go, or Rust Compilers? Developers can get a no-cost Red Hat Enterprise Linux Developer subscription for development purposes by registering and downloading through developers.redhat.com.
Discussions

c++ - Install gcc on linux with no root privilege - Stack Overflow
You will need to download and install each package individually (e.g. from the debian website) -- at least binutils, glibc, linux-headers and gcc. If you are on another system, you will need to get the right packages for that system and install them using the corresponding package manager. More on stackoverflow.com
๐ŸŒ stackoverflow.com
How do I get a GCC?
On which OS? More on reddit.com
๐ŸŒ r/C_Programming
31
2
September 1, 2022
linux - how to install gcc-12 on ubuntu - Stack Overflow
More info can be referred from linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04 2023-01-16T13:58:45.693Z+00:00 ... You can use Homebrew to install pre-built binaries. Follow instructions to install Homebrew at https://brew.sh/, then ยท brew install gcc for default GCC (currently ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Why is installation so complicated?
Those are really the build instructions, and yes, building gcc is painful. If you were on Linux I'd just say install the gcc package and be done, but on Windows I don't know. Let's ask Google ... Um, actually, it looks like a bit of a joke (I just searched for "install gcc on windows"), I wouldn't fancy it either. However, if you do want to run gcc on Windows, have a look at MinGW . Or else, bite the bullet and put Linux on a VM and discover how to do software development! (I may be biased here.) More on reddit.com
๐ŸŒ r/gcc
10
11
August 15, 2017
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ installation guide โ€บ how-to-install-gcc-compiler-on-linux
How to Install GCC Compiler on Linux? - GeeksforGeeks
July 23, 2025 - To install the GCC open the terminal on Linux. The terminal takes the input from the user in the form of commands and displays the output on the screen. Hence we have to pass some commands to install the GCC.
๐ŸŒ
Pkgs.org
pkgs.org โ€บ download โ€บ gcc
Gcc Download for Linux (apk deb eopkg ipk pkg rpm txz ...
Download gcc linux packages for Adรฉlie, AlmaLinux, Alpine, ALT Linux, Amazon Linux, Arch Linux, CentOS, Debian, Fedora, FreeBSD, KaOS, Mageia, OpenMandriva, openSUSE, OpenWrt, PCLinuxOS, Rocky Linux, Slackware, Solus, Ubuntu, Void Linux
๐ŸŒ
GNU
gcc.gnu.org โ€บ install
Installing GCC - GNU Project
The latest version of this document is always available at https://gcc.gnu.org/install/. It refers to the current development sources, instructions for specific released versions are included with the sources.
optimizing compiler produced by the GNU Project, key component of the GNU tool-chain and standard compiler for most projects related to GNU and the Linux kernel.
GCC_10.2_GNU_Compiler_Collection_self-compilation.png
gcc 11 1 0 compiling chicken screenshot
The GNU Compiler Collection (GCC; formerly GNU C Compiler) is a collection of compilers from the GNU Project that support various programming languages, hardware architectures, and operating systems. The Free Software Foundation โ€ฆ Wikipedia
Factsheet
Original author Richard Stallman
Developer GNU Project
Initial release March 22, 1987; 39 years ago (1987-03-22)
Factsheet
Original author Richard Stallman
Developer GNU Project
Initial release March 22, 1987; 39 years ago (1987-03-22)
๐ŸŒ
GNU
gcc.gnu.org
GCC, the GNU Compiler Collection - GNU Project
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Objective-C++, Fortran, Ada, Go, D, Modula-2, COBOL, Rust, and Algol 68 as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system.
Find elsewhere
๐ŸŒ
PhoenixNAP
phoenixnap.com โ€บ home โ€บ kb โ€บ sysadmin โ€บ how to install gcc compiler on ubuntu
How to Install GCC Compiler on Ubuntu {3 Simple Methods}
February 20, 2025 - 3. Use the wget command to download the GCC source code from the GCC website. In this example, the file gcc-14.2.0.tar.gz contains the source code for GCC version 14.2.0: wget http://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.gz ยท Adjust ...
๐ŸŒ
Linux From Scratch
linuxfromscratch.org โ€บ blfs โ€บ view โ€บ svn โ€บ general โ€บ gcc.html
GCC-15.2.0
If you need this library, configure GCC with these two options and install the library by running make -C gcc jit.install-common jit.install-info as the root user. This library is not used by any BLFS package, nor is it tested by the BLFS developers. Some program and library names and descriptions are not listed here, but can be found at LFS section for GCC as they were initially installed during the building of LFS.
Top answer
1 of 5
20

I'm still on Ubuntu 22.04 LTS but needed g++14. The sudo apt-get gcc-14 did not work for me, as it installed clang++14 for some reason (perhaps a misconfiguration on my part). What did work for me was following the instructions I found at https://www.dedicatedcore.com/blog/install-gcc-compiler-ubuntu/

The steps I took:

sudo apt install build-essential
sudo apt install libmpfr-dev libgmp3-dev libmpc-dev -y
wget https://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.gz
tar -xf gcc-14.1.0.tar.gz
cd gcc-14.1.0
./configure -v --build=$(uname -m)-linux-gnu --host=$(uname -m)-linux-gnu --target=$(uname -m)-linux-gnu --prefix=/usr/local/gcc-14.1.0 --enable-checking=release --enable-languages=c,c++ --disable-multilib --program-suffix=-14.1.0
make
sudo make install

And if you would like to make it the default:

sudo update-alternatives --install /usr/bin/g++ g++ /usr/local/gcc-14.1.0/bin/g++-14.1.0 14
sudo update-alternatives --install /usr/bin/gcc gcc /usr/local/gcc-14.1.0/bin/gcc-14.1.0 14

After that, g++ showed I was running version 14.1.0. I was then able to compile my project that included some c++20/23 features that were not in the previous versions of g++ (chrono/format).

2 of 5
15

GCC-14 (and G++-14) is available in the Universe repository for Ubuntu 24.04, as evident in the Ubuntu Package archive.

It is equally evident that this package is not available for Ubuntu 22.04, so installing this on 22.04 will require some third-party interference, or you have to compile it yourself.

See here on how to enable the Universe repositories.

๐ŸŒ
Arm Developer
developer.arm.com โ€บ downloads โ€บ - โ€บ gnu-rm
Downloads | GNU Arm Embedded Toolchain Downloads โ€“ Arm Developer
For Linux, the binaries are provided as tarball files. For Mac OS X, the binaries are provided as tarball and pkg files. The release also contains source code package (together with build scripts and instructions to setup the build environment), which is composed of: * gcc : refs/vendors/ARM/heads/arm-10 git://gcc.gnu.org/git/gcc.git commit a7eb0564c3060418b5ca68c2806ad74f73384fd0 * binutils : binutils-2_36-branch git://sourceware.org/git/binutils-gdb.git commit a7eb3ff36cebc093af6658049e03d63579dade86 * newlib and newlib-nano : 2a3a03972b35377aef8d3d52d873ac3b8fcc512c git://sourceware.org/git
๐ŸŒ
iO Flood
ioflood.com โ€บ blog โ€บ install-gcc-command-linux
Installing and Using the GCC Command: Linux User Guide
January 2, 2024 - Hereโ€™s a basic example of how you might do this: # Download the source code wget http://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz # Extract the tarball tar xf gcc-9.2.0.tar.gz # Navigate into the directory cd gcc-9.2.0 # Configure the ...
๐ŸŒ
Softpedia
linux.softpedia.com โ€บ programming โ€บ compilers โ€บ gcc
GCC - Download (Linux) - Softpedia
Download GCC 9.2.0 for Linux - This is the original GCC (GNU Compiler Collection) software for all POSIX systems
๐ŸŒ
UltaHost
ultahost.com โ€บ knowledge-base โ€บ install-gcc-compiler-linux
How to Install GCC Compiler on Linux | Ultahost Knowledge Base
September 3, 2024 - Learn how to install the GCC compiler on Linux. This guide covers all commands and configurations to get GCC running on Linux system.
๐ŸŒ
Linux Mint Forums
forums.linuxmint.com โ€บ board index โ€บ main edition support โ€บ beginner questions
Installing gcc and g++ - Linux Mint Forums
March 23, 2019 - I get the same results with gcc. I've tried sudo apt-get install mediainfo mediainfo-gui open jdk-8-jre wget ffmpeg x264 x265 (to install java) This produces the following errors E: unable to locate package open. E:unable to locate package jdk-8-jre Please help, I am not normally interested in point & click stuff (GUI) . I normally drop to a terminal for all my Unix (now Linux) utilities.
๐ŸŒ
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 - Download the GCC source code from the GCC website using the wget command. The source code for GCC version 13.2.0 is present in the file gcc-13.2.0.tar.gz in the following example: wget http://ftp.gnu.org/gnu/gcc/gcc-13.2.0/gcc-13.2.0.tar.gz ...
๐ŸŒ
LinuxCapable
linuxcapable.com โ€บ home โ€บ linux mint โ€บ how to install gcc on linux mint 22 and 21
How to Install GCC on Linux Mint 22 and 21 - LinuxCapable
3 weeks ago - If youโ€™re looking for a GCC download for Linux Mint, APT already handles the standard toolchain cleanly.
๐ŸŒ
Linux From Scratch
linuxfromscratch.org โ€บ blfs โ€บ view โ€บ 11.0 โ€บ general โ€บ gcc.html
GCC-11.2.0
The machine triplet may be different on a 32bit system. Download (HTTP): https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.xz ยท Download (FTP): ftp://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.xz ยท Download MD5 sum: 31c86f2ced76acac66992eeedce2fce2 ...
Top answer
1 of 4
50

gcc-12 is not available in ubuntu 20.04, so we need to compile it from source code, here are the steps which I borrowed from this video:

  • Step 1: clone gcc source code and checkout gcc-12 branch
$ git clone https://gcc.gnu.org/git/gcc.git gcc-source
$ cd gcc-source/
$ git branch -a
$ git checkout remotes/origin/releases/gcc-12
  • Step 2: make another build dir

Note this is important as running ./configure from within the source directory is not supported as documented here.

$ mkdir ../gcc-12-build
$ cd ../gcc-12-build/
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++
  • Step 3: installing GCC prequisites and run configure again

The missing libraries will be shown in above ./confgiure output, search and install them one by one.

$ apt-cache search MPFR
$ sudo apt-get install libmpfrc++-dev
$ apt-cache search MPC | grep dev
$ sudo apt-get install libmpc-dev
$ apt-cache search GMP | grep dev
$ sudo apt-get install libgmp-dev
$ sudo apt-get install gcc-multilib
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++

An alternative is to run the download_prerequisites script.

$ cd ../
$ cd gcc-source/
$ ./contrib/download_prerequisites
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++
  • Step 4: compile gcc-12
$ make -j16

Still flex is missing:

$ sudo apt-get install flex
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++
$ make -j16
$ make install

Another way is to use Ubuntu 22.04 where gcc-12 is available. In Ubuntu 22.04, gcc-12 can be installed with apt:

$ sudo apt install gcc-12
2 of 4
16

You can use Homebrew to install pre-built binaries. Follow instructions to install Homebrew at https://brew.sh/, then

brew install gcc for default GCC (currently 11) or brew install gcc@12 for gcc-12.

Note that it may compile missing dependencies.