To build everything, do this:

$ git clone --depth 1 --branch llvmorg-19.1.0 https://github.com/llvm/llvm-project.git
$ cmake -S llvm-project/llvm -B llvm-project/build \
        -DCMAKE_BUILD_TYPE=Release \
        -DLLVM_ENABLE_PROJECTS=all \
        -DLLVM_ENABLE_RUNTIMES=all
$ cmake --build llvm-project/build -j8
$ cmake --install llvm-project/build --prefix /usr/local  # or somewhere else

You might also be interested in the following build flags for the first CMake command:

  • -DLLVM_ENABLE_ASSERTIONS=ON -- good for debugging
  • -DLLVM_ENABLE_EH=ON -- enable if your application uses C++ exceptions
  • -DLLVM_ENABLE_RTTI=ON -- enable if your application uses C++ RTTI

Also see the upstream documentation: https://llvm.org/docs/CMake.html


Note that some of the LLVM projects can only be built with clang. I won't get into bootstrapping issues, but if the build fails, you can winnow down the list of projects from all to a subset of the following: clang, clang-tools-extra, cross-project-tests, libc, libclc, lld, lldb, openmp, polly, and pstl.

You can also reduce the list of runtimes to a subset of compiler-rt, libc, libcxx, libcxxabi, libunwind, and openmp.

Note that LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES should not overlap. The latter builds each target with the just-built clang.

Answer from Alex Reinking on Stack Overflow
🌐
LLVM
llvm.org › docs › GettingStarted.html
Getting Started with the LLVM System — LLVM 23.0.0git documentation
This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode – and from there into object files, using LLVM. Other components include: the libc++ C++ standard library, the LLD linker, and more. Check out LLVM (including subprojects like Clang): git clone ...
🌐
Arthur O’Dwyer
quuxplusone.github.io › blog › 2018 › 04 › 16 › building-llvm-from-source
How to build LLVM from source – Arthur O'Dwyer
April 16, 2018 - Making clang will build both clang and clang++. Making cxx will build libc++ (and also libc++abi, which is included in the libcxx repo). Making check-$FOO will build and run the test suite for $FOO: ... cd $ROOT/llvm/build ./bin/llvm-lit -sv ../test/Analysis ./bin/llvm-lit -sv ../tools/clang/test/ARCMT ./bin/llvm-lit -sv ../projects/libcxx/test/std/re
Discussions

What is considered best practice to get LLVM working on Windows?
The Zig project hosts prebuilt LLVM binaries for windows: https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows Their prebuilt binaries seem to have much more included than the official LLVM windows package. It's insane that this is the easiest way to get LLVM on windows, but it's the best I've come across. EDIT: Looks like there are also build instructions there, that could be helpful too More on reddit.com
🌐 r/Compilers
21
7
November 3, 2021
How to compile my language for LLVM?
The LLVM tutorial has an example of this from chapter 3 onward. You just need to make sure you output their SSA format from your AST, you can use their library API functions to do that. There's also this tutorial, which I found useful as well: https://mukulrathi.com/create-your-own-programming-language/llvm-ir-cpp-api-tutorial/ More on reddit.com
🌐 r/ProgrammingLanguages
28
50
September 7, 2022
🌐
GitHub
github.com › llvm › llvm-project
GitHub - llvm/llvm-project: The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. · GitHub
3 days ago - Welcome to the LLVM project! This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
Starred by 39K users
Forked by 17.6K users
Languages   LLVM 41.2% | C++ 30.4% | C 12.5% | Assembly 11.2% | MLIR 1.6% | Python 0.8%
🌐
GitHub
github.com › noloader › build-llvm
GitHub - noloader/build-llvm: Recipes to download and build LLVM, Clang front end and Compiler-RT from sources · GitHub
Recipes to download and build LLVM, Compiler front end and Compiler-RT from sources. The script builds the latest LLVM from release tarballs, which is currently version 7.0.
Author   noloader
🌐
Arthur O’Dwyer
quuxplusone.github.io › blog › 2019 › 11 › 09 › llvm-from-scratch
How to build LLVM from source, monorepo version
This takes only about 60 minutes to build, but you wouldn’t want to use the resulting binary for anything heavy-duty because it’s so slow. Running a specific test or directory-of-tests for any product is easy: cd $ROOT/llvm-project/build2 ./bin/llvm-lit -sv ../llvm/test/Analysis ./bin/llvm-lit -sv ../clang/test/ARCMT ./bin/llvm-lit -sv --param std=c++17 ../libcxx/test/std/re
Top answer
1 of 2
19

