我正在尝试使用LLVM构建玩具编译器,并希望使用CMake作为构建系统。我尝试使用LLVM网站上的示例CMakeLists.txt, 但在运行cmake
时遇到以下错误:
CMake Error at /usr/share/llvm-3.8/cmake/LLVMConfig.cmake:178 (include):
include could not find load file:
/usr/share/llvm/cmake/LLVMExports.cmake
Call Stack (most recent call first):
CMakeLists.txt:4 (find_package)
CMake Error at /usr/share/llvm-3.8/cmake/LLVMConfig.cmake:181 (include):
include could not find load file:
/usr/share/llvm/cmake/LLVM-Config.cmake
Call Stack (most recent call first):
CMakeLists.txt:4 (find_package)
当我去调查这个问题时,我发现我的系统上的路径实际上是
/usr/share/llvm-3.8/
。当我尝试将路径更改为它期望的 /usr/share/llvm/
时,我收到了另一个错误:CMake Error at /usr/share/llvm/cmake/LLVMExports.cmake:1034 (message):
The imported target "LLVMSupport" references the file
"/usr/lib/libLLVMSupport.a"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/share/llvm/cmake/LLVMExports.cmake"
but not all the files it references.
我不是一个关于CMake如何工作的专家,所以我不确定该从哪里开始。我正在运行Ubuntu 16.04,并尝试通过各种不同的包安装LLVM,但结果都相同。这是Ubuntu打包系统的问题,还是我可以修复的问题?
/usr/share/llvm-3.8
下的文件想要包含一个没有版本后缀的文件,位于/usr/share/llvm/
下时,对于我来说,这个文件似乎有99%的问题。请注意,用于find_package()
的文件大多数不可重定位。您安装了哪些确切的llvm软件包?哪个软件包包含/usr/share/llvm-3.8/cmake/LLVMConfig.cmake
和/usr/share/llvm/cmake/LLVMExports.cmake
文件? - Tsyvarev