2

When I try to install g++ in my machine I am getting the following message.

support:/$ sudo apt-get install g++
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:
 g++ : Depends: gcc (>= 4:4.8.1-2ubuntu3) but it is not going to be installed
       Depends: g++-4.8 (>= 4.8.1-4~) but it is not going to be installed
       Depends: gcc-4.8 (>= 4.8.1-4~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I am using Ubuntu 13.10(Saucy). I have stuck up with this problem for 2 days now. I know this is a duplicate question but still I am posting it because I couldn't find an solution from other similar posts.

I have tried all solutions given in Package system is broken. How to fix it? . But it couldn't solve the issue.

As asked in a comment in https://askubuntu.com/questions/385008/cant-install-g-on-13-10-dependency-problem , Im putting the result of apt-cache policy g++ g++-4.8 below

g++:
  Installed: (none)
  Candidate: 4:4.8.1-2ubuntu3
  Version table:
     4:4.8.1-2ubuntu3 0
        500 http://de.archive.ubuntu.com/ubuntu/ saucy/main i386 Packages
g++-4.8:
  Installed: (none)
  Candidate: 4.8.2-1ubuntu1
  Version table:
     4.8.2-1ubuntu1 0
        500 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ saucy/main i386 Packages
     4.8.1-10ubuntu8 0
        500 http://de.archive.ubuntu.com/ubuntu/ saucy/main i386 Packages

PS: I am not looking for any particular version of g++. Actual working scenario is I want to install npm package 'libxmljs' which is dependent on 'node-gyp'. For 'node-gyp' to install properly the system should have 'make', 'g++' and 'python'. I have make and python in my system. The following is what I get when I run g++ --version

The program 'g++' can be found in the following packages:
 * g++
 * pentium-builder
Try: sudo apt-get install <selected package>

Please help me to solve the issue.

7
  • Could you please add too apt-cache policy gcc gcc-4.8
    – Braiam
    Dec 15, 2013 at 11:34
  • gcc: Installed: (none) Candidate: 4:4.8.1-2ubuntu3 Version table: 4:4.8.1-2ubuntu3 0 500 de.archive.ubuntu.com/ubuntu saucy/main i386 Packages gcc-4.8: Installed: (none) Candidate: 4.8.2-1ubuntu1 Version table: 4.8.2-1ubuntu1 0 500 ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu saucy/main i386 Packages 4.8.1-10ubuntu8 0 500 de.archive.ubuntu.com/ubuntu saucy/main i386 Packages Dec 15, 2013 at 11:39
  • Could you edit your question instead?
    – Braiam
    Dec 15, 2013 at 11:40
  • Braiam, See the above comment for result of apt-cache policy gcc gcc-4.8 . Itz not formatted properly. Sorry for that. I don't know how to format text while commenting in ask ubuntu. Dec 15, 2013 at 11:41
  • Brairam, What do you mean by editing question? Dec 15, 2013 at 11:42

3 Answers 3

5

A detailed solution about how to solve broken package issue can be found here How do I resolve unmet dependencies after adding a PPA?

If you couldn't solve the broken package issue using the solutions in the above link then you can use 'aptitude' instead of 'apt'. Please using the following commands to solve the issue.

sudo apt-get install aptitude

sudo aptitude install build-essential
0

try with

sudo apt-get install build-essential 

that will give all other things that you may require in future while doing compiling.

1
  • Hi, This is what I am able to see when I tried to install build essential >>> The following packages have unmet dependencies: build-essential : Depends: gcc (>= 4:4.4.3) but it is not going to be installed Depends: g++ (>= 4:4.4.3) but it is not going to be installed E: Unable to correct problems, you have held broken packages. Dec 15, 2013 at 11:50
0

You have enabled broken PPA's. Get rid of them, remove packages installed from them and try again.

2
  • Dennis, I am now in ubuntu. Could you please explain the steps to perform what you have suggested? Dec 15, 2013 at 11:45
  • Could you share any website link where I can get information on this? Dec 15, 2013 at 15:47

You must log in to answer this question.

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