1

I need to add the following repo in ubuntu 16.04:

deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty main

I attempted to add that repo by typing following command:

sudo add-apt-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty main"

I want to add that repo because I want to install packages from there.

I see that after the add-apt-repository command there is an entry added in /etc/apt/sources.list

but when I am trying to install the package using sudo apt-get install clang-3.4 I still get error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package clang-3.4 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'clang-3.4' has no installation candidate

1 Answers1

1
  1. Remove the trusty repository that you mistakenly added to Ubuntu 16.04. This incompatible repository is causing NO_PUBKEY errors when you try to update with sudo apt update, and there is a xenial clang 3.4 package available at http://launchpadlibrarian.net/, so you should install the xenial clang 3.4 package instead of the trusty package.

     sudo add-apt-repository --remove "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty main"  
     sudo apt update  
     sudo apt remove clang-3.4 
    
  2. Download clang-3.4_3.4.2-16ubuntu3_amd64.deb for Ubuntu 16.04 from http://launchpadlibrarian.net/.

    cd Desktop/
    wget http://launchpadlibrarian.net/227310349/libllvm3.4_3.4.2-16ubuntu3_amd64.deb http://launchpadlibrarian.net/227310340/libclang-common-3.4-dev_3.4.2-16ubuntu3_amd64.deb http://launchpadlibrarian.net/227310332/clang-3.4_3.4.2-16ubuntu3_amd64.deb
    
  3. Install clang 3.4 with the following command:

    sudo apt install --no-install-recommends ./libllvm3.4_3.4.2-16ubuntu3_amd64.deb ./libclang-common-3.4-dev_3.4.2-16ubuntu3_amd64.deb ./clang-3.4_3.4.2-16ubuntu3_amd64.deb
    
karel
  • 122,292
  • 133
  • 301
  • 332