Maybe simple...

sudo apt-get install gcc

... could be enough?

Answer from Jot eN on askubuntu.com
Discussions

Trying to install gcc on a linux terminal, but I get an error - Unix & Linux Stack Exchange
E: Failed to fetch http://secu... http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_5.4.0-81.91_amd64.deb 404 Not Found [IP: 91.189.88.152 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? When I type "gcc" again, it just tells ... More on unix.stackexchange.com
🌐 unix.stackexchange.com
c - not able to install gcc on ubuntu 18.04.01 - Stack Overflow
I have just installed Ubuntu 18.04.1 LTS and I am trying to use the make command to compile my Makefile which is located in the same directory as my simple.c file. After running make I get the erro... More on stackoverflow.com
🌐 stackoverflow.com
64 bit - C compiler not found, Ubuntu - Stack Overflow
I'm trying to install wine on a 64bits, so I followed this : http://wiki.winehq.org/WineOn64bit And when I launch configure, I have this error : "configure: error: no acceptable C compiler found ... More on stackoverflow.com
🌐 stackoverflow.com
Aarch64-none-linux-gnu-gcc: not found
Hi, i am using colibri-imx6ull SOM and trying to create the costume linux by using “Build U-Boot From Source Code | Toradex Developer Center” right now i am in the phase of host image creation in host device, while i am trying to follow the same i am facing the following issue ... More on community.toradex.com
🌐 community.toradex.com
1
0
July 11, 2024
🌐
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
2 weeks ago - Install build-essential to get ... to locate package gcc-14” or a similar error, first confirm that the requested branch exists for your Ubuntu release....
Find elsewhere
🌐
iO Flood
ioflood.com › blog › install-gcc-command-linux
Installing and Using the GCC Command: Linux User Guide
January 2, 2024 - In most Linux distributions, the GCC command comes pre-installed. However, if it’s not, you can install it in Debian based distributions like Ubuntu, by running the command sudo apt-get install gcc.
🌐
Delft Stack
delftstack.com › home › howto › linux › solve gcc command not found error in bash
How to Solve GCC Command Not Found Error in Bash | Delft Stack
March 11, 2025 - If you see “command not found” after installing GCC, check if the installation path is included in your PATH variable. Can I install GCC on Windows? Yes, you can install GCC on Windows using MinGW or Cygwin.
🌐
Toradex Community
community.toradex.com › technical support
Aarch64-none-linux-gnu-gcc: not found - Technical Support - Toradex Community
July 11, 2024 - Hi, i am using colibri-imx6ull SOM and trying to create the costume linux by using “Build U-Boot From Source Code | Toradex Developer Center” right now i am in the phase of host image creation in host device, while i am trying to follow the same i am facing the following issue lcl@lcl-Latitude-5430:~/workdir/u-boot$ make mrproper /bin/sh: 1: aarch64-none-linux-gnu-gcc: not found make: aarch64-none-linux-gnu-gcc: No such file or directory /bin/sh: 1: aarch64-none-linux-gnu-gcc: not found ...
🌐
GitHub
gist.github.com › zuyu › 7d5682a5c75282c596449758d21db5ed
Install gcc 6 on Ubuntu · GitHub
sudo apt update 4.sudo apt-get install gcc-6 g++-6 -y ... vim is just a text editor. You can whether install it using sudo apt install vim or use another one, as nano. ... Hi, This has been useful for me, so I'll chip in. With ubuntu 20.04 you can't just add the ubuntu-toolchain repository.
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.

🌐
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 - This guide will show you how to install GCC on a Ubuntu. A step-by-step so that you have all the tools you need to start writing and creating software immediately. For a seamless installation process of the powerful programming language Go (Golang) check.
🌐
Linuxize
linuxize.com › home › gcc › how to install gcc compiler on ubuntu 18.04
How to Install GCC Compiler on Ubuntu 18.04 | Linuxize
October 31, 2019 - We will show you how to install the distro stable version and the latest version of GCC. The same instructions apply for Ubuntu 16.04 and any Ubuntu-based distribution, including Kubuntu, Linux Mint and Elementary OS.
Top answer
1 of 4
9

I took an update today on my Ubuntu 22.04 and encountered the error with VMware Workstation 16 Pro 16.2.4 build-20089737 shown in the question here.

GNU C Compiler (gcc) version 12.3.0, was not found. If you installed it in a non-default path you can specify the path below. Otherwise refer to your distribution's documentation for installation instructors and click Refresh to search again in default locations.

I've used VMWare every day since this OS was fresh installed in 2022.

There were three problems to fix:

Missing gcc 12

My gcc --version is 11.4.0. I checked ls /usr/bin/x86_64-linux-gnu-* and version 12 was not there.

$ sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y
$ sudo apt update
$ sudo apt install g++-12 gcc-12

Then try again.

skb_gso_segment undefined

The build breaks because of gcc header changes. The VMWare build provides a log file like /tmp/vmware-user/vmware_1234.log that shows the compiler error.

This particular function, skb_gso_segment, has moved to a new header that VMWare bridge.c does not #include.

To see for yourself the header where this function is defined, cd /usr/src/linux-hwe-6.5-headers-6.5.0-14/include/net and grep skb_gso_segment *.

To fix VMWare code:

$ sudo su
$ cd /usr/lib/vmware/modules/source

# back up original tar file
$ cp vmnet.tar vmnet.tar.original

# change the code
$ tar -xvf vmnet.tar
$ nano vmnet-only/bridge.c

After the #include <linux/netdevice.h>, add

   #include <net/gso.h>

Save and exit. Then rebuild the tar file.

$ tar -cf vmnet.tar vmnet-only
$ exit

Then try again.

__pte_offset_map undefined

Next the build fails because a function has changed names. In VMWare Workstation 17, the code in pgtbl.h was changed like this by VMWare:

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,5,0)
            pte_t *pte = pte_offset_kernel(pmd, addr);
#else
            pte_t *pte = pte_offset_map(pmd, addr);
#endif

To fix v16, I made a similar change.

$ sudo su
$ cd /usr/lib/vmware/modules/source

# back up original tar file
$ cp vmmon.tar vmmon.tar.original

# change the code
$ tar -xvf vmmon.tar
$ nano vmmon-only/include/pgtbl.h

In the editor, search down to pte_offset_map and change it to pte_offset_kernel.

Save and exit. Then rebuild the tar file.

$ tar -cf vmmon.tar vmmon-only
$ exit

Then try again.

This got me back in operation.

2 of 4
3

I too had this issue and what resolved it for me was as simple as

sudo apt install gcc-12 libgcc-12-dev
🌐
Ask Ubuntu
askubuntu.com › questions › 1393176 › why-is-gcc-missing-from-ubuntu-20-04
apt - Why is GCC missing from Ubuntu 20.04? - Ask Ubuntu
The manifest contains what is included on the ISO, but what actually is installed depends on the options the installer selects, let alone some packages are never installed (who needs the subiquity (or whatever installer is included on the chosen ISO) on an installed system!). Details such as Ubuntu Server belong in your question (comments are from us to you!), plus 20.04 isn't available for x86 (i386 in Debian/Ubuntu terms) being only amd64 or x86_64 (ie. 64-bit); 32-bit only for armhf & architecture matters; how are we to know you don't mean ppc64el, or s390x if not told. ... Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... 6 How can I use a later version of GCC than the system runtimes support?