gpt4 book ai didi

cmake - 无法解析 : "cl.exe" is not able to compile a simple test program

转载 作者:行者123 更新时间:2023-12-05 05:09:45 25 4
gpt4 key购买 nike

我正在尝试从忍者构建 llvm 源代码。

我正在关注 http://clang.llvm.org/docs/LibASTMatchersTutorial.html指南。

当我尝试在开发人员命令提示符下运行命令时cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra"-DLLVM_BUILD_TESTS=ON

这是抛出错误

-- The C compiler identification is MSVC 19.16.27032.1
-- The CXX compiler identification is MSVC 19.16.27032.1
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- broken
CMake Error at C:/Users/Desktop/clang-llvm/cmake/cmake-3.15.1-win64-x64/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/Users/Desktop/clang-llvm/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Users/Desktop/clang-llvm/ninja/ninja.exe cmTC_2dc03 && [1/2] Building C object CMakeFiles\cmTC_2dc03.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_2dc03.exe
FAILED: cmTC_2dc03.exe
cmd.exe /C "cd . && C:\Users\Desktop\clang-llvm\cmake\cmake-3.15.1-win64-x64\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_2dc03.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx86\x86\link.exe /nologo CMakeFiles\cmTC_2dc03.dir\testCCompiler.c.obj /out:cmTC_2dc03.exe /implib:cmTC_2dc03.lib /pdb:cmTC_2dc03.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
RC Pass 1: command "rc /fo CMakeFiles\cmTC_2dc03.dir/manifest.res CMakeFiles\cmTC_2dc03.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified
ninja: build stopped: subcommand failed.





CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:49 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/Desktop/clang-llvm/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Desktop/clang-llvm/build/CMakeFiles/CMakeError.log".


我试着运行一个程序C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe 没有错误。

请问有解决办法吗?提前谢谢你:)

最佳答案

我遇到了类似的情况,并且能够通过在“Visual Studio 安装程序”中安装另一个 Windows SDK 来修复它。

我刚刚取消选择当前选中的“Windows SDK 10”并选择最新的“Windows 11 SDK”,一切都像以前一样正常。

另见 Linker Tools Error LNK1104 - Microsoft Docs .

但是,我不知道这些背后的原因。如果我没记错的话,几天前我刚刚通过 Visual Studio 安装程序更新了 Visual Studio。

关于cmake - 无法解析 : "cl.exe" is not able to compile a simple test program,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57269635/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com