Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 Can't 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.

share|improve this question
    
Could you please add too apt-cache policy gcc gcc-4.8 –  Braiam Dec 15 '13 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 –  shaunthomas999 Dec 15 '13 at 11:39
    
Could you edit your question instead? –  Braiam Dec 15 '13 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. –  shaunthomas999 Dec 15 '13 at 11:41
    
Brairam, What do you mean by editing question? –  shaunthomas999 Dec 15 '13 at 11:42
show 2 more comments

3 Answers

up vote 1 down vote accepted

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

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
share|improve this answer
add comment

try with

sudo apt-get install build-essential 

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

share|improve this answer
    
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. –  shaunthomas999 Dec 15 '13 at 11:50
add comment

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

share|improve this answer
    
Dennis, I am now in ubuntu. Could you please explain the steps to perform what you have suggested? –  shaunthomas999 Dec 15 '13 at 11:45
    
Could you share any website link where I can get information on this? –  shaunthomas999 Dec 15 '13 at 15:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.