forked from torvalds/linux
- Notifications
You must be signed in to change notification settings - Fork 15
Building Clang from source
Nathan Chancellor edited this page Apr 5, 2023 · 11 revisions
If you would like to build Clang (and lld) from source for testing purposes, it is really easy! You should have cmake
and ninja
installed from your distribution.
$ git clone git://github.com/llvm/llvm-project $ cd llvm-project $ mkdir build $ cd build $ cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \ -DLLVM_ENABLE_WARNINGS=OFF \ ../llvm $ ninja
You are interested in more optimized binaries and faster compile times? You are invited to use tc-build!
$ git clone https://github.com/ClangBuiltLinux/tc-build $ cd tc-build $ ./build-llvm.py
If you do not have as powerful of a machine or are time restricted in some other way, you can build just Clang and LLD in a "stage 1" configuration (rather than the default of building a smaller clang
and lld
to build a fuller LLVM toolchain afterwards).
$ ./build-llvm.py --projects clang lld --build-stage1-only
Please see that repo's README for more information on properly using it.