2

Trying to build llvm project LLVM Project with CMake, it gives me an error that I can't solve by my own.

For doing this, I am using an Ubuntu Virtual Machine (version 18.04) and I am trying to build the project with "ninja".

I have tried to build this with the following commands (which the LLVM Builder Guide says to use, https://llvm.org/docs/GettingStarted.html)

git clone https://github.com/llvm/llvm-project.git
cd llvm-project/
mkdir build && cd build
cmake -DLLVM_ENABLE_PROJECTS='all' -DCMAKE_BUILD_TYPE=Release -G 'Ninja' ../llvm

At the last command, I use the first flag to download all the projects and the second because I do not need the Debug tools.

The last command gives me the following error several times with different targets:

CMake Error at /usr/share/cmake-3.10/Modules/ExternalProject.cmake:2759 (get_property):
  get_property could not find TARGET llgo.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/ExternalProject.cmake:3032 (_ep_add_configure_command)
  /home/enrique/Escritorio/llvm-project/llgo/CMakeLists.txt:200 (externalproject_add)
  /home/enrique/Escritorio/llvm-project/llgo/CMakeLists.txt:219 (add_libgo_variant)

And this library error:

-- LLD version: 10.0.0
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find LibEdit (missing: libedit_INCLUDE_DIRS libedit_LIBRARIES)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /home/enrique/Escritorio/llvm-project/lldb/cmake/modules/FindLibEdit.cmake:54 (find_package_handle_standard_args)
  /home/enrique/Escritorio/llvm-project/lldb/cmake/modules/LLDBConfig.cmake:104 (find_package)
  /home/enrique/Escritorio/llvm-project/lldb/CMakeLists.txt:21 (include)


-- Configuring incomplete, errors occurred!
See also "/home/enrique/Escritorio/llvm-project/build/CMakeFiles/CMakeOutput.log".
See also "/home/enrique/Escritorio/llvm-project/build/CMakeFiles/CMakeError.log".
Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
  • How OpenCL (meaning of `opencl` tag) relates to the question? – Tsyvarev Sep 26 '19 at 11:24
  • 2
    The guide doesn't describe `all` is a possible value for `LLVM_ENABLE_PROJECTS` variable. While this value is actually allowed, it, probably, requires some other options to be set. – Tsyvarev Sep 26 '19 at 11:42
  • I used opencl tag because I am using this tool for compiling OpenCL code, I forgot to say that I was trying to install also SPIR-V with LLVM. Also, I have delete the first flag and after reinstalling cmake and the llvm project from their page, it worked. – Enrique González Sep 27 '19 at 16:22
  • On Stack Overflow we use tags for **describe the problem** stated in the question post. If the problem is in building a tool, then **further usage** of that tool needn't to be tagged unless options specific to this usage are used when building the tool itself. In you question(problem) I see no opencl-specific options for build llvm, so `opencl` tag is not needed. I have removed it. – Tsyvarev Sep 27 '19 at 17:13

1 Answers1

1

I had the same issue, tried uninstalling the golang compiler (because I don't need llvm support for go); to no avail. I'm not an LLVM expert so this might not be the canonical solution but here's how I solved it:

I replaced

-DLLVM_ENABLE_PROJECTS='all'

by

-DLLVM_ENABLE_PROJECTS="proj1;proj2;proj3"

where I built the list "proj1;proj2;proj3" by grepping project is enabled$ in cmake output and removed the llgo project. I got a list like:

-- clang project is enabled
-- clang-tools-extra project is enabled
-- compiler-rt project is enabled
-- debuginfo-tests project is enabled
-- libclc project is enabled
-- libcxx project is enabled
-- libcxxabi project is enabled
-- libunwind project is enabled
-- lld project is enabled
-- lldb project is enabled
-- llgo project is enabled
-- openmp project is enabled
-- parallel-libs project is enabled
-- polly project is enabled
-- pstl project is enabled

and then built the following list with some vim macros/whatever you master (note: no llgo in there):

clang;clang-tools-extra;compiler-rt;debuginfo-tests;libclc;libcxx;libcxxabi;libunwind;lld;lldb;openmp;parallel-libs;polly;pstl

Then compiling llvm succeeded \o/

Clément Hurlin
  • 440
  • 3
  • 11