I am documenting how I am building LLVM Clang in my Mac Air 2015.
- macOS Mojave 10.14.6
- 1.6 GHz Intel Core i5
- 8 GB Memory
git clone https://github.com/llvm/llvm-project.gitmkdir $ROOT/llvm-project/buildcd $ROOT/llvm-project/buildcmake -G Ninja \-DDEFAULT_SYSROOT="$(xcrun --show-sdk-path)" \-DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi" \-DCMAKE_BUILD_TYPE=Release ../llvmninja clangninja cxx
Apparently we need to build libc++: by running
ninja cxx other wise we get some header errors.
To run a static analyzer on
test.cpp file, we can use
scan-build utility with below command.
-Voption it will open the report in the browser
-kkeep on going option
cOnly run preprocess, compile, and assemble steps
Or we can use it via
clang to run a specific check. Here for example
Full build took around 2.5 hours in my machine.
Building after a small change took around 1 minute.