It seems you can install clang 3.9 on Ubuntu 12.04.
1 - You need to add these repository to your sources.list
file.
deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty main
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty main
# 3.8
deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.8 main
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.8 main
# 3.9
deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main
2- Then you need to add ubuntu-toolchain-r/test
ppa. Because it provides updated libstdc++
required by clang 3.9
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
3 - Now update the repository index
sudo apt-get update
4 - You should now be able to install clang 3.9
sudo apt-get install clang-3.9
Source: http://apt.llvm.org/
If you need help installing package without Internet, use the solutions from this question
Install clang-5 from llvm.org repositores
First, we should add the llvm.org repositories to our sources lists, the line that we should add is:
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main
Open nano and add the above line to this file:
sudo nano /etc/apt/sources.list.d/llvm.list
Add the repository key, it will make apt
able to verify the downloaded packages.
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
After that, update your lists:
sudo apt-get update
Then install clang-5:
sudo apt-get install clang-5.0 lldb-5.0 lld-5.0
It should work.
If you want to get a list of all available packages from this newly added repository:
grep -i package: /var/lib/apt/lists/apt.llvm* | cut -f3 -d: | sort | uniq
It will give you a list like:
clang-5.0
clang-5.0-doc
clang-5.0-examples
libclang-common-5.0-dev
...
You can then install whatever of them you want.
It may help your compile problem
The header file that has been mentioned does not exist in your error: stdarg.h
is a part of libstdc++-5-dev
package.
I've got this package on my machine, so if I run:
aptitude why libstdc++-5-dev
I will get:
i build-essential Depends g++ (>= 4:5.2)
i A g++ Depends g++-5 (>= 5.3.1-3~)
i A g++-5 Depends libstdc++-5-dev (= 5.4.0-6ubuntu1~16.04.4)
So it seems that installing the build-essential
package should solve this error of yours, cause I'm not sure what you've done.
Best Answer
Based on a search at packages.ubuntu.com, it appears that
scan-build
has been split into a separate clang-tools package.More precisely,
clang
is a dependency package that, on 18.04, installsclang-6.0
, whileclang-tools
depends on the correspondingclang-tools-6.0
- which is the actual package that providesscan-tools
for the current version ofclang
.