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.

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!

share|improve this question
1  
did you try sudo apt-get -f install? –  green7 Mar 11 '13 at 15:25
    
I tried, but the problem persists! –  user138126 Mar 11 '13 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 '13 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 '13 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 '13 at 1:00
show 3 more comments

1 Answer

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.

share|improve this answer
    
doesnt work for me .. –  rdsoze Oct 13 '13 at 12:31
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.