如何构建LLVM 7.0.2的Google fork(https://android.googlesource.com/toolchain/llvm,1d739ffb0366421d383e04ff80ec2ee591315116)?构建原始LLVM没有问题。但是运行配置步骤cmake <path/to/llvm/source/root>
会产生很多类似的错误:
...
-- Targeting XCore
-- Clang version: 7.0.0
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG
-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed
CMake Error at tools/clang/tools/diagtool/CMakeLists.txt:14 (target_link_libraries):
The keyword signature for target_link_libraries has already been used with
the target "diagtool". All uses of target_link_libraries with a target
must be either all-keyword or all-plain.
The uses of the keyword signature are here:
* cmake/modules/LLVM-Config.cmake:105 (target_link_libraries)
* cmake/modules/AddLLVM.cmake:771 (target_link_libraries)
CMake Error at tools/clang/tools/driver/CMakeLists.txt:33 (target_link_libraries):
The keyword signature for target_link_libraries has already been used with
the target "clang". All uses of target_link_libraries with a target must
be either all-keyword or all-plain.
The uses of the keyword signature are here:
* cmake/modules/LLVM-Config.cmake:105 (target_link_libraries)
* cmake/modules/AddLLVM.cmake:771 (target_link_libraries)
CMake Error at tools/clang/tools/clang-format/CMakeLists.txt:14 (target_link_libraries):
The keyword signature for target_link_libraries has already been used with
the target "clang-format". All uses of target_link_libraries with a target
must be either all-keyword or all-plain.
The uses of the keyword signature are here:
* cmake/modules/LLVM-Config.cmake:105 (target_link_libraries)
* cmake/modules/AddLLVM.cmake:771 (target_link_libraries)
...
我在Linux Mint 18.2 x86_64计算机上。
编辑:如果我跳过“工具”和“测试”,那么它将起作用。像这样:cmake -G Ninja -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF <src>
。尽管使用ninja
进行构建由于类似的原因而失败,即使我指定了标志也跳过了构建(而不仅仅是配置)“工具”和“测试”,它仍然尝试构建它们:(
答案 0 :(得分:1)
解决了这个问题。检出的代码实际上包含指向与LLVM源相同级别的目录的链接(tools / clang-> ../../clang)。我从以前的一些测试中获得了现有的clang目录,该目录与Google LLVM 7.0.2不兼容。因此,我删除了该目录并下载了相应的clang版本,该版本修复了错误。