Cmake when building LLVM

╄→гoц情女王★ 提交于 2021-01-28 07:09:35

问题


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

回答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/



来源:https://stackoverflow.com/questions/58115366/cmake-when-building-llvm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!