This repository provides a minimal, developer-friendly CMake build system for the four core Libbitcoin v4 projects:
libbitcoin-systemlibbitcoin-databaselibbitcoin-networklibbitcoin-node
The official Libbitcoin repositories use highly automated build scripts that support Linux, Windows, macOS and many architectures.
If you just want to run a node quickly and without hassle, use the official pre-configured repository:
https://github.com/libbitcoin/libbitcoin-node
This project is aimed at Linux developers who want:
- Simple, transparent CMake builds
- Easy debugging and code navigation in an IDE (tested with VS Code)
- The ability to modify the Libbitcoin source code locally
- Separate Release and Debug builds side-by-side
- Full control over CPU extensions (SSE4.1, SHANI, AVX2, AVX512)
- Base OS: Ubuntu 24.04.3 LTS (Noble Numbat)
- C++13 compiler (gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04))
- Autoconf
- Automake
- libtool
- pkg-config
- git
- curl
The corresponding packages can be installed with the following command:
$ sudo apt install build-essential curl git autoconf automake pkg-config libtool~/dev/
├─ libbitcoin-system/
├─ libbitcoin-database/
├─ libbitcoin-network/
├─ libbitcoin-node/
└─ libbitcoin-install/ ← common install prefix
Build order (due to dependencies):
system → database → network → node
Copy the original source trees from the official repositories and add the CMake files from this repository.
libbitcoin-system/
├─ include/* ← from the official project repo
├─ src/*
├─ test/*
├─ CMakeLists.txt ← from this repo
├─ bitcoin-system.pc.in
└─ builds/config.h
The build setup for libbitcoin-system unfortunately contains two hacks that require 3 additional files.
├─ builds/config.h
├─ src/hash/accumulator_instances.cpp
├─ test/hash/accumulator_instances.cpp
libbitcoin-database/ ← from the official project repo
├─ include/*
├─ src/*
├─ test/*
├─ tools/*
├─ CMakeLists.txt ← from this repo
└─ bitcoin-database.pc.in
libbitcoin-network/ ← from the official project repo
├─ include/*
├─ src/*
├─ test/*
├─ CMakeLists.txt ← from this repo
└─ bitcoin-network.pc.in
libbitcoin-node/ ← from the official project repo
├─ include/*
├─ src/*
├─ test/*
├─ console/*
├─ CMakeLists.txt ← from this repo
├─ bitcoin-node.pc.in
└─ .vscode/* ← vscode integration
# 1. libbitcoin-system (Release build, static lib, no tests, with CPU extensions)
cd ~/dev/libbitcoin-system
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=~/dev/libbitcoin-install \
-DENABLE_TESTS=OFF \
-DENABLE_SHANI=ON -DENABLE_AVX2=ON -DENABLE_SSE41=ON -DENABLE_AVX512=ON
cmake --build build --parallel $(nproc)
cmake --install build
# 2. libbitcoin-database
cd ~/dev/libbitcoin-database
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=~/dev/libbitcoin-install \
-DENABLE_TESTS=OFF \
-DENABLE_SHANI=ON -DENABLE_AVX2=ON -DENABLE_SSE41=ON -DENABLE_AVX512=ON
cmake --build build --parallel $(nproc)
cmake --install build
# 3. libbitcoin-network
cd ~/dev/libbitcoin-network
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=~/dev/libbitcoin-install \
-DENABLE_TESTS=OFF \
-DENABLE_SHANI=ON -DENABLE_AVX2=ON -DENABLE_SSE41=ON -DENABLE_AVX512=ON
cmake --build build --parallel $(nproc)
cmake --install build
# 4. libbitcoin-node (with console application which is the actual node 'bn')
cd ~/dev/libbitcoin-node
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=~/dev/libbitcoin-install \
-DWITH_CONSOLE=ON \
-DENABLE_TESTS=OFF \
-DENABLE_SHANI=ON -DENABLE_AVX2=ON -DENABLE_SSE41=ON -DENABLE_AVX512=ON
cmake --build build --parallel $(nproc)
cmake --install buildYou now have a fully static bn executable in ~/dev/libbitcoin-install/bin/. Build a debug version with the following command
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=~/dev/libbitcoin-install \
-DWITH_CONSOLE=ON \
-DENABLE_TESTS=ON \
-DENABLE_SHANI=ON -DENABLE_AVX2=ON -DENABLE_SSE41=ON -DENABLE_AVX512=ON
# ... other options as neededCMake automatically keeps Release and Debug separate by adding a 'release_static' subfolder.
The repository contains ready-to-use .vscode/ configuration (libbitcoin-node):
settings.jsonlaunch.json(debugbn, attach to process, etc.)tasks.json(build Release/Debug with one click)
setting.json contains the configre and build parameters. Make sure '-DCMAKE_INSTALL_PREFIX' corresponds with the prefix you used to build the dependencies before.
Just open the libbitcoin-node project folder in VS Code and select the desired build task.
- Community-maintained alternative – not officially supported by the Libbitcoin team.
- The CMake files are deliberately simple and will break when the official repositories change directory layout or source files.
- When a new Libbitcoin version is released, compare the official
builds/cmake/modules/CMakeLists.txtwith the ones here and adapt if necessary. - Only Linux x86_64 is supported and regularly tested.
- Static builds (
-DBUILD_SHARED_LIBS=OFF) are the default and recommended.
| Option | Description | Default |
|---|---|---|
CMAKE_BUILD_TYPE |
Release / Debug | Release |
BUILD_SHARED_LIBS |
ON → shared, OFF → static | OFF |
CMAKE_INSTALL_PREFIX |
Install location | |
ENABLE_TESTS |
Build unit tests | OFF |
WITH_CONSOLE |
Build the bn console utility (node) |
OFF |
ENABLE_SHANI |
Enable Intel SHA-NI instructions | ON |
ENABLE_AVX2 |
Enable AVX2 | ON |
ENABLE_SSE41 |
Enable SSE4.1 | ON |
ENABLE_AVX512 |
Enable AVX-512 (experimental) | ON |
Enjoy hacking on Libbitcoin!
