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