Maybe simple...
sudo apt-get install gcc
... could be enough?
Answer from Jot eN on askubuntu.comMaybe simple...
sudo apt-get install gcc
... could be enough?
Do this: open a terminal and type gcc --version. Does anything come up?
Alternatively, search for the gcc executable, which should be located in /usr/bin.
Do ls /usr/bin | grep gcc. What output do you get from that command?
If you get no output from either command, then you need to find your gcc executable wherever you installed it (somewhere in /usr/share maybe?). When found, do cd /usr/bin && ln -s [ABSOLUTE PATH OF GCC].
If you got no output from the first, but output from the second, then you have serious trouble, because /usr/bin is not in your PATH. Edit the file /etc/environment and ADD the following line to the end of the document: PATH="$PATH:/usr/bin".
If you got output from the first, then there is a problem somewhere with bash not reading its own PATH. I think hell would freeze before the first works, but watch you prove me wrong and freeze hell for me. :)
Hope this helps! +1 me if it does!
While installing vmware this error popup gcc not found. How to tackle it
Trying to install gcc on a linux terminal, but I get an error - Unix & Linux Stack Exchange
c - not able to install gcc on ubuntu 18.04.01 - Stack Overflow
64 bit - C compiler not found, Ubuntu - Stack Overflow
Aarch64-none-linux-gnu-gcc: not found
Videos
If sudo apt-get update does not work for you, you should maybe try sudo apt-get clean to clean the cache and then execute sudo apt-get update
This may or may not be your problem, but I had the same issue when first installing my copy of Ubuntu 18.04.01. I did not yet have the drivers of my wifi-dongle installed, and, as such, I couldn't reach any site (including the sites of Ubuntu working with package updates).
So, it may be an internet-related issue. I read in the comments that
you could execute apt-get update. Maybe there is a different
connection issue at work? I would check those settings.
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
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.
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.
I too had this issue and what resolved it for me was as simple as
sudo apt install gcc-12 libgcc-12-dev