82

I am running this in ubuntu server installation:

sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386

but I am getting this:

Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version.
gnupg is already the newest version.
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: 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
 g++-multilib : Depends: cpp (>= 4:4.7.2-1ubuntu2) but it is not going to be installed
                Depends: gcc-multilib (>= 4:4.7.2-1ubuntu2) but it is not going to be installed
                Depends: g++ (>= 4:4.7.2-1ubuntu2) but it is not going to be installed
                Depends: g++-4.7-multilib (>= 4.7.2-1~) but it is not going to be installed

How can I fix this?

Jorge Castro
  • 71,754
michael
  • 6,059

3 Answers3

87
sudo apt-get install -f

This would install any dependencies that your previous installs missed. I just corrected my teamviewer and VNC installs.

geezanansa
  • 1,560
  • 47
    Just to clarify, this command is to be run exactly as sudo apt-get install -f and not sudo apt-get install -f package_you_were_trying_to_install like I did :) – Sacha Apr 27 '16 at 21:33
  • This didn't fix the problem for me, I just got: Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded. Any idea why? – Tom Wagstaff Mar 22 '23 at 15:15
31

Try sudo apt-get build-dep build-essential

wwwslinger
  • 335
  • 2
  • 2
7

Have you run: $ sudo aptitude update && sudo aptitude full-upgrade before?

Robert Vila
  • 406
  • 2
  • 10
  • 1
    No. But i was able to install 'sudo apt-get install git curl' – michael Nov 08 '12 at 21:58
  • 1
    Well, maybe you should. In principle, you should execute that (or an equivalent) short before installing any package to have your local package databases updated according to the info in the repositories. – Robert Vila Nov 08 '12 at 22:01
  • 1
    I have done 'sudo aptitude update && sudo aptitude full-upgrade' and they complete successfully. but when I still have the same error when I try to install build-essential – michael Nov 08 '12 at 22:23
  • 1
    Note. I am running a Ubuntu 'server' environment, instead of 'desktop' environment. Does that make a difference? – michael Nov 08 '12 at 22:25
  • 2
    I don't thin so. Are you sure the names with the colon are ok? Why don't you execute: $ aptitude show package:i386 substituting "package" with the package names you have with a colon? – Robert Vila Nov 09 '12 at 00:47
  • I am not sure, but those names seem to be wrong to me. To check if the names are ok or not, and build a list of all the packages with wrong names, you can also execute: $apt-cache show ...your_package_list... 2>NONEXISTENT-PACKAGES; cat NONEXISTENT-PACKAGES to see the list of inexistent packages in your list. Then delete the list. – Robert Vila Nov 09 '12 at 02:03