1

Hi I tried installing gcc-8 and g++-8. It is giving below error

$ sudo apt-get install gcc-8 g++-8 -y

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++-8 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is to be installed
         Depends: libstdc++-8-dev (= 8-20180414-1ubuntu2) but it is not going to be installed
 gcc-8 : Depends: cpp-8 (= 8-20180414-1ubuntu2) but it is not going to be installed
         Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is to be installed
         Depends: libgcc-8-dev (= 8-20180414-1ubuntu2) but it is not going to be installed
         Recommends: libc6-dev (>= 2.13-0ubuntu6) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I tried below ways but giving the same error - Install gcc on ubuntu18

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-8 g++-8
gcc-8 --version

Also tried installing build-essential But was giving same error. Any suggestion or help will be greatly appreciated. Thanks in advance

gcc-8 broken packages bionic arm64

With Aptitude also not installing-

sudo aptitude install gcc-8
The following NEW packages will be installed:
  cpp-8{ab} gcc-8{b} libasan5{ab} libatomic1{ab} libc-dev-bin{a} 
  libc6-dev{ab} libgcc-8-dev{ab} libitm1{ab} liblsan0{ab} libmpx2{ab} 
  libquadmath0{ab} libtsan0{ab} libubsan1{ab} linux-libc-dev{a} 
  manpages-dev{a} 
0 packages upgraded, 15 newly installed, 0 to remove and 0 not upgraded.
Need to get 24.4 MB of archives. After unpacking 99.9 MB will be used.
The following packages have unmet dependencies:
 libmpx2 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed
 libc6-dev : Depends: libc6 (= 2.27-3ubuntu1) but 2.27-3ubuntu1.2 is installed
 cpp-8 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed
 libitm1 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed
 libasan5 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed
 libquadmath0 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed
 libgcc-8-dev : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed
 libtsan0 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed
 libubsan1 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed
 gcc-8 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed
 liblsan0 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed
 libatomic1 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.4.0-1ubuntu1~18.04 is installed
The following actions will resolve these dependencies:

      Keep the following packages at their current version:
1)      cpp-8 [Not Installed]                              
2)      gcc-8 [Not Installed]                              
3)      libasan5 [Not Installed]                           
4)      libatomic1 [Not Installed]                         
5)      libc6-dev [Not Installed]                          
6)      libgcc-8-dev [Not Installed]                       
7)      libitm1 [Not Installed]                            
8)      liblsan0 [Not Installed]                           
9)      libmpx2 [Not Installed]                            
10)     libquadmath0 [Not Installed]                       
11)     libtsan0 [Not Installed]                           
12)     libubsan1 [Not Installed]                          



Accept this solution? [Y/n/q/?] y
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
1
  • Have you run sudo apt-get update before you tried to get any new packages?
    – ubfan1
    Oct 10, 2020 at 16:13

1 Answer 1

0

I am able to install gcc. I am not sure what exact problem but enabling all packages from software & updates resolved the issue, It might help someone.

$ gcc --version
gcc (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I have enabled all the software packages from software & updates. software & update > Ubuntu software tab

Also enabled security update enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .