构建LLVM时的CMake [英] Cmake when building LLVM

查看:179
本文介绍了构建LLVM时的CMake的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用CMake构建llvm项目LLVM项目,这给了我自己无法解决的错误.

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

为此,我正在使用Ubuntu虚拟机(版本18.04),并且尝试使用"ninja"构建项目.

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

我尝试使用以下命令(《 LLVM生成器指南》说的 https来构建此命令)://llvm.org/docs/GettingStarted.html )

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)

此库错误:

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

推荐答案

我遇到了相同的问题,尝试卸载golang编译器(因为我不需要go的llvm支持);无济于事.我不是LLVM专家,所以这可能不是规范的解决方案,但是这是我解决的方法:

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:

我替换了

-DLLVM_ENABLE_PROJECTS ='全部'

-DLLVM_ENABLE_PROJECTS='all'

作者

-DLLVM_ENABLE_PROJECTS ="proj1; proj2; proj3"

-DLLVM_ENABLE_PROJECTS="proj1;proj2;proj3"

在其中我通过在 cmake 输出中grepping project is enabled $ 来构建列表"proj1; proj2; proj3",并删除了llgo项目.我有一个像这样的列表:

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

,然后用一些vim宏/无论您要掌握的内容构建以下列表(注意:其中没有 llgo ):

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

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

然后编译llvm成功\ o/

Then compiling llvm succeeded \o/

这篇关于构建LLVM时的CMake的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