ubuntu 下 clang最新的安装方法已经绑定命令

- 介绍

  • 场景:折腾atom,遇到其中插件autocomplete-clang 无法正常工作.
  • 原因&分析:先下的clang 5.0结果要在终端下要这样clang-5.0 才可以调用,如果修改atom插件配置,会报string错误,估计只能识别clang命令.

- 解决办法

  • 先更新下软件库并安装库中的老版本(clang3.8)
    • sudo apt-get update
    • sudo apt-get install clang
  • 在安装新版本的clang(5.0)
    • sudo apt-get update
    • sudo apt-get install clang-5.0
  • 接下来按下文修改系统默认行为的命令按提示执行即可

Making latest version available as clang
This version is installed side-by-side with the default clang 3.8. To run it, you have to explicitly say clang-5.0. clang will either refer to 3.8 (if you’ve installed it) or nothing at all.

You can reconfigure the system so that clang refers to clang 5:

sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-5.0 1000
sudo update-alternatives --install /usr/bin/clang++ clang /usr/bin/clang-3.8 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 1000
sudo update-alternatives --config clang
sudo update-alternatives --config clang++

This might help if you have scripts that hard-code name of the compiler and don’t allow over-writing it.

https://blog.kowalczyk.info/article/k/how-to-install-latest-clang-5.0-on-ubuntu-16.04-xenial-wsl.html

你可能感兴趣的:(个人笔记,Linux∷Ubuntu)