LLVM 在 Windows 上构建:跳过 Visual Studio cl.exe [重复]
Posted
技术标签:
【中文标题】LLVM 在 Windows 上构建:跳过 Visual Studio cl.exe [重复]【英文标题】:LLVM build on Windows: Visual Studio cl.exe skipped [duplicate] 【发布时间】:2020-09-03 08:18:24 【问题描述】:我尝试按照http://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm 的指南,使用 Visual Studio 2019 和 CMake 3.18.2 在 Windows 上构建和安装 LLVM 源代码(特别是 LLVM-8,但最新版本也存在问题)。
然而,输出看起来与Building LLVM using Visual Studio 中讨论的相同,但解决方案对我来说没有任何改变。
我运行了以下命令:
git clone --config core.autocrlf=false https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build
cd build
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall" x64
cmake ../llvm -G "Visual Studio 16 2019" -DLLVM_OPTIMIZED_TABLEGEN=TRUE -DLLVM_ENABLE_PROJECTS=clang -Thost=x64
我还尝试了以下方法:
未明确指定生成器(或任何与此相关的 cmake 参数) 使用x64 Native Tools Command Prompt for VS 2019
而不是调用vcvarsall
以管理员身份运行命令提示符/本机工具命令提示符
这是输出的摘录。如您所见,在Check for working C / CXX compiler
的末尾显示skipped
,我怀疑这是问题所在。但未能解决。
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041.
-- The C compiler identification is MSVC 19.27.29111.0
-- The CXX compiler identification is MSVC 19.27.29111.0
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- clang project is enabled
-- clang-tools-extra project is disabled
-- compiler-rt project is disabled
-- debuginfo-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- libcxx project is disabled
-- libcxxabi project is disabled
-- libunwind project is disabled
-- lld project is disabled
-- lldb project is disabled
-- mlir project is disabled
-- openmp project is disabled
-- parallel-libs project is disabled
-- polly project is disabled
-- pstl project is disabled
-- flang project is disabled
-- Looking for dlfcn.h
-- Looking for dlfcn.h - not found
-- Looking for errno.h
-- Looking for errno.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for link.h
-- Looking for link.h - not found
-- Looking for malloc/malloc.h
-- Looking for malloc/malloc.h - not found
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for sys/ioctl.h
-- Looking for sys/ioctl.h - not found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - not found
-- Looking for sys/param.h
-- Looking for sys/param.h - not found
-- Looking for sys/resource.h
-- Looking for sys/resource.h - not found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sysexits.h
-- Looking for sysexits.h - not found
-- Looking for termios.h
-- Looking for termios.h - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for valgrind/valgrind.h
-- Looking for valgrind/valgrind.h - not found
-- Looking for fenv.h
-- Looking for fenv.h - found
-- Looking for FE_ALL_EXCEPT
-- Looking for FE_ALL_EXCEPT - found
-- Looking for FE_INEXACT
-- Looking for FE_INEXACT - found
-- Looking for mach/mach.h
-- Looking for mach/mach.h - not found
-- Looking for histedit.h
-- Looking for histedit.h - not found
-- Looking for CrashReporterClient.h
-- Looking for CrashReporterClient.h - not found
-- Looking for pfm_initialize in pfm
-- Looking for pfm_initialize in pfm - not found
【问题讨论】:
就其本身而言,skipped
不是错误指示器。这样配置后构建项目的时候有没有报错?
不,它构建成功。但尤其是过多的“未找到”警告让我想知道这对构建有何影响,即使它成功了。
“未找到”消息不是警告。可以在一个系统上实现的文件不能在您的系统上使用,这只是一个事实。例如。已知dlfcn.h
标头is absent on Windows。 The same 大约是 unistd.h
。如果您想知道为什么“找不到”特定头文件,请询问(但请务必在询问之前进行搜索)。
我明白了,所以我误解了这些消息。
这能回答你的问题吗? Check for working C compiler: "cl.exe - skipped" : Visual Studio 2019
【参考方案1】:
我最近在 VS 2019 中使用 clang-cl
工具集构建了它。我记得,其他 VS 工具集仍然存在问题。
CMakeSettings.json
:
"configurations": [
"name": "x64-Clang-Release",
"generator": "Ninja",
"configurationType": "Release",
"buildRoot": "$projectDir\\..\\_build\\$name",
"installRoot": "$projectDir\\..\\_install",
"cmakeCommandArgs": "-DLLVM_ENABLE_PROJECTS=\"clang\"",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64" ],
"variables": []
]
【讨论】:
以上是关于LLVM 在 Windows 上构建:跳过 Visual Studio cl.exe [重复]的主要内容,如果未能解决你的问题,请参考以下文章
如何在 Windows 上使用 MINGW 构建 clang?
使用 LLVM 在 Windows 上使用 QtCreator 设置 Cocos2dx 项目
在 Ubuntu 16.04 上构建 LLVM 6 主干不构建 lld