TL;DR: Downgrade libc6
to libc6=2.31-0ubuntu9.2
and install build-essential
.
You don't have the required repositories enabled. Moreover, there are broken versions of the packages.
By running apt-cache policy g++
on Ubuntu 20.04, I get:
g++:
Installed: (none)
Candidate: 4:9.3.0-1ubuntu2
Version table:
4:9.3.0-1ubuntu2 500
500 http://mirrors.my mirror.com/ubuntu focal/main amd64 Packages
So, you've to enable the main
repository.
Run:
sudo add-apt-repository main && sudo apt update
After enabling the main
repository. Install the correct version of libc6
:
sudo apt install --reinstall libc6=2.31-0ubuntu9.2
DON'T run apt upgrade
.
Now, update and do clean:
sudo apt update
sudo apt clean
sudo apt autoremove
sudo apt -f install
Now, install the meta-package, build-essential
to install g++
:
sudo apt install aptitude
sudo aptitude -f install build-essential
If the above didn't work, then try restoring the default repositories and using aptitude
to install build-essential:
sudo mkdir ~/answer && cd ~/answer/ && sudo wget https://gist.githubusercontent.com/ishad0w/788555191c7037e249a439542c53e170/raw/3822ba49241e6fd851ca1c1cbcc4d7e87382f484/sources.list && sudo sed -i "s/focal/$(lsb_release -c -s)/" ~/answer/sources.list && sudo mv ~/answer/sources.list /etc/apt/ && sudo apt update && sudo apt upgrade && sudo rm -rf ~/answer
sudo aptitude -f install build-essential
Still didn't work?
Edit your question to include:
sudo apt install libc6-dev
sudo apt update
apt-cache policy libc6
apt-cache policy libc-dev
Ping me after adding these details ;)