Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to install g++ and build-essentials in ubuntu 20.04

even after cleaning with apt-get clean it says there are broken packages. sudo dpkg -l | grep ^..r as mentioned in [1] returns nothing.

$ sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 build-essential : Depends: libc6-dev but it is not going to be installed or
                            libc-dev
                   Depends: g++ (>= 4:9.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

[1] https://www.techbrown.com/fix-broken-packages-ubuntu-debian/

like image 974
vanangamudi Avatar asked Mar 30 '21 10:03

vanangamudi


1 Answers

After looking for an answer, I figured to manually install the "correct" version manually, and came across this when downloading the pkg file:

Add the following line to /etc/apt/sources.list:

deb http://archive.ubuntu.com/ubuntu/ focal-proposed main

Update the package index:

sudo apt-get update

After adding this repository, I was able to install build-essential with the command:

sudo apt-get install build-essential
like image 111
Jorge Valdes Avatar answered Oct 19 '22 22:10

Jorge Valdes