3

Looked through a few questions with similar issues and none of the solutions have worked. The issue is:

$ sudo apt-get Install g++
The following packges 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.

From other questions I tried:

  • sudo apt-get update
  • sudo app-get -f Install*
  • sudo apt-cache policy g++-4.8

    g++-4.8:
    Installed: (none)
    Candidate: 4.8.2-19ubuntu1
    Version table:
    4.8.2-19ubuntu1 0
    500 http://ca.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
    

$ sudo apt-get install g++-4.8
The following packages have unmet dependencies:
 g++-4.8 : Depends: gcc-4.8-base (= 4.8.2-19ubuntu1) but 4.8.4-2ubuntu1~14.04 is to be installed
           Depends: gcc-4.8 (= 4.8.2-19ubuntu1) but 4.8.4-2ubuntu1~14.04 is to be installed
           Depends: libstdc++-4.8-dev (= 4.8.2-19ubuntu1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

$ apt-cache policy gcc-4.8-base gcc-4.8 libstdc++-4.8-dev; sudo apt-get install gcc-4.8-base gcc-4.8 libstdc++-4.8-dev
gcc-4.8-base and gcc-4.8 Installed=Candidate
but
libstdc++-4.8-dev:
Installed: (none)
Candidate: 4.8.2-19ubuntu1
Version Table:
4.8.2-19ubuntu1 0
500 http//:archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

I am a completely new to all this, running ubuntu off a flash drive and just need to get g++ installed. Any help would be greatly appreciated.

From suggestions tried:

sudo-apt get install aptitude

lots of errors all saying 'Could not resolve archive.ubuntu.com'

synoname
  • 41
  • 1
  • 5
  • Do you use a PPA? Could you post the content of your /etc/apt/source.list ? – sinclair Jan 21 '16 at 21:20
  • Not sure what PPA is, fairly computer iliterate. How would I find the /etc/apt/source.list? – synoname Jan 21 '16 at 21:29
  • Open a terminal and run the command `cat /etc/apt/sources.list` then put the output here. – sinclair Jan 21 '16 at 21:32
  • deb cdrom:[Ubuntu 14.04.3 LTS_Trusty Tarhr_ -Beta amd64(20150805)]/ trusty main restricted deb http://archive.ubuntu.com/ubuntu/ trusty main restricted>>>deb http://security.ubuntu.com/ubuntu/ trusty-security restricted main>>>>deb http://archive.ubuntu.com/ubuntu/ trusty-updates restricted main – synoname Jan 21 '16 at 21:37
  • Configure the repositories and try to install again: https://help.ubuntu.com/community/Repositories/Ubuntu – sinclair Jan 21 '16 at 21:42
  • 1
    Possible duplicate of [How to install the latest g++(currently 5.1) in Ubuntu(currently 14.04)?](http://askubuntu.com/questions/618474/how-to-install-the-latest-gcurrently-5-1-in-ubuntucurrently-14-04) – sinclair Jan 21 '16 at 21:45
  • ok tried the repositories and still same unmet dependencies issue, also tried unchecking a rechecking the updates tab as suggested somewhere else. – synoname Jan 21 '16 at 21:49
  • have you tried to install g++-5 ? – sinclair Jan 21 '16 at 21:50
  • just looked at that thread and tried it, no luck – synoname Jan 21 '16 at 21:52
  • Try installing it using aptitude. http://askubuntu.com/questions/391070/not-able-to-install-g-in-ubuntu-13-10-because-of-broken-packages – sinclair Jan 21 '16 at 21:57
  • 1
    Please [edit] your question, when you want to add information. Especially file or program output [listings](/editing-help#code) (with the help of the `{}` button in the editor toolbar) are much more readable there and overall it's best to have everything relevant in one place. Also, comments may be deleted for various reasons. – David Foerster Jan 21 '16 at 22:04
  • tried to install aptitude and wouldn't do that, edited post with output – synoname Jan 21 '16 at 22:14
  • 1
    Looks like general network problems or name resolution problems. Check this out: https://www.turnkeylinux.org/forum/support/20090724/fix-apt-get-could-not-resolve-archiveubuntucom – sinclair Jan 21 '16 at 22:16
  • 1
    Possible duplicate of [apt-get update cannot find ubuntu servers](http://askubuntu.com/questions/29071/apt-get-update-cannot-find-ubuntu-servers) – David Foerster Jan 29 '16 at 10:00

1 Answers1

1

Finally got it figured out. Thanks @sinclair

Resolved the network issues with changing my wireless network to another one and then ran sudo apt-get install aptitude then sudo aptitude install build-essentials which initially failed but thru the built in troubleshoot it gave me the option of downgrading and that fixed everything. Now I have the g++ I need.

synoname
  • 41
  • 1
  • 5
  • verified: on LUBUNTU (LTS 20.04), your answer solves problem, albeit used "build-essential" without the "s" at the end. Thank you. – masarapmabuhay Aug 11 '21 at 08:11