/ doc / build-netbsd.md
build-netbsd.md
  1  # NetBSD Build Guide
  2  
  3  **Updated for NetBSD [10.1](https://netbsd.org/releases/formal-10/NetBSD-10.1.html)**
  4  
  5  This guide describes how to build bitcoind, command-line utilities, and GUI on NetBSD.
  6  
  7  ## Preparation
  8  
  9  ### 1. Install Required Dependencies
 10  
 11  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).
 12  The example commands below use `pkgin`.
 13  
 14  ```bash
 15  pkgin install git cmake pkg-config boost libevent
 16  ```
 17  
 18  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.
 19  
 20  For example, grab `gcc12`:
 21  ```
 22  pkgin install gcc12
 23  ```
 24  
 25  Then, when configuring, pass the following:
 26  ```bash
 27  cmake -B build
 28      ...
 29      -DCMAKE_C_COMPILER="/usr/pkg/gcc12/bin/gcc" \
 30      -DCMAKE_CXX_COMPILER="/usr/pkg/gcc12/bin/g++" \
 31      ...
 32  ```
 33  
 34  SQLite is required for the wallet:
 35  
 36  ```bash
 37  pkgin install sqlite3
 38  ```
 39  
 40  To build Bitcoin Core without the wallet, use `-DENABLE_WALLET=OFF`.
 41  
 42  Cap'n Proto is needed for IPC functionality (see [multiprocess.md](multiprocess.md)):
 43  
 44  ```bash
 45  pkgin install capnproto
 46  ```
 47  
 48  Compile with `-DENABLE_IPC=OFF` if you do not need IPC functionality.
 49  
 50  See [dependencies.md](dependencies.md) for a complete overview.
 51  
 52  ### 2. Clone Bitcoin Repo
 53  
 54  Clone the Bitcoin Core repository to a directory. All build scripts and commands will run from this directory.
 55  
 56  ```bash
 57  git clone https://github.com/bitcoin/bitcoin.git
 58  ```
 59  
 60  ### 3. Install Optional Dependencies
 61  
 62  #### GUI Dependencies
 63  ###### Qt6
 64  
 65  Bitcoin Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, we need to install
 66  the necessary parts of Qt, the libqrencode and pass `-DBUILD_GUI=ON`. Skip if you don't intend to use the GUI.
 67  
 68  ```bash
 69  pkgin install qt6-qtbase qt6-qttools
 70  ```
 71  
 72  ###### libqrencode
 73  
 74  The GUI will be able to encode addresses in QR codes unless this feature is explicitly disabled. To install libqrencode, run:
 75  
 76  ```bash
 77  pkgin install qrencode
 78  ```
 79  
 80  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.
 81  
 82  #### Notifications
 83  ###### ZeroMQ
 84  
 85  Bitcoin Core can provide notifications via ZeroMQ. If the package is installed, support will be compiled in.
 86  ```bash
 87  pkgin install zeromq
 88  ```
 89  
 90  #### Test Suite Dependencies
 91  
 92  There is an included test suite that is useful for testing code changes when developing.
 93  To run the test suite (recommended), you will need to have Python 3 installed:
 94  
 95  ```bash
 96  pkgin install python313 py313-zmq
 97  ```
 98  
 99  ## Building Bitcoin Core
100  
101  ### 1. Configuration
102  
103  There are many ways to configure Bitcoin Core. Here is an example that
104  explicitly disables the wallet and GUI:
105  
106  ```bash
107  cmake -B build -DENABLE_WALLET=OFF -DBUILD_GUI=OFF
108  ```
109  
110  Run `cmake -B build -LH` to see the full list of available options.
111  
112  ### 2. Compile
113  
114  Build and run the tests:
115  
116  ```bash
117  cmake --build build     # Append "-j N" for N parallel jobs.
118  ctest --test-dir build  # Append "-j N" for N parallel tests.
119  ```