To build everything, do this:

$ git clone --depth 1 --branch llvmorg-19.1.0 https://github.com/llvm/llvm-project.git
$ cmake -S llvm-project/llvm -B llvm-project/build \
        -DCMAKE_BUILD_TYPE=Release \
        -DLLVM_ENABLE_PROJECTS=all \
        -DLLVM_ENABLE_RUNTIMES=all
$ cmake --build llvm-project/build -j8
$ cmake --install llvm-project/build --prefix /usr/local  # or somewhere else

You might also be interested in the following build flags for the first CMake command:

  • -DLLVM_ENABLE_ASSERTIONS=ON -- good for debugging
  • -DLLVM_ENABLE_EH=ON -- enable if your application uses C++ exceptions
  • -DLLVM_ENABLE_RTTI=ON -- enable if your application uses C++ RTTI

Also see the upstream documentation: https://llvm.org/docs/CMake.html


Note that some of the LLVM projects can only be built with clang. I won't get into bootstrapping issues, but if the build fails, you can winnow down the list of projects from all to a subset of the following: clang, clang-tools-extra, cross-project-tests, libc, libclc, lld, lldb, openmp, polly, and pstl.

You can also reduce the list of runtimes to a subset of compiler-rt, libc, libcxx, libcxxabi, libunwind, and openmp.

Note that LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES should not overlap. The latter builds each target with the just-built clang.

2 of 2
3

These are the steps I use taken from here:

mkdir llvm
cd llvm

git clone https://github.com/llvm/llvm-project.git .
git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git
git clone https://github.com/intel/opencl-clang.git
git clone https://github.com/KhronosGroup/SPIRV-Headers.git ./llvm/projects/SPIRV-Headers
git clone https://github.com/intel/vc-intrinsics.git ./llvm/projects/vc-intrinsics

mkdir build
cd build

cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=”X86″ -DLLVM_ENABLE_PROJECTS=”clang” -DLLVM_EXTERNAL_PROJECTS=”llvm-spirv;opencl-clang” -DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=”../SPIRV-LLVM-Translator” -DLLVM_EXTERNAL_OPENCL_CLANG_SOURCE_DIR=”../opencl-clang” ../llvm

