-1

I cannot install g++ on newly installed ubuntu 14.04.4 LTS.

When I use command sudo apt-get install g++, the terminal tell me:

cluster@cluster0-vm:~$ sudo apt-get install g++
[sudo] password for cluster: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
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:
 g++ : Depends: g++-4.8 (>= 4.8.2-5~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I changed the source, and tried again, failed too.

cluster@cluster0-vm:~$ sudo apt-get install g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
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:
 g++:i386 : Depends: cpp:i386 (>= 4:4.7.3-1ubuntu10) but it is not going to be installed
            Depends: gcc:i386 (>= 4:4.7.3-1ubuntu10) but it is not going to be installed
            Depends: g++-4.7:i386 (>= 4.7.3-1~) but it is not going to be installed
            Depends: gcc-4.7:i386 (>= 4.7.3-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I used the ubuntu software center to install g++, failed again...... Figure: Use ubuntu software center to install g++

This problem has been solved by changing another source.

I have tried 4 sources, and all of them have problems......OMG!

Oscar LT
  • 787
  • 1
  • 4
  • 24
xysmlx
  • 1
  • 3

2 Answers2

1

I think this will help:

sudo apt-get update
sudo apt-get -f install
sudo dpkg --configure -a
sudo apt-get clean
sudo apt-get install g++

Also this could help:

sudo dpkg --purge g++# Try this first
sudo dpkg --purge --force-depends g++# Try this ONLY if the previous line fails
sudo apt-get clean g++# Remove g++ from the cache
sudo apt-get install g++# Download and install the appropriate version of g++
alexey
  • 1,381
  • 9
  • 19
  • still the same errors...But this problem has been solved by changing another source......(I have tried 4 sources, and all of them have problems......) Thanks for your answer. – xysmlx Mar 11 '16 at 09:22
0

If I had to guess, I would say there are other libc6, libc-dev, etc..files that need updating before you can update the C's and G's. It seems that if you install build essentials then it will correct the problem.

If you look up the files on the ubuntu packages site and look at the dependencies, then compare them to what is on your machine, I bet you find you have an update conflict due to incompatible dependency version somewhere.

You could manually download them individually at the bottom of the repository page (a small table) then double click the deb files and they will start to install if all of the dependencies and versions are met and compatible.

Think of it as "A depends on B which depends on C which depends on D......" being installed. to some infinity no avail. Its a nightmare when doing it that way. But does force you to respect Synaptic and the apt-get thorough and detailed process and compatibility check.

Best to start with build essentials though.

BobDCoder
  • 341
  • 2
  • 6