Home | News | Documentation | Download

Compiling ROOT 6.24 with external llvm but built-in clang

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.24.00
Platform: x86_64-linux
Compiler: gcc 10.3

Dear experts,

I’m trying to build ROOT 6.24.00 with external llvm library. Naively I disable the built-in llvm with:


But I got the following error:

-- Using LLVM external library - 9.0.1
-- Clang version: 9.0.1
CMake Error at /nix/store/i2als7skhvbyjw9i79p9mfqkjypd56ck-llvm-9.0.1-dev/lib/cmake/llvm/AddLLVM.cmake:637 (add_custom_target):
  add_custom_target cannot create target "install-clang-cpp" because another
  target with the same name already exists.  The existing target is a custom
  target created in source directory
  "/build/root-6.24.00/interpreter/llvm/src/tools/clang/tools/driver".  See
  documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  interpreter/llvm/src/tools/clang/cmake/modules/AddClang.cmake:117 (add_llvm_install_targets)
  interpreter/llvm/src/tools/clang/tools/clang-shlib/CMakeLists.txt:18 (add_clang_library)

CMake Error at interpreter/CMakeLists.txt:452 (get_directory_property):
  get_directory_property DIRECTORY argument provided but requested directory
  not found.  This could be because the directory argument was invalid or, it
  is valid but has not been processed yet.

CMake log and errors are attached:
CMakeError.txt (18.1 KB)
CMakeOutput.txt (371.7 KB)

The full std output of CMake is also attached (with minor nix build system info/pollution):
cmake_std_out.txt (15.5 KB)

We recommend (and only support) if you would like to build external LLVM - use external Clang as well. You can’t use any LLVM/Clang build but only special patched LLVM/Clang 9 version.

cc: @vvassilev

For some reason ROOT still has this: root/CMakeLists.txt at 941e9dbb70b7a94d974cf7c249e1fc992f03ebb4 · root-project/root · GitHub

cc @Axel

@veprbl if you want to build external LLVM/Clang you need to use special repository with root-specific patches. If anybody interested we can post here coordinates of both repositories…

Just to make it clear, we are talking about an out of tree builds, meaning we first build and install llvm, then build and install clang and only then cling/root. So far we’ve only been able to split llvm, but cling seems to need to be built from the clang tree. For example, this is how we do it for standalone cling: cling/default.nix

If anybody interested we can post here coordinates of both repositories…

I assume that’s what is documented on Cling Build Instructions - ROOT ?

Yes indeed.

We decided to use the bundled llvm+clang combo (at least for now). Thanks for all the tips.