Accelerate Bitcoin Core build time

Use a faster linker (biggest impact), Use Clang instead of GCC (often faster compilation), Use ccache (huge speedup on rebuilds), Use Ninja instead of Make

sudo pacman -S mold clang ccache ninja

cd bitcoin

git tag | sort -V

git checkout <paste here the branch name you want to compile>

Combine everything:
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=mold" \
-G Ninja

ninja -C build -j$(nproc)

sudo ninja -C build install

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *