在入门llvm的时候碰倒了各种错误,记录一下,也为其他人提供参考
环境:
主机WIN10+虚拟机vmware + ubuntu18.04 amd架构
ll@ubuntu:~/src/llvm-project-main/build$ cmake -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../llvm
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:49 (project):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
我初次装cmake需要安装g++,那就安装把
sudo apt-get install g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
g++ : Depends: g++-7 (>= 7.3.0-12~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
安装失败,g++依赖g++ - 7,那再安装g++ - 7
sudo apt-get install g++-7
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
g++-7 : Depends: gcc-7-base (= 7.3.0-16ubuntu3) but 7.5.0-3ubuntu1~18.04 is to be installed
Depends: gcc-7 (= 7.3.0-16ubuntu3) but 7.5.0-3ubuntu1~18.04 is to be installed
Depends: libstdc++-7-dev (= 7.3.0-16ubuntu3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages
·g++-7
又依赖这些东西,这些东西安装不了,因为系统本身已经安装了这些包,导致版本不兼容,我的解决方案就是把他们全都卸载掉,重新让apt自己安装。
sudo apt-get remove gcc-7
sudo apt-get remove libstdc++-7-dev
sudo apt-get remove gcc-7-base
再次安装g++
sudo apt-get install g++
这时apt会自己找兼容的版本,,也可以先配置一个国内的源,要不安装的时候会有点慢。