Building clang

Hi,

What is the fastest way to build clang from source? Currently I am using the following:


cmake -DLLVM_ENABLE_PROJECTS="clang" -G "Ninja" ../llvm

ninja

Kindly,

Anshil

It’s typically a big performance improvement to leverage ccache and to use lld as the linker.

See “LLVM_ENABLE_LLD” and “LLVM_CCACHE_BUILD” in https://llvm.org/docs/CMake.html#llvm-specific-variables

Using ccache will normally not result in any performance improvements
for a one-off build and typically even decrease performance. Whether it
helps for update builds is questionable too.

Joerg

To improve speed of building, you may consider the argument DLLVM_BUILD_TESTS (I have OFF for this argument), DLLVM_TARGETS_TO_BUILD (x86 maybe), DLLVM_ENABLE_PROJECTS - select only projects that you need.

Hope that help!