error in installation of gcc on ubuntu Ubuntu 12.04

5,569

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:
5,569

Related videos on Youtube

user138126
Author by

user138126

Updated on September 18, 2022

Comments

  • user138126
    user138126 over 1 year

    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!

    • green
      green about 11 years
      did you try sudo apt-get -f install?
    • Sat93
      Sat93 about 11 years
      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.
    • user138126
      user138126 about 11 years
      I'm remotely operating on the ubuntu machine
    • rdsoze
      rdsoze over 10 years
      first run this .. apt-get install libc6-dev=2.15-0ubuntu10+openvz0 libc-dev-bin=2.15-0ubuntu10+openvz0 .. then it shall work
    • David Foerster
      David Foerster over 10 years
      @rdsoze: How do you know, OP is on an OpenVZ system?
    • rdsoze
      rdsoze over 10 years
      my bad .. i don't ..
    • vArDo
      vArDo over 10 years
      @rdsoze: I had the same problem on Ubuntu 12.04 LTS under OpenVZ, and command from your comment solved my issue.
  • rdsoze
    rdsoze over 10 years
    doesnt work for me ..