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'

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.

  • 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