Broken packages when trying to install clang on Ubuntu 18.04
Matthew Barrera
I tried installing clang on Ubuntu 18.04, but I could not install it. I tried sudo apt install clang and got these results:
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: clang : Depends: clang-6.0 (>= 6.0~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.I read some answers about held packages and tried sudo aptitude install clang, but it also didn't work.
I got the following results:
The following NEW packages will be installed: clang-6.0 lib32gcc1{ab} lib32stdc++6{ab} libc6-i386{a} libclang-common-6.0-dev{a} libclang1-6.0{a} libffi-dev{a} libjsoncpp1{a} libobjc-7-dev{ab} libobjc4{ab} libpython-stdlib{a} libtinfo-dev{ab} llvm-6.0{a} llvm-6.0-dev{a} llvm-6.0-runtime{a} python{a} python-minimal{a} python2.7{ab} python2.7-minimal{ab}
0 packages upgraded, 19 newly installed, 0 to remove and 0 not upgraded.
Need to get 53.4 MB of archives. After unpacking 313 MB will be used.
The following packages have unmet dependencies: lib32stdc++6 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.3.0-6ubuntu1~18.04 is installed libobjc4 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.3.0-6ubuntu1~18.04 is installed python2.7-minimal : Depends: libpython2.7-minimal (= 2.7.15~rc1-1) but 2.7.15~rc1-1ubuntu0.1 is installed python2.7 : Depends: libpython2.7-stdlib (= 2.7.15~rc1-1) but 2.7.15~rc1-1ubuntu0.1 is installed lib32gcc1 : Depends: gcc-8-base (= 8-20180414-1ubuntu2) but 8.3.0-6ubuntu1~18.04 is installed libobjc-7-dev : Depends: gcc-7-base (= 7.3.0-16ubuntu3) but 7.4.0-1ubuntu1~18.04 is installed Depends: libgcc-7-dev (= 7.3.0-16ubuntu3) but 7.4.0-1ubuntu1~18.04 is installed libtinfo-dev : Depends: libtinfo5 (= 6.1-1ubuntu1) but 6.1-1ubuntu1.18.04 is installed
The following actions will resolve these dependencies: Keep the following packages at their current version:
1) clang-6.0 [Not Installed]
2) lib32gcc1 [Not Installed]
3) lib32stdc++6 [Not Installed]
4) libclang-common-6.0-dev [Not Installed]
5) libobjc-7-dev [Not Installed]
6) libobjc4 [Not Installed]
7) libtinfo-dev [Not Installed]
8) llvm-6.0-dev [Not Installed]
9) python [Not Installed]
10) python-minimal [Not Installed]
11) python2.7 [Not Installed]
12) python2.7-minimal [Not Installed] Leave the following dependencies unresolved:
13) python-minimal recommends python
14) python2.7-minimal recommends python2.7
15) clang-6.0 recommends python
16) llvm-6.0 recommends llvm-6.0-dev
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 1 Answer
As indicated here you need to enable the bionic-updates suite in your sources.list
prepend or append the following block to your /etc/apt/sources.list
deb bionic main multiverse restricted universe
deb bionic-security main multiverse restricted universe
deb bionic-updates main multiverse restricted universe
#deb-src bionic main multiverse restricted universe
#deb-src bionic-security main multiverse restricted universe
#deb-src bionic-updates main multiverse restricted universeuncomment the deb-src lines if you want the source code from the repositories, if you need that.
then simply run sudo apt update; sudo apt install clang and you'll be good.