LLVM 安裝教程python
環境:ubuntu16.04 llvm-4.0 clang-4.0git
步驟:ubuntu
1.依賴庫安裝bash
$ sudo apt-get install build-essential curl libcap-dev git cmake libncurses5-dev python-minimal python-pip unzipcurl
2.安裝LLVM 須要注意:測試
對於不一樣版本的ubuntu應該到 LLVM Package Repository 找到對應版本的。寫入source.list 中。ui
以16.04 爲例:url
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 maines5
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 mainspa
添加repository key並下載llvm 3.9的packages
$ wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install clang-4.0 libclang-common-4.0-dev libclang-4.0-dev libclang1-4.0 libclang1-4.0-dbg libllvm-4.0-ocaml-dev libllvm4.0 libllvm4.0-dbg lldb-4.0 llvm-4.0 llvm-4.0-dev llvm-4.0-runtime clang-format-4.0 python-clang-4.0 libfuzzer-4.0-dev
注意這個時候/usr/bin/clang-4.0是在PATH裏面,爲了使用clang以及其餘不帶4.0後綴的版本 ,須要在~/.bashrc裏面改一下PATH:(注意不要在命令行中配置,不然每次開機都得配置一遍)
export PATH="/usr/lib/llvm-4.0/bin:$PATH"
至此,已經能夠使用clang進行測試。
這裏有個問題,若是出現如下錯誤,是libwinpr-synch0.1在上次安裝過程當中失敗的緣由,須要從新安裝。
dpkg: error processing package libwinpr-synch0.1:amd64 (--configure):
package libwinpr-synch0.1:amd64 is not ready for configuration
從新安裝使用如下命令:
sudo apt-get --reinstall install libwinpr-synch0.1
若是sources.list一直不能更新的話,替換原來的源,將其改成aliyun(親測可行)。
使用點sources.list文件以下:
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
#deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
#deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
# 4.0
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main