windows/Win10 vs2017 编译 llvm clang

一,下载源代码

        方法一:根据官方文档,使用git 下载;

        方法二:到github上去下载压缩好的release代码 SourceCode.zip

                       https://github.com/llvm/llvm-project/releases/tag/llvmorg-12.0.0

                文档导航到:https://releases.llvm.org/12.0.0/docs/index.html

                

二,编译

       Windows机器的内存最好大于8GB,剩余硬盘最好大于20GB

        根据官网文档编译:        https://clang.llvm.org/get_started.html

       

        摘录windows部分如下:

 

    Using Visual Studio

     The following details setting up for and building Clang on Windows using Visual Studio:

  1. Get the required tools:
    • Git. Source code control program. Get it from: https://git-scm.com/download
    • CMake. This is used for generating Visual Studio solution and project files. Get it from: https://cmake.org/download/
    • Visual Studio 2017 or later
    • Python. It is used to run the clang test suite. Get it from: https://www.python.org/download/
    • GnuWin32 tools The Clang and LLVM test suite use various GNU core utilities, such as grep, sed, and find. The gnuwin32 packages are the oldest and most well-tested way to get these tools. However, the MSys utilities provided by git for Windows have been known to work. Cygwin has worked in the past, but is not well tested. If you don't already have the core utilies from some other source, get gnuwin32 from http://getgnuwin32.sourceforge.net/.
  2. Check out LLVM and Clang:
    • git clone https://github.com/llvm/llvm-project.git

    Note: Some Clang tests are sensitive to the line endings. Ensure that checking out the files does not convert LF line endings to CR+LF. If you're using git on Windows, make sure your core.autocrlf setting is false.

  3. Run CMake to generate the Visual Studio solution and project files:
    • cd llvm-project
    • mkdir build (for building without polluting the source dir)
    • cd build
    • If you are using Visual Studio 2017: cmake -DLLVM_ENABLE_PROJECTS=clang -G "Visual Studio 15 2017" -A x64 -Thost=x64 ..\llvm
      -Thost=x64 is required, since the 32-bit linker will run out of memory.
    • To generate x86 binaries instead of x64, pass -A Win32.
    • See the LLVM CMake guide for more information on other configuration options for CMake.
    • The above, if successful, will have created an LLVM.sln file in the build directory.
  4. Build Clang:
    • Open LLVM.sln in Visual Studio.
    • Build the "clang" project for just the compiler driver and front end, or the "ALL_BUILD" project to build everything, including tools.
  5. Try it out (assuming you added llvm/debug/bin to your path). (See the running examples from above.)
  6. See Hacking on clang - Testing using Visual Studio on Windows for information on running regression tests on Windows.

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值