Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1# Depends build3This is a system of building and caching dependencies necessary for building4Bitcoin Core. It supports cross-compilation. For more details see [description.md](description.md),5as well as [packages.md](packages.md) for how to add packages.7## Usage9### Ubuntu & Debian11apt install cmake curl make patch13Skip the following packages if you don't intend to use the GUI and will build with [`NO_QT=1`](#dependency-options):15apt install bison g++ ninja-build pkgconf python3 xz-utils17To build dependencies for the current arch+OS:19make21### macOS23Install Xcode Command Line Tools and Homebrew Package Manager,24see [build-osx.md](../doc/build-osx.md).26brew install cmake make ninja28To build dependencies for the current arch+OS:30gmake32### FreeBSD34pkg install bash cmake curl gmake36Skip the following packages if you don't intend to use the GUI and will build with [`NO_QT=1`](#dependency-options):38pkg install bison ninja pkgconf python340To build dependencies for the current arch+OS:42gmake44### NetBSD46pkgin install bash cmake curl gmake perl48To build dependencies for the current arch+OS:50gmake52### OpenBSD54pkg_add bash cmake curl gmake gtar56Skip the following packages if you don't intend to use the GUI and will build with [`NO_QT=1`](#dependency-options):58pkg_add bison ninja60To build dependencies for the current arch+OS:62gmake64### Alpine66apk add bash build-base cmake curl make patch68Skip the following packages if you don't intend to use the GUI and will build with [`NO_QT=1`](#dependency-options):70apk add bison linux-headers samurai pkgconf python372To build dependencies for the current arch+OS:74make76## Configuring Bitcoin Core78**When configuring Bitcoin Core, CMake by default will ignore the depends output.** In79order for it to pick up libraries, tools, and settings from the depends build,80you must specify the toolchain file.81In the above example for Ubuntu, a file named `depends/x86_64-pc-linux-gnu/toolchain.cmake` will be82created. To use it during configuring Bitcoin Core:84cmake -B build --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake86## Dependency Options88The following can be set when running make: `make FOO=bar`90- `SOURCES_PATH`: Downloaded sources will be placed here91- `BASE_CACHE`: Built packages will be placed here92- `SDK_PATH`: Path where SDKs can be found (used by macOS)93- `FALLBACK_DOWNLOAD_PATH`: If a source file can't be fetched, try here before giving up94- `C_STANDARD`: Set the C standard version used. Defaults to `c11`.95- `CXX_STANDARD`: Set the C++ standard version used. Defaults to `c++20`.96- `NO_BOOST`: Don't download/build/cache Boost97- `NO_QT`: Don't download/build/cache Qt and its dependencies98- `NO_QR`: Don't download/build/cache packages needed for enabling qrencode99- `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ100- `NO_WALLET`: Don't download/build/cache libs needed to enable the wallet (SQLite)101- `NO_USDT`: Don't download/build/cache packages needed for enabling USDT tracepoints102- `NO_IPC`: Don't build Cap’n Proto and libmultiprocess packages. Default on Windows.103- `DEBUG`: Disable some optimizations and enable more runtime checking104- `HOST_ID_SALT`: Optional salt to use when generating host package ids105- `BUILD_ID_SALT`: Optional salt to use when generating build package ids106- `LOG`: Use file-based logging for individual packages. During a package build its log file107resides in the `depends` directory, and the log file is printed out automatically in case108of build error. After successful build log files are moved along with package archives109- `LTO`: Enable options needed for LTO. Does not add `-flto` related options to *FLAGS.111If some packages are not built, for example `make NO_WALLET=1`, the appropriate CMake cache112variables will be set when generating the Bitcoin Core buildsystem. In this case, `-DENABLE_WALLET=OFF`.114## Compiler Configuration116`CC` and `CXX` control target compilers. `build_CC` and `build_CXX` control117compilers for native build tools (e.g. `native_capnp`, `native_qt`), which118default to `gcc`/`g++` on Linux and `clang`/`clang++` on macOS/FreeBSD/OpenBSD119(see `./depends/builders/*.mk`).121On a system where the default build compiler is not available (e.g. Linux122without gcc/g++), you could use the following to build all packages using clang:124make -C depends build_CC=clang build_CXX=clang++ CC=clang CXX=clang++126## Cross compilation128To build for another arch+OS:130make HOST=host-platform-triplet132For example:134make HOST=x86_64-w64-mingw32 -j4136Common `host-platform-triplet`s for cross compilation are:138- `i686-linux-gnu` for Linux x86 32-bit139- `x86_64-linux-gnu` for Linux x86 64-bit140- `x86_64-w64-mingw32` for Windows using MSVCRT141- `x86_64-w64-mingw32ucrt` for Windows using UCRT142- `x86_64-apple-darwin` for Intel macOS143- `arm64-apple-darwin` for ARM macOS144- `arm-linux-gnueabihf` for Linux ARM 32-bit145- `aarch64-linux-gnu` for Linux ARM 64-bit146- `powerpc64-linux-gnu` for Linux POWER 64-bit (big endian)147- `powerpc64le-linux-gnu` for Linux POWER 64-bit (little endian)148- `riscv32-linux-gnu` for Linux RISC-V 32-bit149- `riscv64-linux-gnu` for Linux RISC-V 64-bit150- `s390x-linux-gnu` for Linux S390X152The paths are automatically configured and no other options are needed.154#### For macOS cross compilation156apt install clang lld llvm zip158Clang 18 or later is required. You must also obtain the macOS SDK before159proceeding with a cross-compile. Under the depends directory, create a160subdirectory named `SDKs`. Then, place the extracted SDK under this new directory.161For more information, see [SDK Extraction](../contrib/macdeploy/README.md#sdk-extraction).163#### For Windows cross compilation165Using MSVCRT:167apt install g++-mingw-w64-x86-64-posix169Using UCRT:171apt install g++-mingw-w64-ucrt64173Some Ubuntu or Debian versions may not offer a working package. In this case,174you may install `nix-bin` and use the Nix shell from the repository root:176apt install nix-bin177NIX_BUILD_SHELL=bash HOST=x86_64-w64-mingw32 nix-shell contrib/devtools/shell-win64-cross.nix # MSVCRT178NIX_BUILD_SHELL=bash HOST=x86_64-w64-mingw32ucrt nix-shell contrib/devtools/shell-win64-cross.nix # UCRT180#### For Linux cross compilation182Please note that package availability might depend on the arch+OS you are building on.184For Linux x86 32-bit cross compilation:186sudo apt-get install g++-i686-linux-gnu binutils-i686-linux-gnu188For Linux x86 64-bit cross compilation:190sudo apt-get install g++-x86-64-linux-gnu binutils-x86-64-linux-gnu192For Linux ARM 32-bit cross compilation:194sudo apt-get install g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf196For Linux ARM 64-bit cross compilation:198sudo apt-get install g++-aarch64-linux-gnu binutils-aarch64-linux-gnu200For Linux POWER 64-bit cross compilation (there are no packages for 32-bit):202sudo apt-get install g++-powerpc64-linux-gnu binutils-powerpc64-linux-gnu g++-powerpc64le-linux-gnu binutils-powerpc64le-linux-gnu204For Linux RISC-V 64-bit cross compilation (there are no packages for 32-bit):206sudo apt-get install g++-riscv64-linux-gnu binutils-riscv64-linux-gnu208For Linux S390X cross compilation:210sudo apt-get install g++-s390x-linux-gnu binutils-s390x-linux-gnu212### Additional targets214download: run 'make download' to fetch all sources without building them215download-osx: run 'make download-osx' to fetch all sources needed for macOS builds216download-win: run 'make download-win' to fetch all sources needed for win builds217download-linux: run 'make download-linux' to fetch all sources needed for linux builds
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.