Skip to content

Commit 3e578aa

Browse files
committed
Merge pull request #4114
bfb154e Update build instructions for Berkeley DB (Wladimir J. van der Laan) d0a2e2e Log BerkeleyDB version at startup (Wladimir J. van der Laan)
2 parents 9eb1e1e + bfb154e commit 3e578aa

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

doc/build-unix.md

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

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

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

148164
Boost
149165
-----

src/init.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,9 @@ bool AppInit2(boost::thread_group& threadGroup)
603603
LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
604604
LogPrintf("Bitcoin version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);
605605
LogPrintf("Using OpenSSL version %s\n", SSLeay_version(SSLEAY_VERSION));
606+
#ifdef ENABLE_WALLET
607+
LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0));
608+
#endif
606609
if (!fLogTimestamps)
607610
LogPrintf("Startup time: %s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()));
608611
LogPrintf("Default data directory %s\n", GetDefaultDataDir().string());

0 commit comments

Comments
 (0)