After looking through the 2018 GSoC projects LLVM stands out as the most interesting one for me.
Before it's even time to contact anyone from the project, I should at least build it first and verify that it passes any tests they might have.
As I don't have much experience with building such complicated and big projects, this took quite some time.
The project uses CMake as a build system, with many flags available to tune the compilation. After checking out the source code either from git or SVN it's time to build it.
After some failed attempts and some Q&A's in the IRC channel, I found the required flags to build it in my system. Turns out I can have multiple build folders for differently configured builds, so my plan is to have one minimal build for developing purposes and one full build to run the final tests before sending a patch.
My computer is old.
OK, it's not that old, but it is abused the last 6 years that I own it
and it's not top tier. Just a normal
i5 computer from the 2010s.
That said, the first time I built LLVM, it took more than 45 minutes.
There are various optimizations one could do to improve compilation times.
I already mentioned keeping two differently configured build folders.
I also installed
ccahce since LLVM's
CMakeLists.txt has a flag to
enable it's usage. C++ modules also help.
Ninja is recommended in the wiki, and it's probably the fastest one, so I use that as well.
Building with a minimal build and just the component I'm working on, greatly reduces build times.
Here are the minimal build flags:
cd /build/llvm-dev # the minimal folder cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ -DBUILD_SHARED_LIBS=true \ -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_C_COMPILER=clang \ -DLLVM_CCACHE_BUILD=ON \ -DCLANG_ENABLE_ARCMT=OFF \ -DCLANG_ENABLE_STATIC_ANALYZER=OFF \ -DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" ~/code/llvm
And here is the full build, basically the same but without the ARCMT and static analyzer disabled, plus it builds for all targets.
cd /build/llvm-full # the full build cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \ -DBUILD_SHARED_LIBS=true \ -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_C_COMPILER=clang \ -DLLVM_CCACHE_BUILD=ON ~/code/llvm