jozols
jozols

Reputation: 592

Building Google LLVM 7.0.2

How to build Google fork of LLVM 7.0.2 (https://android.googlesource.com/toolchain/llvm, 1d739ffb0366421d383e04ff80ec2ee591315116)? I have no problems building original LLVM. But running configuration step cmake <path/to/llvm/source/root> produces lot of similar errors:

...
-- 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)
 ...

I'm on Linux Mint 18.2, x86_64 machine.

EDIT: If I skip "tools" and "tests" then it works. Like this: cmake -G Ninja -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF <src>. Though build with ninja fails for similar reason even though I specified flags to also skip building (not just configuring) "tools" and "tests" - it tries to build them anyway :(

Upvotes: 1

Views: 230

Answers (1)

jozols
jozols

Reputation: 592

Solved this. Checked out code actually contained link (tools/clang -> ../../clang) to same level directory as LLVM source. I had existing clang directory there from some previous tests which was incompatible with Google LLVM 7.0.2. So I removed this directory and downloaded corresponding clang version which fixed errors.

Upvotes: 1

Related Questions