2022-07-05 21:59:44 -04:00
# NetBSD Build Guide
2018-01-08 16:26:00 -03:00
2024-05-20 07:49:37 -04:00
**Updated for NetBSD [10.0 ](https://netbsd.org/releases/formal-10/NetBSD-10.0.html )**
2018-01-08 16:26:00 -03:00
2022-07-05 21:59:44 -04:00
This guide describes how to build bitcoind, command-line utilities, and GUI on NetBSD.
2018-01-08 16:26:00 -03:00
2022-07-05 21:59:44 -04:00
## Preparation
2018-01-08 16:26:00 -03:00
2022-07-05 21:59:44 -04:00
### 1. Install Required Dependencies
Install the required dependencies the usual way you [install software on NetBSD ](https://www.netbsd.org/docs/guide/en/chap-boot.html#chap-boot-pkgsrc ).
The example commands below use `pkgin` .
```bash
2024-07-24 06:55:19 -04:00
pkgin install git cmake pkg-config boost-headers libevent
2018-01-08 16:26:00 -03:00
```
2022-07-05 21:59:44 -04:00
NetBSD currently ships with an older version of `gcc` than is needed to build. You should upgrade your `gcc` and then pass this new version to the configure script.
2024-05-20 07:49:37 -04:00
For example, grab `gcc12` :
2022-07-05 21:59:44 -04:00
```
2024-05-20 07:49:37 -04:00
pkgin install gcc12
2022-07-05 21:59:44 -04:00
```
Then, when configuring, pass the following:
```bash
2024-07-24 06:55:19 -04:00
cmake -B build
2022-07-05 21:59:44 -04:00
...
2024-07-24 06:55:19 -04:00
-DCMAKE_C_COMPILER="/usr/pkg/gcc12/bin/gcc" \
-DCMAKE_CXX_COMPILER="/usr/pkg/gcc12/bin/g++" \
2022-07-05 21:59:44 -04:00
...
2018-01-08 16:26:00 -03:00
```
See [dependencies.md ](dependencies.md ) for a complete overview.
2022-07-05 21:59:44 -04:00
### 2. Clone Bitcoin Repo
2022-03-24 07:53:04 -03:00
2022-07-05 21:59:44 -04:00
Clone the Bitcoin Core repository to a directory. All build scripts and commands will run from this directory.
2022-03-24 07:53:04 -03:00
2022-07-05 21:59:44 -04:00
```bash
git clone https://github.com/bitcoin/bitcoin.git
```
### 3. Install Optional Dependencies
#### Wallet Dependencies
It is not necessary to build wallet functionality to run bitcoind or the GUI.
###### Descriptor Wallet Support
`sqlite3` is required to enable support for [descriptor wallets ](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md ).
2022-03-24 07:53:04 -03:00
```bash
pkgin install sqlite3
```
2022-07-05 21:59:44 -04:00
###### Legacy Wallet Support
`db4` is required to enable support for legacy wallets.
2022-03-24 07:53:04 -03:00
```bash
2022-07-05 21:59:44 -04:00
pkgin install db4
2022-03-24 07:53:04 -03:00
```
2018-12-13 01:05:45 -03:00
2022-07-05 21:59:44 -04:00
#### GUI Dependencies
2024-07-24 06:55:19 -04:00
###### Qt5
2018-12-13 01:05:45 -03:00
2024-07-24 06:55:19 -04:00
Bitcoin Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, we need to install
the necessary parts of Qt, the libqrencode and pass `-DBUILD_GUI=ON` . Skip if you don't intend to use the GUI.
2018-12-13 01:05:45 -03:00
2020-02-12 15:16:39 -03:00
```bash
2024-05-20 07:49:37 -04:00
pkgin install qt5-qtbase qt5-qttools
2018-12-13 01:05:45 -03:00
```
2024-07-24 06:55:19 -04:00
###### libqrencode
The GUI will be able to encode addresses in QR codes unless this feature is explicitly disabled. To install libqrencode, run:
2018-12-13 01:05:45 -03:00
2020-02-12 15:16:39 -03:00
```bash
2022-07-05 21:59:44 -04:00
pkgin install qrencode
2018-12-13 01:05:45 -03:00
```
2024-07-24 06:55:19 -04:00
Otherwise, if you don't need QR encoding support, use the `-DWITH_QRENCODE=OFF` option to disable this feature in order to compile the GUI.
2022-07-05 21:59:44 -04:00
#### Test Suite Dependencies
There is an included test suite that is useful for testing code changes when developing.
To run the test suite (recommended), you will need to have Python 3 installed:
2020-02-12 15:16:39 -03:00
```bash
2024-05-20 07:49:37 -04:00
pkgin install python39
2018-01-08 16:26:00 -03:00
```
2022-07-05 21:59:44 -04:00
### Building Bitcoin Core
### 1. Configuration
There are many ways to configure Bitcoin Core. Here is an example that
explicitly disables the wallet and GUI:
2020-02-12 15:16:39 -03:00
```bash
2024-07-24 06:55:19 -04:00
cmake -B build -DENABLE_WALLET=OFF -DBUILD_GUI=OFF
2018-12-13 01:05:45 -03:00
```
2024-07-24 06:55:19 -04:00
Run `cmake -B build -LH` to see the full list of available options.
2022-07-05 21:59:44 -04:00
### 2. Compile
2018-12-13 01:05:45 -03:00
Build and run the tests:
2022-07-05 21:59:44 -04:00
2018-12-13 01:05:45 -03:00
```bash
2024-07-24 06:55:19 -04:00
cmake --build build # Use "-j N" for N parallel jobs.
ctest --test-dir build # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available.
2018-01-08 16:26:00 -03:00
```