Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 如何在windows中设置llvm/clang?_Visual Studio_Cmake_Llvm_Llvm Clang - Fatal编程技术网

Visual studio 如何在windows中设置llvm/clang?

Visual studio 如何在windows中设置llvm/clang?,visual-studio,cmake,llvm,llvm-clang,Visual Studio,Cmake,Llvm,Llvm Clang,我正在尝试使用cmake和clang/llvm为cortex-m embeddedµController设置编译器工具链 我将llvm项目repo从git下载到一个文件夹中,我希望运行cmake,以便能够在VisualStudio中编译工具链,如前所述。我使用的是Visual Studio 2019社区版16.4.5 我键入的cmd.exe中的命令是: D:\GitRepos\llvm-project\llvm>cmake -G"Visual Studio 16 2019" -DLLVM_

我正在尝试使用cmake和clang/llvm为cortex-m embeddedµController设置编译器工具链

我将llvm项目repo从git下载到一个文件夹中,我希望运行cmake,以便能够在VisualStudio中编译工具链,如前所述。我使用的是Visual Studio 2019社区版16.4.5

我键入的cmd.exe中的命令是:

D:\GitRepos\llvm-project\llvm>cmake -G"Visual Studio 16 2019" -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libcxx;libcxxabi;libunwind;lldb;compiler-rt;lld;polly" -DCMAKE_INSTALL_PREFIX="C:/llvmTools" -DCMAKE_BUILD_TYPE=Release ../llvm -Thost=x64
但我得到了以下失败:

D:\GitRepos\llvm-project\llvm>cmake -G"Visual Studio 16 2019" -DLLVM_ENABLE_PROJECTS="clang;clang-
tools-extra;libcxx;libcxxabi;libunwind;lldb;compiler-rt;lld;polly" -DCMAKE_INSTALL_PREFIX="C:/llvmTools" -DCMAKE_BUILD_TYPE=Release ../llvm -Thost=x64
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
-- The C compiler identification is MSVC 19.24.28316.0
-- The CXX compiler identification is MSVC 19.24.28316.0
-- The ASM compiler identification is MSVC
-- Found assembler: C:/Program Files (x86)/Microsoft Visual
Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- clang project is enabled
-- clang-tools-extra project is enabled
-- compiler-rt project is enabled
-- debuginfo-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- libcxx project is enabled
-- libcxxabi project is enabled
-- libunwind project is enabled
-- lld project is enabled
-- lldb project is enabled
-- mlir project is disabled
-- openmp project is disabled
-- parallel-libs project is disabled
-- polly project is enabled
-- pstl project is disabled
-- Could NOT find Z3: Found unsuitable version "0.0.0", but required is at least "4.7.1" (found Z3_LIBRARIES-NOTFOUND)
CMake Error at cmake/modules/CheckCompilerVersion.cmake:62 (message):
  Host Visual Studio version 16.4 is known to miscompile part of LLVM, please
  use clang-cl or upgrade to 16.5 or above (use
  -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON to ignore)
Call Stack (most recent call first):
  cmake/config-ix.cmake:13 (include)
  CMakeLists.txt:629 (include)


-- Configuring incomplete, errors occurred!
See also "D:/GitRepos/llvm-project/llvm/CMakeFiles/CMakeOutput.log".
See also "D:/GitRepos/llvm-project/llvm/CMakeFiles/CMakeError.log".
当我在Visual Studio中直接打开llvm项目文件夹时,我会看到另一个失败日志:

CMake generation started for configuration: 'x64-Debug'.
1> Command line: "cmd.exe" /c ""C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="D:\GitRepos\llvm-project\clang\out\install\x64-Debug" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe"  -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "D:\GitRepos\llvm-project\clang" 2>&1"
1> Working directory: D:\GitRepos\llvm-project\clang\out\build\x64-Debug
1> [CMake] -- The C compiler identification is MSVC 19.24.28316.0
1> [CMake] -- The CXX compiler identification is MSVC 19.24.28316.0
1> [CMake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe
1> [CMake] -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe -- works
1> [CMake] -- Detecting C compiler ABI info
1> [CMake] -- Detecting C compiler ABI info - done
1> [CMake] -- Detecting C compile features
1> [CMake] -- Detecting C compile features - done
1> [CMake] -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe
1> [CMake] -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe -- works
1> [CMake] -- Detecting CXX compiler ABI info
1> [CMake] -- Detecting CXX compiler ABI info - done
1> [CMake] -- Detecting CXX compile features
1> [CMake] -- Detecting CXX compile features - done
1> [CMake] CMake Error at D:\GitRepos\llvm-project\clang\CMakeLists.txt:66 (find_package):
1> [CMake]   Could not find a package configuration file provided by "LLVM" with any of
1> [CMake]   the following names:
1> [CMake] 
1> [CMake]     LLVMConfig.cmake
1> [CMake]     llvm-config.cmake
1> [CMake] 
1> [CMake]   Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
1> [CMake]   "LLVM_DIR" to a directory containing one of the above files.  If "LLVM"
1> [CMake]   provides a separate development package or SDK, be sure it has been
1> [CMake]   installed.
1> [CMake] 
1> [CMake] 
1> [CMake] -- Configuring incomplete, errors occurred!
1> [CMake] See also "D:/GitRepos/llvm-project/clang/out/build/x64-Debug/CMakeFiles/CMakeOutput.log".
1> [CMake] 
1> cmd.exe /c ""C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="D:\GitRepos\llvm-project\clang\out\install\x64-Debug" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/HostX64/x64/cl.exe"  -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" "D:\GitRepos\llvm-project\clang" 2>&1" returned with exit code: 1

有人能告诉我,为什么我会得到两个不同的故障日志以及如何解决它们吗?

在一个命令中,您使用VS2019作为生成器,但在第二个命令中,您使用的是
Ninja
,我认为您不想这样做?您是正确的。在第二个示例中,我只需在windows资源管理器中的文件夹上单击鼠标右键,然后在visual studio中单击“打开”。其他一切都是VisualStudio自己做的,也就是说,他选择了忍者。好的,我负责这件事。但我尝试过,只在VS中打开llvm项目/llvm文件夹,并将生成器更改为Visual Studio,我还收到了与“发现不合适的版本…”相同的消息。VS版本16.4.5是最实际的版本。我今天更新到了最新版本。我有来自git的最新LLVM版本。今天下载。llvm中是否存在错误??您使用
D:\GitRepos\llvm project\clang
作为源目录执行第二次运行。这不是构建llvm的方式。第一次运行正确地使用
D:\GitRepos\llvm project
作为源目录(路径
。/llvm
相对于当前
D:\GitRepos\llvm project\llvm
目录)。注意,与使用新创建的
build
子目录作为构建目录的文档不同,您当前的目录是
llvm
。这很糟糕,因为此目录是项目的一部分。在一个命令中,您使用VS2019作为生成器,但在第二个命令中,您使用的是
Ninja
,我认为您不想这样做?您是正确的。在第二个示例中,我只需在windows资源管理器中的文件夹上单击鼠标右键,然后在visual studio中单击“打开”。其他一切都是VisualStudio自己做的,也就是说,他选择了忍者。好的,我负责这件事。但我尝试过,只在VS中打开llvm项目/llvm文件夹,并将生成器更改为Visual Studio,我还收到了与“发现不合适的版本…”相同的消息。VS版本16.4.5是最实际的版本。我今天更新到了最新版本。我有来自git的最新LLVM版本。今天下载。llvm中是否存在错误??您使用
D:\GitRepos\llvm project\clang
作为源目录执行第二次运行。这不是构建llvm的方式。第一次运行正确地使用
D:\GitRepos\llvm project
作为源目录(路径
。/llvm
相对于当前
D:\GitRepos\llvm project\llvm
目录)。注意,与使用新创建的
build
子目录作为构建目录的文档不同,您当前的目录是
llvm
。这很糟糕,因为此目录是项目的一部分。