简体   繁体   English

无法使用Visual Studio 2015在Windows 10上构建LLVM

[英]Cannot build LLVM on Windows 10 using Visual Studio 2015

I'm trying to install LLVM on Windows 10 using Visual Studio, using the guide http://llvm.org/docs/GettingStartedVS.html , but I'm getting errors: 我正在尝试使用指南http://llvm.org/docs/GettingStartedVS.html在Windows 10上使用Visual Studio安装LLVM,但出现错误:

Here is my view in CMake GUI, where I've directed it to use the C++ compiler C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe . 这是我在CMake GUI中的视图,我已指示它使用C ++编译器C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe

I've already created a new directory called llvm for the build, since I cannot build in the source directory. 我已经为构建创建了一个名为llvm的新目录,因为我无法在源目录中进行构建。

What am I doing wrong? 我究竟做错了什么?

在此处输入图片说明

The configure process displays the following output: 配置过程显示以下输出:

The C compiler identification is unknown
The CXX compiler identification is unknown
The ASM compiler identification is MSVC
Found assembler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
CMake Error at CMakeLists.txt:48 (project):
  No CMAKE_C_COMPILER could be found.



Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
CMake Error: Generator: execution of make failed. Make command was: "MSBuild.exe" "cmTC_c88f4.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=15.0"
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/CMakeTestCXXCompiler.cmake:44 (message):
  The C++ compiler "C:/Program Files (x86)/Microsoft Visual Studio
  14.0/VC/bin/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: C:/dev/llvm/CMakeFiles/CMakeTmp



  Run Build Command:"MSBuild.exe" "cmTC_c88f4.vcxproj"
  "/p:Configuration=Debug" "/p:VisualStudioVersion=15.0"



  Generator: execution of make failed.  Make command was: "MSBuild.exe"
  "cmTC_c88f4.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=15.0"





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


Configuring incomplete, errors occurred!
See also "C:/dev/llvm/CMakeFiles/CMakeOutput.log".
See also "C:/dev/llvm/CMakeFiles/CMakeError.log".

I am working with your same setup(exception being Windows 32-bit), the LLVM version I have chosen is 4.0.0. 我正在使用相同的设置(Windows 32位除外),我选择的LLVM版本是4.0.0。 I followed the tutorial for setting it up with clang. 我按照教程使用clang进行了设置。

I made notes for my entire process. 我记下了整个过程。 Instructions for building LLVM 4.0.0 from source: 从源代码构建LLVM 4.0.0的说明:

  • Create a folder named LLVM in any suitable location. 在任何合适的位置创建一个名为LLVM的文件夹。
  • cd LLVM 光盘LLVM
  • svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
  • cd llvm\\tools cd llvm \\工具
  • svn co http://llvm.org/svn/llvm-project/cfe/trunk clang svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
  • cd .... # going back to where you started cd ....#返回您的起点
  • mkdir build mkdir构建
  • cd build 光盘制作
  • cmake -G "Visual Studio 14" ..\\llvm ##depends on the version of VS you use, I used VS 2015 -> VISUAL STUDIO 14.0 cmake -G“ Visual Studio 14” .. \\ llvm ##取决于您使用的VS版本,我使用VS 2015-> VISUAL STUDIO 14.0
  • If successful, in the build directory you will find LLVM.sln file which can be opened in Visual Studio, once opened, you can navigate through the solution explorer and right click the ALL_BUILD project -> Build. 如果成功,则在构建目录中将找到LLVM.sln文件,该文件可以在Visual Studio中打开,一旦打开,您就可以浏览解决方案资源管理器并右键单击ALL_BUILD项目-> Build。

Notes: 笔记:

  • I'm using Visual Studio 2015 (Update 3) 我正在使用Visual Studio 2015(更新3)
  • I'm using Windows 10 32-bit system 我正在使用Windows 10 32位系统
  • Header files dependencies can be fixed by appending paths to the files where it can be found in the Visual Studio 14.0 folder in Program Files. 通过将路径附加到文件,可以在程序文件的Visual Studio 14.0文件夹中找到文件的路径,从而解决文件头的依赖性。
  • My environment variables for reference: 我的环境变量供参考:

    **INCLUDE=C:\\Program Files\\Microsoft Visual Studio 14.0\\VC\\INCLUDE;C:\\Program Files\\Microsoft Visual Studio 14.0\\VC\\ATLMFC\\INCLUDE;C:\\Program Files\\Windows Kits\\10\\include\\10.0.10240.0\\ucrt;C:\\Program Files\\Windows Kits\\NETFXSDK\\4.6.1\\include\\um;C:\\Program Files\\Windows Kits\\8.1\\include\\shared;C:\\Program Files\\Windows Kits\\8.1\\include\\um;C:\\Program Files\\Windows Kits\\8.1\\include\\winrt; ** INCLUDE = C:\\ Program Files \\ Microsoft Visual Studio 14.0 \\ VC \\ INCLUDE; C:\\ Program Files \\ Microsoft Visual Studio 14.0 \\ VC \\ ATLMFC \\ INCLUDE; C:\\ Program Files \\ Windows Kits \\ 10 \\ include \\ 10.0 .10240.0 \\ ucrt; C:\\ Program Files \\ Windows Kits \\ NETFXSDK \\ 4.6.1 \\ include \\ um; C:\\ Program Files \\ Windows Kits \\ 8.1 \\ include \\ shared; C:\\ Program Files \\ Windows Kits \\ 8.1 \\ include \\ um; C:\\ Program Files \\ Windows Kits \\ 8.1 \\ include \\ winrt;

    **LIBPATH=C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;C:\\Program Files\\Microsoft Visual Studio 14.0\\VC\\LIB;C:\\Program Files\\Microsoft Visual Studio 14.0\\VC\\ATLMFC\\LIB;C:\\Program Files\\Windows Kits\\8.1\\References\\CommonConfiguration\\Neutral;\\Microsoft.VCLibs\\14.0\\References\\CommonConfiguration\\neutral; ** LIBPATH = C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319; C:\\ Program Files \\ Microsoft Visual Studio 14.0 \\ VC \\ LIB; C:\\ Program Files \\ Microsoft Visual Studio 14.0 \\ VC \\ ATLMFC \\ LIB ; C:\\ Program Files \\ Windows Kits \\ 8.1 \\ References \\ CommonConfiguration \\ Neutral; \\ Microsoft.VCLibs \\ 14.0 \\ References \\ CommonConfiguration \\ neutral;

  • Set the PATH enviroment variable for llvm tools like clang, llc, lli, etc., if they're not recognized on developer command prompt. 如果在开发人员命令提示符下无法识别llvm工具(如clang,llc,lli等),请设置PATH环境变量。

  • You may also find executables like clang and clang++ missing from the build when downloading from the github. 从github下载时,您可能还会发现生成中缺少clang和clang ++之类的可执行文件。 I copied these from the prebuilt binaries which I had downloaded for windows which can be found on the LLVM releases page. 我从为Windows下载的预构建二进制文件中复制了这些文件,这些文件可以在LLVM版本页面上找到。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM