|
1 | | -NetBSD Build Guide |
2 | | -====================== |
3 | | -**Updated for NetBSD [8.0](https://www.netbsd.org/releases/formal-8/NetBSD-8.0.html)** |
| 1 | +# NetBSD Build Guide |
4 | 2 |
|
5 | | -This guide describes how to build bitcoind and command-line utilities on NetBSD. |
| 3 | +Updated for NetBSD [9.2](https://netbsd.org/releases/formal-9/NetBSD-9.2.html). |
6 | 4 |
|
7 | | -This guide does not contain instructions for building the GUI. |
| 5 | +This guide describes how to build bitcoind, command-line utilities, and GUI on NetBSD. |
8 | 6 |
|
9 | | -Preparation |
10 | | -------------- |
| 7 | +## Preparation |
11 | 8 |
|
12 | | -You will need the following modules, which can be installed via pkgsrc or pkgin: |
| 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 autoconf automake libtool pkg-config git gmake boost libevent |
13 | 16 |
|
14 | 17 | ``` |
15 | | -autoconf |
16 | | -automake |
17 | | -boost |
18 | | -git |
19 | | -gmake |
20 | | -libevent |
21 | | -libtool |
22 | | -pkg-config |
23 | | -python37 |
24 | 18 |
|
25 | | -git clone https://github.com/bitcoin/bitcoin.git |
| 19 | +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. |
| 20 | + |
| 21 | +For example, grab `gcc9`: |
| 22 | +``` |
| 23 | +pkgin install gcc9 |
| 24 | +``` |
| 25 | + |
| 26 | +Then, when configuring, pass the following: |
| 27 | +```bash |
| 28 | +./configure |
| 29 | + ... |
| 30 | + CC="/usr/pkg/gcc9/bin/gcc" \ |
| 31 | + CXX="/usr/pkg/gcc9/bin/g++" \ |
| 32 | + ... |
26 | 33 | ``` |
27 | 34 |
|
28 | 35 | See [dependencies.md](dependencies.md) for a complete overview. |
29 | 36 |
|
30 | | -### Building Bitcoin Core |
| 37 | +### 2. Clone Bitcoin Repo |
31 | 38 |
|
32 | | -**Important**: Use `gmake` (the non-GNU `make` will exit with an error). |
| 39 | +Clone the Bitcoin Core repository to a directory. All build scripts and commands will run from this directory. |
33 | 40 |
|
34 | | -#### With descriptor wallet: |
| 41 | +```bash |
| 42 | +git clone https://github.com/bitcoin/bitcoin.git |
| 43 | +``` |
| 44 | + |
| 45 | +### 3. Install Optional Dependencies |
| 46 | + |
| 47 | +#### Wallet Dependencies |
| 48 | + |
| 49 | +It is not necessary to build wallet functionality to run bitcoind or the GUI. |
| 50 | + |
| 51 | +###### Descriptor Wallet Support |
| 52 | + |
| 53 | +`sqlite3` is required to enable support for [descriptor wallets](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md). |
35 | 54 |
|
36 | | -The descriptor wallet uses `sqlite3`. You can install it using: |
37 | 55 | ```bash |
38 | 56 | pkgin install sqlite3 |
39 | 57 | ``` |
40 | 58 |
|
| 59 | +###### Legacy Wallet Support |
| 60 | + |
| 61 | +`db4` is required to enable support for legacy wallets. |
| 62 | + |
41 | 63 | ```bash |
42 | | -./autogen.sh |
43 | | -./configure --with-gui=no --without-bdb \ |
44 | | - CPPFLAGS="-I/usr/pkg/include" \ |
45 | | - LDFLAGS="-L/usr/pkg/lib" \ |
46 | | - BOOST_CPPFLAGS="-I/usr/pkg/include" \ |
47 | | - MAKE=gmake |
| 64 | +pkgin install db4 |
48 | 65 | ``` |
49 | 66 |
|
50 | | -#### With legacy wallet: |
51 | | - |
52 | | -BerkeleyDB is use for legacy wallet functionality. |
| 67 | +#### GUI Dependencies |
53 | 68 |
|
54 | | -It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library |
55 | | -from ports. |
56 | | -You can use [the installation script included in contrib/](/contrib/install_db4.sh) like so: |
| 69 | +Bitcoin Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, we need to install `qt5`. |
57 | 70 |
|
58 | 71 | ```bash |
59 | | -./contrib/install_db4.sh `pwd` |
| 72 | +pkgin install qt5 |
60 | 73 | ``` |
61 | 74 |
|
62 | | -from the root of the repository. Then set `BDB_PREFIX` for the next section: |
| 75 | +The GUI can encode addresses in a QR Code. To build in QR support for the GUI, install `qrencode`. |
63 | 76 |
|
64 | 77 | ```bash |
65 | | -export BDB_PREFIX="$PWD/db4" |
| 78 | +pkgin install qrencode |
66 | 79 | ``` |
67 | 80 |
|
| 81 | +#### Test Suite Dependencies |
| 82 | + |
| 83 | +There is an included test suite that is useful for testing code changes when developing. |
| 84 | +To run the test suite (recommended), you will need to have Python 3 installed: |
| 85 | + |
68 | 86 | ```bash |
69 | | -./autogen.sh |
70 | | -./configure --with-gui=no CPPFLAGS="-I/usr/pkg/include" \ |
71 | | - LDFLAGS="-L/usr/pkg/lib" \ |
72 | | - BOOST_CPPFLAGS="-I/usr/pkg/include" \ |
73 | | - BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \ |
74 | | - BDB_CFLAGS="-I${BDB_PREFIX}/include" \ |
75 | | - MAKE=gmake |
| 87 | +pkgin install python37 |
76 | 88 | ``` |
77 | 89 |
|
78 | | -#### Without wallet: |
| 90 | +### Building Bitcoin Core |
| 91 | + |
| 92 | +**Note**: Use `gmake` (the non-GNU `make` will exit with an error). |
| 93 | + |
| 94 | + |
| 95 | +### 1. Configuration |
| 96 | + |
| 97 | +There are many ways to configure Bitcoin Core. Here is an example that |
| 98 | +explicitly disables the wallet and GUI: |
| 99 | + |
79 | 100 | ```bash |
80 | 101 | ./autogen.sh |
81 | | -./configure --with-gui=no --disable-wallet \ |
| 102 | +./configure --without-wallet --with-gui=no \ |
82 | 103 | CPPFLAGS="-I/usr/pkg/include" \ |
83 | | - LDFLAGS="-L/usr/pkg/lib" \ |
84 | | - BOOST_CPPFLAGS="-I/usr/pkg/include" \ |
85 | 104 | MAKE=gmake |
86 | 105 | ``` |
87 | 106 |
|
| 107 | +For a full list of configuration options, see the output of `./configure --help` |
| 108 | + |
| 109 | +### 2. Compile |
| 110 | + |
88 | 111 | Build and run the tests: |
| 112 | + |
89 | 113 | ```bash |
90 | 114 | gmake # use "-j N" here for N parallel jobs |
91 | | -gmake check |
| 115 | +gmake check # Run tests if Python 3 is available |
92 | 116 | ``` |
0 commit comments