1

I'm trying to install build-essential using sudo apt-get install build-essential like I'm supposed to. It returns with the error

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

I have tried to use a few different fixes, like sudo apt-get install -f and sudo apt-get update as well as sudo apt-get upgrade but none have fixed the packages. When using sudo apt-get install -f this is what terminal tells me.

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      linux-image-3.19.0-25-generic linux-image-extra-3.19.0-25-generic
    Use 'apt-get autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.

Other options return nothing. I looked up a few other guides and questions, but none worked. I tried dpkg -i to try and let it install the dependencies for me, I tried following the labrynth myself and installing the dependencies by hand, but I just got more and more dependencies until I couldn't find the light at the end of the cold tunnel of dependencies. Is there an easy way to install build-essential through terminal that I'm not using, or is there a command that can install this long list of dependencies for me? I think I've included all the information that you'll need. This is a link to the dpkg -i guide that I tried-- How to let `dpkg -i` install dependencies for me? If there is additional information needed I can get it to you!

EDIT:

Here is the output of apt-cache policy build-essential g++.

    build-essential:
      Installed: (none)
      Candidate: 11.6ubuntu6
      Version table:
         11.6ubuntu6 0
            500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
    g++:
      Installed: (none)
      Candidate: 4:4.8.2-1ubuntu6
      Version table:
         4:4.8.2-1ubuntu6 0
            500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

I also ran someone else's solution and it didn't work, but I noticed something interesting in the code so I ran sudo apt-get dist-upgrade a second time to get the information on its own. Here's what I got. I'm not sure what it means or how to fix it. If anyone can answer any of the multiple questions here that'd be very helpful! Thank you!

    $ sudo apt-get dist-upgrade
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Calculating upgrade... Done
    The following packages have been kept back:
      cpp-4.8 gcc-4.8-base gcc-4.8-base:i386 libasan0
    0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

I tried to run sudo apt-get updates and sudo apt-get install -f after I saw this, but I just got the same output as before.

2
  • Hmm... 14.04 should call for g++-4.8 afaik. Do you have some old repositories enabled? What is the output of apt-cache policy build-essential g++? Jun 29, 2016 at 1:42
  • I'm not sure if I have any repositories enabled. The output of apt-cache has been added to the end of the question because I can't format it to be readable in the comments.
    – James
    Jun 29, 2016 at 1:48

2 Answers 2

2

I only know two ways to do this one is : sudo apt-get install -f and the other is to download everything manually via a browser and putting packages inside of /var/cache/apt/archives (the folder where downloaded packages reside) and call the install again.

You can check the integrity of packages just in case corruption is the reason of dependency been unsolved. My Kung fu is not deeper than that. You can also try purging, then auroremove and call installation again on the software you want.

3
  • I'm not sure how this is supposed to fix my package dependencies...
    – James
    Jun 29, 2016 at 19:23
  • @James Updated, hope this helps
    – userDepth
    Jul 24, 2016 at 3:18
  • Thanks! I ended up ruining my computer and actually reinstalling so now I don't get that "held back" notification. I ended up getting the install to work by using sudo apt-get install build-essential checkinstall and that worked just fine. However, on a seperate system and I was able to get install -f to fix the packages, but it only works on certain packages... Not sure why though.
    – James
    Jul 24, 2016 at 3:51
0

This may be a situation specific fix (I've never had this happen twice so I don't know) but when I ran sudo apt-get install build-essential checkinstall it installed all dependencies. Another way to install dependencies may be through gdebi (not sure on that one either. I've never used it, but after some research I believe it would work). I've tried installing other packages using sudo apt-get install package checkinstall and it's never asked me to fix dependencies again.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .