一、添加源:
根据官方页面提示,找到系统分类,ubuntu 18.04 源:
-
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic main # Needs 'sudo add-apt-repository ppa:ubuntu-toolchain-r/test' for libstdc++ with C++20 support # 15 deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-15 main deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-15 main # 16 deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-16 main deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-16 main
将内容添加到 /etc/apt/sources.list 文件末尾。
二、添加密钥
密钥的目的时让系统确定,此来源是一个合法的来源(ubuntu 系统在18版本添加的要求)
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
三、安装
sudo apt-get install clang-10 lldb-10 lld-10
四、添加软链接
默认使用的文件是不带版本号的,安装的文件是带版本号的,使用软件,防止编译时找不到
cd /usr/bin/ && sudo ln -s ../lib/llvm-10/bin/llvm-nm llvm-nm cd /usr/bin/ && sudo ln -s ../lib/llvm-10/bin/llvm-ar llvm-ar cd /usr/bin/ && sudo ln -s ../lib/llvm-10/bin/ld.lld ld.lld
错误提示:
提示:llvm-nm: not found
解决方法:cd /usr/bin && ln -s ../lib/llvm-10/bin/llvm-nm llvm-nm
提示:/bin/sh: 1: llvm-ar: not found
解决方法:cd /usr/bin/ && sudo ln -s ../lib/llvm-10/bin/llvm-ar llvm-ar
提示:/bin/sh: 1: ld.lld: not found
解决方法:cd /usr/bin/ && sudo ln -s ../lib/llvm-10/bin/ld.lld ld.lld
---
来源:
https://blog.deskangel.com/2020/05/13/install-clang-on-ubuntu/
-
标签:bin,10,llvm,apt,clang,bionic,org,Ubuntu18.04,安装 From: https://www.cnblogs.com/wutou/p/17428214.html