|
1 |
| -FreeBSD build guide |
2 |
| -====================== |
3 |
| -(updated for FreeBSD 12.0) |
| 1 | +# FreeBSD Build Guide |
4 | 2 |
|
5 |
| -This guide describes how to build bitcoind and command-line utilities on FreeBSD. |
| 3 | +**Updated for FreeBSD [12.2](https://www.freebsd.org/releases/12.2R/announce.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 FreeBSD. |
| 6 | + |
| 7 | +## Dependencies |
| 8 | + |
| 9 | +The following dependencies are **required**: |
| 10 | + |
| 11 | + Library | Purpose | Description |
| 12 | + ----------------------------------------------------------------------|------------|---------------------- |
| 13 | + [autoconf](https://svnweb.freebsd.org/ports/head/devel/autoconf/) | Build | Automatically configure software source code |
| 14 | + [automake](https://svnweb.freebsd.org/ports/head/devel/automake/) | Build | Generate makefile (requires autoconf) |
| 15 | + [libtool](https://svnweb.freebsd.org/ports/head/devel/libtool/) | Build | Shared library support |
| 16 | + [pkgconf](https://svnweb.freebsd.org/ports/head/devel/pkgconf/) | Build | Configure compiler and linker flags |
| 17 | + [git](https://svnweb.freebsd.org/ports/head/devel/git/) | Clone | Version control system |
| 18 | + [gmake](https://svnweb.freebsd.org/ports/head/devel/gmake/) | Compile | Generate executables |
| 19 | + [boost-libs](https://svnweb.freebsd.org/ports/head/devel/boost-libs/) | Utility | Library for threading, data structures, etc |
| 20 | + [libevent](https://svnweb.freebsd.org/ports/head/devel/libevent/) | Networking | OS independent asynchronous networking |
| 21 | + |
| 22 | + |
| 23 | +The following dependencies are **optional**: |
| 24 | + |
| 25 | + Library | Purpose | Description |
| 26 | + ---------------------------------------------------------------------------|------------------|---------------------- |
| 27 | + [db5](https://svnweb.freebsd.org/ports/head/databases/db5/) | Berkeley DB | Wallet storage (only needed when wallet enabled) |
| 28 | + [qt5](https://svnweb.freebsd.org/ports/head/devel/qt5/) | GUI | GUI toolkit (only needed when GUI enabled) |
| 29 | + [libqrencode](https://svnweb.freebsd.org/ports/head/graphics/libqrencode/) | QR codes in GUI | Generating QR codes (only needed when GUI enabled) |
| 30 | + [libzmq4](https://svnweb.freebsd.org/ports/head/net/libzmq4/) | ZMQ notification | Allows generating ZMQ notifications (requires ZMQ version >= 4.0.0) |
| 31 | + [sqlite3](https://svnweb.freebsd.org/ports/head/databases/sqlite3/) | SQLite DB | Wallet storage (only needed when wallet enabled) |
| 32 | + [python3](https://svnweb.freebsd.org/ports/head/lang/python3/) | Testing | Python Interpreter (only needed when running the test suite) |
| 33 | + |
| 34 | + See [dependencies.md](dependencies.md) for a complete overview. |
8 | 35 |
|
9 | 36 | ## Preparation
|
10 | 37 |
|
11 |
| -You will need the following dependencies, which can be installed as root via pkg: |
| 38 | +### 1. Install Required Dependencies |
| 39 | +Install the required dependencies the usual way you [install software on FreeBSD](https://www.freebsd.org/doc/en/books/handbook/ports.html) - either with `pkg` or via the Ports collection. The example commands below use `pkg` which is usually run as `root` or via `sudo`. If you want to use `sudo`, and you haven't set it up: [use this guide](http://www.freebsdwiki.net/index.php/Sudo%2C_configuring) to setup `sudo` access on FreeBSD. |
12 | 40 |
|
13 | 41 | ```bash
|
14 | 42 | pkg install autoconf automake boost-libs git gmake libevent libtool pkgconf
|
15 | 43 |
|
| 44 | +``` |
| 45 | + |
| 46 | +### 2. Clone Bitcoin Repo |
| 47 | +Now that `git` and all the required dependencies are installed, let's clone the Bitcoin Core repository to a directory. All build scripts and commands will run from this directory. |
| 48 | +``` bash |
16 | 49 | git clone https://github.com/bitcoin/bitcoin.git
|
17 | 50 | ```
|
18 | 51 |
|
19 |
| -In order to run the test suite (recommended), you will need to have Python 3 installed: |
| 52 | +### 3. Install Optional Dependencies |
| 53 | + |
| 54 | +#### Wallet Dependencies |
| 55 | +It is not necessary to build wallet functionality to run bitcoind or the GUI. To enable legacy wallets, you must install `db5`. To enable [descriptor wallets](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md), `sqlite3` is required. Skip `db5` if you intend to *exclusively* use descriptor wallets |
| 56 | + |
| 57 | +###### Legacy Wallet Support |
| 58 | +`db5` is required to enable support for legacy wallets. Skip if you don't intend to use legacy wallets |
20 | 59 |
|
21 | 60 | ```bash
|
22 |
| -pkg install python3 |
| 61 | +pkg install db5 |
23 | 62 | ```
|
24 | 63 |
|
25 |
| -See [dependencies.md](dependencies.md) for a complete overview. |
| 64 | +###### Descriptor Wallet Support |
26 | 65 |
|
27 |
| -### Building BerkeleyDB |
| 66 | +`sqlite3` is required to enable support for descriptor wallets. Skip if you don't intend to use descriptor wallets. |
| 67 | +``` bash |
| 68 | +pkg install sqlite3 |
| 69 | +``` |
| 70 | +--- |
28 | 71 |
|
29 |
| -BerkeleyDB is only necessary for the wallet functionality. To skip this, pass |
30 |
| -`--disable-wallet` to `./configure` and skip to the next section. |
| 72 | +#### GUI Dependencies |
| 73 | +###### Qt5 |
31 | 74 |
|
| 75 | +Bitcoin Core includes a GUI built with the cross-platform Qt Framework. To compile the GUI, we need to install `qt5`. Skip if you don't intend to use the GUI. |
32 | 76 | ```bash
|
33 |
| -./contrib/install_db4.sh `pwd` |
34 |
| -export BDB_PREFIX="$PWD/db4" |
| 77 | +pkg install qt5 |
35 | 78 | ```
|
| 79 | +###### libqrencode |
| 80 | + |
| 81 | +The GUI can encode addresses in a QR Code. To build in QR support for the GUI, install `libqrencode`. Skip if not using the GUI or don't want QR code functionality. |
| 82 | +```bash |
| 83 | +pkg install libqrencode |
| 84 | +``` |
| 85 | +--- |
| 86 | + |
| 87 | +#### Test Suite Dependencies |
| 88 | +There is an included test suite that is useful for testing code changes when developing. |
| 89 | +To run the test suite (recommended), you will need to have Python 3 installed: |
| 90 | + |
| 91 | +```bash |
| 92 | +pkg install python3 |
| 93 | +``` |
| 94 | +--- |
36 | 95 |
|
37 | 96 | ## Building Bitcoin Core
|
38 | 97 |
|
39 |
| -**Important**: Use `gmake` (the non-GNU `make` will exit with an error). |
| 98 | +### 1. Configuration |
40 | 99 |
|
41 |
| -With wallet: |
| 100 | +There are many ways to configure Bitcoin Core, here are a few common examples: |
| 101 | +##### Wallet (BDB + SQlite) Support, No GUI: |
| 102 | +This explicitly enables legacy wallet support and disables the GUI. If `sqlite3` is installed, then descriptor wallet support will be built. |
42 | 103 | ```bash
|
43 | 104 | ./autogen.sh
|
44 |
| -./configure --with-gui=no \ |
45 |
| - BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" \ |
46 |
| - BDB_CFLAGS="-I${BDB_PREFIX}/include" \ |
| 105 | +./configure --with-gui=no --with-incompatible-bdb \ |
| 106 | + BDB_LIBS="-ldb_cxx-5" \ |
| 107 | + BDB_CFLAGS="-I/usr/local/include/db5" \ |
47 | 108 | MAKE=gmake
|
48 | 109 | ```
|
49 | 110 |
|
50 |
| -Without wallet: |
| 111 | +##### Wallet (only SQlite) and GUI Support: |
| 112 | +This explicitly enables the GUI and disables legacy wallet support. If `qt5` is not installed, this will throw an error. If `sqlite3` is installed then descriptor wallet functionality will be built. If `sqlite3` is not installed, then wallet functionality will be disabled. |
51 | 113 | ```bash
|
52 | 114 | ./autogen.sh
|
53 |
| -./configure --with-gui=no --disable-wallet MAKE=gmake |
| 115 | +./configure --without-bdb --with-gui=yes MAKE=gmake |
| 116 | +``` |
| 117 | +##### No Wallet or GUI |
| 118 | +``` bash |
| 119 | +./autogen.sh |
| 120 | +./configure --without-wallet --with-gui=no MAKE=gmake |
54 | 121 | ```
|
55 | 122 |
|
56 |
| -followed by: |
| 123 | +### 2. Compile |
| 124 | +**Important**: Use `gmake` (the non-GNU `make` will exit with an error). |
57 | 125 |
|
58 | 126 | ```bash
|
59 | 127 | gmake # use -jX here for parallelism
|
|
0 commit comments