-
Notifications
You must be signed in to change notification settings - Fork 26
Build LLVM from source code on Windows 10
You may have installed LLVM by installing the package LLVM-13.0.1-win64.exe
or executing the command choco install llvm
.
But LLVM installed in these ways is not a complete LLVM, missing many library files and cmake files.
It's recommended to install LLVM by building from source code.
You need to install some tools before building LLVM source code.
You can refer to https://docs.microsoft.com/en-us/visualstudio/install/install-visual-studio?view=vs-2022 for more details.
Please be sure to choose the Desktop development with C++ workload, otherwise you will not be able to build LLVM.
- CMake
- Python
- Git
Please install the latest version of these software as much as possible.
In addition, you may need to configure environment variables for them to ensure that they can be used directly in the terminal.
First, you need to download llvm-13.0.1.src.tar.xz, and unzip it to a specific directory, assuming C:\Users\dev\llvm-13.0.1.src
.
Then, execute the following command to build LLVM.
# enter the source directory
cd C:\Users\dev\llvm-13.0.1.src
# create build directory
mkdir build
# enter the build directory
cd build
# configure projects by cmake
cmake -Thost=x64 -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_INCLUDE_TESTS=OFF ..
# start building
cmake --build . --config Release
Finally, after compilation, the built LLVM will be located on C:\Users\dev\llvm-13.0.1.src\build
.