2

I want to install gcc on a ubuntu machine but got the following errors:

   t@lab45:~# apt-get install build-essential
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    You might want to run 'apt-get -f install' to correct these:
    The following packages have unmet dependencies:
     build-essential : Depends: libc6-dev but it is not going to be installed or                        
                                libc-dev 
                       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
                       Depends: make but it is not going to be installed
                       Depends: dpkg-dev (>= 1.13.5) but it is not going to be installed
     linux-image-generic-pae : Depends: linux-image-3.2.0-37-generic-pae but it is not going to be installed
    E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

the problem is similar to Install gcc on Ubuntu 12.04 LTS but the solutions there are not workable.

how to deal with this? thanks!

8
  • 1
    did you try sudo apt-get -f install?
    – green
    Mar 11, 2013 at 15:25
  • I tried, but the problem persists!
    – user138126
    Mar 11, 2013 at 15:31
  • Try installing GCC using 'Synaptic Package Manager'. If you are using 12.10, then you will first need to install it from the software center.
    – Sat93
    Mar 11, 2013 at 15:33
  • 1
    first run this .. apt-get install libc6-dev=2.15-0ubuntu10+openvz0 libc-dev-bin=2.15-0ubuntu10+openvz0 .. then it shall work
    – rdsoze
    Oct 13, 2013 at 12:39
  • 1
    @rdsoze: I had the same problem on Ubuntu 12.04 LTS under OpenVZ, and command from your comment solved my issue.
    – vArDo
    Oct 27, 2013 at 1:00

1 Answer 1

1

You should make sure that you have the main archive activated in your sources.list file and that no packages are on-hold.

sudo apt-get update
sudo apt-get clean
grep -P 'main&precise-updates' /etc/apt/sources.list
## Here should return something like deb http://ubuntu.mirror.cambrium.nl/ubuntu/ precise-updates main
echo $(dpkg --get-selections | grep hold | awk '{print $1}') install | sudo dpkg --set-selections
sudo apt-get upgrade
sudo apt-get --fix-missing install build-essentials

With this, your installation should be flawless.

1
  • doesnt work for me ..
    – rdsoze
    Oct 13, 2013 at 12:31

You must log in to answer this question.

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