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.

This question already has an answer here:

When i go to install gcc 4.8 using:

sudo apt-get update
sudo apt-get install gcc-4.8 g++-4.8

I get the error message:

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.
 gcc-4.8 : Depends: binutils (>= 2.23.90.20131017) but 2.23.52.20130913-0ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.

Anyone please help?

EDIT: I tried this but it didnt work:

Can't install gcc 4.8, dependency issues

sudo apt-get clean
sudo apt-get update
apt-get upgrade -f

EDIT2: Just done fresh install on a second machine. Did exactly the same and encountered the same problem. However, when I check the version number for gcc (and g++) it says 4.8.1 !?!?!

share|improve this question
    
Try sudo apt-get clean && sudo apt-get update –  Mitch Dec 12 '13 at 19:16
    
Didnt work- I also tried sudo apt-get install build-essentials –  user997112 Dec 12 '13 at 20:12
add comment

marked as duplicate by karel, Radu Rădeanu, BuZZ-dEE, Avinash Raj, mikewhatever Jan 14 at 20:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers

You might have a better luck with this:

   sudo apt-get -f install -y

This command calls apt-get to identify the missing dependency and fetch it.

And also, you might succeed if you call the apt once.

  sudo apt-get install -y gcc-4.8

And it will automatically install it, and if it sees that it also need dependency, it'll install it for you. You dont have to worry about dependency at all as apt-get is doing that work for you.

That output of yours after an attempt to install - it is saying that you tried to install two apps but both of apps conflict with each other which thus is an 'impossible situation'. Just use one apt like gcc-4.8, and it'll take care of itself on own as per dependency issue.

EDIT: Try

     sudo apt-get -y dist-upgrade
share|improve this answer
    
Still doesn't work- same error :( –  user997112 Dec 12 '13 at 21:39
add comment

Install aptitude with:

sudo apt-get install aptitude

Then:

sudo aptitude install gcc-4.8 g++-4.8

It will say that dependencies are not met. One option is to keep gcc and not install g++, in this case everything else would be fine. Of course this is not what you want, so input a 'n' and press enter to show you are unhappy with this option.

Then it would probably step back and show you another option. In my case, that's to downgrade some packages to an earlier version (compatible with gcc 4.8.1, which is currently in the ppa, rather than 4.8.2, which is the lastest cpp/libstdc++/... version in saucy/main).

Accept this second option with a 'y'.

If you are lucky like me, the installation will proceed without further error messages.

share|improve this answer
    
Except that this option removes half of the libraries and software making system unusable, it's OK. –  polkovnikov.ph Jan 24 at 11:36
add comment

I would use the following:

sudo apt-get autoremove

sudo apt-get -f install gcc-4.8 g++-4.8

Hope it works!

share|improve this answer
add comment

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