Update DB version to 5.1

This commit is contained in:
Ross Nicoll 2017-04-18 13:40:50 +01:00
parent 8a3a19471c
commit f16d96c59b
4 changed files with 100 additions and 17 deletions

View file

@ -0,0 +1,66 @@
AC_DEFUN([BITCOIN_FIND_BDB51],[
AC_MSG_CHECKING([for Berkeley DB C++ headers])
BDB_CPPFLAGS=
BDB_LIBS=
bdbpath=X
bdb51path=X
bdbdirlist=
for _vn in 5.1 51 5 ''; do
for _pfx in b lib ''; do
bdbdirlist="$bdbdirlist ${_pfx}db${_vn}"
done
done
for searchpath in $bdbdirlist ''; do
test -n "${searchpath}" && searchpath="${searchpath}/"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <${searchpath}db_cxx.h>
]],[[
#if !((DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR >= 1) || DB_VERSION_MAJOR > 5)
#error "failed to find bdb 5.1+"
#endif
]])],[
if test "x$bdbpath" = "xX"; then
bdbpath="${searchpath}"
fi
],[
continue
])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <${searchpath}db_cxx.h>
]],[[
#if !(DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR == 1)
#error "failed to find bdb 5.1"
#endif
]])],[
bdb51path="${searchpath}"
break
],[])
done
if test "x$bdbpath" = "xX"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([libdb_cxx headers missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
elif test "x$bdb51path" = "xX"; then
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdbpath}],db_cxx)
AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 5.1])],[
AC_MSG_WARN([Found Berkeley DB other than 5.1; wallets opened by this build will not be portable!])
],[
AC_MSG_ERROR([Found Berkeley DB other than 5.1, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)])
])
else
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb51path}],db_cxx)
bdbpath="${bdb51path}"
fi
AC_SUBST(BDB_CPPFLAGS)
# TODO: Ideally this could find the library version and make sure it matches the headers being used
for searchlib in db_cxx-5.1 db_cxx; do
AC_CHECK_LIB([$searchlib],[main],[
BDB_LIBS="-l${searchlib}"
break
])
done
if test "x$BDB_LIBS" = "x"; then
AC_MSG_ERROR([libdb_cxx missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
fi
AC_SUBST(BDB_LIBS)
])

View file

@ -500,7 +500,7 @@ case $host in
dnl the user (--without-wallet or --without-gui for example).
openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null`
bdb_prefix=`$BREW --prefix berkeley-db 2>/dev/null`
qt5_prefix=`$BREW --prefix qt5 2>/dev/null`
if test x$openssl_prefix != x; then
PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
@ -858,7 +858,7 @@ AC_SUBST(LIBMEMENV)
if test x$enable_wallet != xno; then
dnl Check for libdb_cxx only if wallet enabled
BITCOIN_FIND_BDB48
BITCOIN_FIND_BDB51
fi
dnl Check for libminiupnpc (optional)

View file

@ -17,6 +17,7 @@ Dependencies
----------------------
brew install automake berkeley-db4 libtool boost miniupnpc openssl pkg-config protobuf python qt libevent qrencode
brew install berkeley-db # You need to make sure you install a version >= 5.1.29, but as close to 5.1.29 as possible. Check the homebrew docs to find out how to install older versions.
See [dependencies.md](dependencies.md) for a complete overview.

View file

@ -42,7 +42,7 @@ Optional dependencies:
Library | Purpose | Description
------------|------------------|----------------------
miniupnpc | UPnP Support | Firewall-jumping support
libdb4.8 | Berkeley DB | Wallet storage (only needed when wallet enabled)
libdb5.1 | Berkeley DB | Wallet storage (only needed when wallet enabled)
qt | GUI | GUI toolkit (only needed when GUI enabled)
protobuf | Payments in GUI | Data interchange format used for payment protocol (only needed when GUI enabled)
libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled)
@ -74,18 +74,15 @@ Build requirements:
BerkeleyDB is required for the wallet.
**For Ubuntu only:** db4.8 packages are available [here](https://launchpad.net/~bitcoin/+archive/bitcoin).
You can add the repository and install using the following commands:
sudo apt-get install libdb5.1-dev libdb5.1++-dev
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev
Note that if you have Berkeley DB 4.8 packages installed (i.e. for other
wallet software), they are incompatible with the packages for 5.1. You
will have to manually download 5.1 from
http://download.oracle.com/berkeley-db/db-5.1.29.NC.tar.gz and compile
it, install it to /usr/local where the configure script should locate it
automatically.
Ubuntu and Debian have their own libdb-dev and libdb++-dev packages, but these will install
BerkeleyDB 5.1 or later, which break binary wallet compatibility with the distributed executables which
are based on BerkeleyDB 4.8. If you do not care about wallet compatibility,
pass `--with-incompatible-bdb` to configure.
See the section "Disable-wallet mode" to build Bitcoin Core without wallet.
@ -155,12 +152,31 @@ turned off by default. See the configure options for upnp behavior desired:
Berkeley DB
-----------
It is recommended to use Berkeley DB 4.8. If you have to build it yourself,
you can use [the installation script included in contrib/](/contrib/install_db4.sh)
like so
It is recommended to use Berkeley DB 5.1. If you have to build it yourself:
```shell
./contrib/install_db4.sh `pwd`
BITCOIN_ROOT=$(pwd)
# Pick some path to install BDB to, here we create a directory within the bitcoin directory
BDB_PREFIX="${BITCOIN_ROOT}/db5"
mkdir -p $BDB_PREFIX
# Fetch the source and verify that it is not tampered with
wget 'http://download.oracle.com/berkeley-db/db-5.1.29.NC.tar.gz'
echo '08238e59736d1aacdd47cfb8e68684c695516c37f4fbe1b8267dde58dc3a576c db-5.1.29.NC.tar.gz' | sha256sum -c
# -> db-5.1.29.NC.tar.gz: OK
tar -xzvf db-5.1.29.NC.tar.gz
# Build the library and install to our prefix
cd db-5.1.29.NC/build_unix/
# Note: Do a static build so that it can be embedded into the executable, instead of having to find a .so at runtime
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=$BDB_PREFIX
make install
# Configure Bitcoin Core to use our own-built instance of BDB
cd $BITCOIN_ROOT
./autogen.sh
./configure LDFLAGS="-L${BDB_PREFIX}/lib/" CPPFLAGS="-I${BDB_PREFIX}/include/" # (other args...)
```
from the root of the repository.