make opencl-clang
🌐
AMD ROCm
rocm.docs.amd.com › projects › llvm-project › en › latest › LLVM › llvm › html › GettingStarted.html
Getting Started with the LLVM System — LLVM 22.0.0git documentation
This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode – and from there into object files, using LLVM. Other components include: the libc++ C++ standard library, the LLD linker, and more. Check out LLVM (including subprojects like Clang): git clone ...
Find elsewhere
🌐
GitHub
github.com › ziglang › zig › wiki › How-to-build-LLVM,-libclang,-and-liblld-from-source
How to build LLVM, libclang, and liblld from source
April 12, 2023 - Moved to Codeberg. Contribute to ziglang/zig development by creating an account on GitHub.
Author   ziglang
🌐
Google
chromium.googlesource.com › external › github.com › llvm › llvm-project
external/github.com/llvm/llvm-project - Git at Google
Welcome to the LLVM project! This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
🌐
GitHub
github.com › ARM-software › LLVM-embedded-toolchain-for-Arm › blob › main › docs › building-from-source.md
LLVM-embedded-toolchain-for-Arm/docs/building-from-source.md at main · ARM-software/LLVM-embedded-toolchain-for-Arm
$ apt-get install python3 git make ninja-build qemu $ apt-get install clang # If the Clang version installed by the package manager is older than 6.0.0, download a recent version from https://releases.llvm.org or build from source $ apt-get install cmake # If the CMake version installed by the package manager is too old, download a recent version from https://cmake.org/download and add it to PATH $ pip install meson
Author   ARM-software
🌐
Bernardnongpoh
bernardnongpoh.github.io › posts › llvm
Installing LLVM Compiler Infrastructure - Bernard Nongpoh
This blog walks you through how to install LLVM Compiler Infrastructure from scratch ... While building, your CPU might freeze; it better to close all programs before installation. We first need to clone the repository. To save space, we do a shallow clone. If you want the complete source code, go check this link Getting the source code and building LLVM Doing this will also pull llvm subprojects such as Clang and others.
🌐
GitHub
github.com › openhwgroup › corev-llvm-project
GitHub - openhwgroup/corev-llvm-project
This directory and its sub-directories contain the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments. The README briefly describes how to get started with building LLVM. For more information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide. Taken from ...
Starred by 18 users
Forked by 17 users
🌐
GitHub
github.com › ajkhoury › LLVM-Build-Windows
GitHub - ajkhoury/LLVM-Build-Windows · GitHub
>git clone https://github.com/ajkhoury/LLVM-Build-Windows . See here on how to obtain the LLVM source code for building:
Starred by 40 users
Forked by 9 users
Languages   Batchfile 91.9% | Shell 8.1%
🌐
WISESCIENCEWISE
wisesciencewise.wordpress.com › 2022 › 10 › 04 › build-llvm-from-source-on-ubuntu
Build LLVM from source on Ubuntu | WISESCIENCEWISE
October 4, 2022 - Below are the steps needed to build the LLVM from its git repo: Get the llvm project files from its repository. > git clone https://github.com/llvm/llvm-project.git
🌐
GitHub
github.com › memfault › llvm-project
GitHub - memfault/llvm-project: Fork of https://github.com/llvm/llvm-project
This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM. Other components include: the libc++ C++ standard library, the LLD linker, and more.
Author   memfault
🌐
DEV Community
dev.to › prajwal_kp › brew-your-own-compiler-building-llvmclang-from-source-on-any-os-4kh8
Brew Your Own Compiler: Building LLVM/Clang from Source on Any OS! - DEV Community
September 14, 2025 - Clone the repository:git clone --depth 1 https://github.com/llvm/llvm-project.git ... cmake -G "Visual Studio 17 2022" -A x64 ../llvm ^ -DCMAKE_BUILD_TYPE=Release ^ -DLLVM_ENABLE_PROJECTS="clang;lld" ^ -DLLVM_ENABLE_ASSERTIONS=ON
🌐
GitHub
github.com › llvm
LLVM · GitHub
This is the LLVM organization on GitHub for the LLVM Project: a collection of modular and reusable compiler and toolchain technologies. - LLVM
🌐
Codeberg
codeberg.org › azhai › zig › wiki › How-to-build-LLVM,-libclang,-and-liblld-from-source
How to build LLVM, libclang, and liblld from source - azhai/zig - Codeberg.org
This guide will get you both a Debug build of LLVM, and/or a Release build of LLVM. It intentionally does not require privileged access, using a prefix inside your home directory instead of a global installation. This is the generally recommended approach. cd ~/Downloads git clone --depth 1 --branch release/17.x https://github.com/llvm/llvm-project llvm-project-17 cd llvm-project-17 git checkout release/17.x mkdir build-release cd build-release cmake ../llvm \ -DCMAKE_INSTALL_PREFIX=$HOME/local/llvm17-release \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_PROJECTS="lld;clang" \ -DLLVM_ENABLE_LIBXML2=OFF \ -DLLVM_ENABLE_TERMINFO=OFF \ -DLLVM_ENABLE_LIBEDIT=OFF \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DLLVM_PARALLEL_LINK_JOBS=1 \ -G Ninja ninja install
🌐
GitHub
github.com › michelou › llvm-examples
GitHub - michelou/llvm-examples: Running and building LLVM on Windows · GitHub
☛ Installation policy When possible we install software from a Zip archive rather than via a Windows installer. In our case we defined C:\opt\ as the installation directory for optional software tools (in reference to the /opt/ directory on Unix). ... bin\pelook.exe (changelist) bin\vswhere.exe bin\llvm\build.bat docs\ examples\{README.md, hello, JITTutorial1, etc.} llvm-12.0.1.src\ (extracted from file llvm-12.0.1.src.tar.xz) llvm-13.0.1.src\ (extracted from file llvm-13.0.1.src.tar.xz) llvm-14.0.6.src\ (extracted from file llvm-14.0.6.src.tar.xz) llvm-15.0.7.src\ (extracted from file llvm-15.0.7.src.tar.xz) llvm-16.0.6.src\ (extracted from file llvm-16.0.6.src.tar.xz) llvm-essentials{README.md, 1_2_Getting_familiar_with_LLVM_IR, etc.} BUILD.md README.md RESOURCES.md setenv.bat
Starred by 45 users
Forked by 2 users
Languages   C++ 99.6% | C 0.4%
🌐
LLVM
apt.llvm.org › building-pkgs.php
How to build LLVM Debian/Ubuntu packages from source?
To retrieve a specific release candidate, you can pass the branch name as the first argument, and the tag rc number as the second argument. For example, to get the 13.0.1 release candidate rc3 at https://github.com/llvm/llvm-project/releases/tag/llvmorg-13.0.1-rc3 you should use,