Skip to content

Commit bfb154e

Browse files
committed
Update build instructions for Berkeley DB
- People were having problems with the .so when installing in alternative locations. Like gitian, build a static library with -fPIC that can be embedded into the executables. - Add some missing steps - Add reminder that BerkeleyDB is only needed when wallet support is enabled
1 parent d0a2e2e commit bfb154e

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

doc/build-unix.md

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,33 @@ miniupnpc
137137

138138
Berkeley DB
139139
-----------
140-
You need Berkeley DB 4.8. If you have to build it yourself:
141-
142-
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
143-
echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz' | sha256sum -c
144-
# -> db-4.8.30.NC.tar.gz: OK
145-
tar -xzvf db-4.8.30.NC.tar.gz
146-
cd build_unix/
147-
../dist/configure --enable-cxx
148-
make
149-
sudo make install
140+
It is recommended to use Berkeley DB 4.8. If you have to build it yourself:
141+
142+
```bash
143+
BITCOIN_ROOT=$(pwd)
144+
145+
# Pick some path to install BDB to, here we create a directory within the bitcoin directory
146+
BDB_PREFIX="${BITCOIN_ROOT}/db4"
147+
mkdir -p $BDB_PREFIX
148+
149+
# Fetch the source and verify that it is not tampered with
150+
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
151+
echo '12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz' | sha256sum -c
152+
# -> db-4.8.30.NC.tar.gz: OK
153+
tar -xzvf db-4.8.30.NC.tar.gz
154+
155+
# Build the library and install to our prefix
156+
cd db-4.8.30.NC/build_unix/
157+
# Note: Do a static build so that it can be embedded into the exectuable, instead of having to find a .so at runtime
158+
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
159+
make install
160+
161+
# Configure Bitcoin Core to use our own-built instance of BDB
162+
cd $BITCOIN_ROOT
163+
./configure (other args...) LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/"
164+
```
150165

166+
**Note**: You only need Berkeley DB if the wallet is enabled (see the section *Disable-Wallet mode* below).
151167

152168
Boost
153169
-----

0 commit comments

Comments
 (0)