2022-07-06 03:59:44 +02:00
# NetBSD Build Guide
2018-01-08 20:26:00 +01:00
2022-07-06 03:59:44 +02:00
Updated for NetBSD [9.2 ](https://netbsd.org/releases/formal-9/NetBSD-9.2.html ).
2018-01-08 20:26:00 +01:00
2022-07-06 03:59:44 +02:00
This guide describes how to build bitcoind, command-line utilities, and GUI on NetBSD.
2018-01-08 20:26:00 +01:00
2022-07-06 03:59:44 +02:00
## Preparation
2018-01-08 20:26:00 +01:00
2022-07-06 03:59:44 +02: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
pkgin install autoconf automake libtool pkg-config git gmake boost libevent
2018-01-08 20:26:00 +01:00
```
2022-07-06 03:59:44 +02: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.
For example, grab `gcc9` :
```
pkgin install gcc9
```
Then, when configuring, pass the following:
```bash
./configure
...
CC="/usr/pkg/gcc9/bin/gcc" \
CXX="/usr/pkg/gcc9/bin/g++" \
...
2018-01-08 20:26:00 +01:00
```
See [dependencies.md ](dependencies.md ) for a complete overview.
2022-07-06 03:59:44 +02:00
### 2. Clone Bitcoin Repo
2022-03-24 11:53:04 +01:00
2022-07-06 03:59:44 +02:00
Clone the Bitcoin Core repository to a directory. All build scripts and commands will run from this directory.
2022-03-24 11:53:04 +01:00
2022-07-06 03:59:44 +02: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 11:53:04 +01:00
```bash
pkgin install sqlite3
```
2022-07-06 03:59:44 +02:00
###### Legacy Wallet Support
`db4` is required to enable support for legacy wallets.
2022-03-24 11:53:04 +01:00
```bash
2022-07-06 03:59:44 +02:00
pkgin install db4
2022-03-24 11:53:04 +01:00
```
2018-12-13 05:05:45 +01:00
2022-07-06 03:59:44 +02:00
#### GUI Dependencies
2018-12-13 05:05:45 +01:00
2022-07-06 03:59:44 +02:00
Bitcoin Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, we need to install `qt5` .
2018-12-13 05:05:45 +01:00
2020-02-12 19:16:39 +01:00
```bash
2022-07-06 03:59:44 +02:00
pkgin install qt5
2018-12-13 05:05:45 +01:00
```
2022-07-06 03:59:44 +02:00
The GUI can encode addresses in a QR Code. To build in QR support for the GUI, install `qrencode` .
2018-12-13 05:05:45 +01:00
2020-02-12 19:16:39 +01:00
```bash
2022-07-06 03:59:44 +02:00
pkgin install qrencode
2018-12-13 05:05:45 +01:00
```
2022-07-06 03:59:44 +02: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 19:16:39 +01:00
```bash
2022-07-06 03:59:44 +02:00
pkgin install python37
2018-01-08 20:26:00 +01:00
```
2022-07-06 03:59:44 +02:00
### Building Bitcoin Core
**Note**: Use `gmake` (the non-GNU `make` will exit with an error).
### 1. Configuration
There are many ways to configure Bitcoin Core. Here is an example that
explicitly disables the wallet and GUI:
2020-02-12 19:16:39 +01:00
```bash
2018-01-08 20:26:00 +01:00
./autogen.sh
2022-07-06 03:59:44 +02:00
./configure --without-wallet --with-gui=no \
2018-12-13 05:05:45 +01:00
CPPFLAGS="-I/usr/pkg/include" \
2020-02-12 19:16:39 +01:00
MAKE=gmake
2018-12-13 05:05:45 +01:00
```
2022-07-06 03:59:44 +02:00
For a full list of configuration options, see the output of `./configure --help`
### 2. Compile
2018-12-13 05:05:45 +01:00
Build and run the tests:
2022-07-06 03:59:44 +02:00
2018-12-13 05:05:45 +01:00
```bash
2021-05-13 14:15:59 +02:00
gmake # use "-j N" here for N parallel jobs
2022-07-06 03:59:44 +02:00
gmake check # Run tests if Python 3 is available
2018-01-08 20:26:00 +01:00
```