Update to Berkeley DB 5.3

Old BerkeleyDB version such as 5.1 are being removed from most Linux
distribution.

See: https://bugs.gentoo.org/792222
See: https://fedoraproject.org/wiki/Changes/Libdb_deprecated
This commit is contained in:
Bertrand Jacquin 2021-08-21 23:45:41 +01:00 committed by Patrick Lodder
parent b37577b710
commit 942496a117
No known key found for this signature in database
GPG Key ID: 2D3A345B98D0DC1F
14 changed files with 117 additions and 123 deletions

View File

@ -1,8 +1,9 @@
dnl Copyright (c) 2013-2015 The Bitcoin Core developers
dnl Copyright (c) 2018-2021 The Dogecoin Core developers
dnl Distributed under the MIT software license, see the accompanying
dnl file COPYING or http://www.opensource.org/licenses/mit-license.php.
AC_DEFUN([BITCOIN_FIND_BDB48],[
AC_DEFUN([BITCOIN_FIND_BDB53],[
AC_ARG_VAR(BDB_CFLAGS, [C compiler flags for BerkeleyDB, bypasses autodetection])
AC_ARG_VAR(BDB_LIBS, [Linker flags for BerkeleyDB, bypasses autodetection])
@ -10,9 +11,9 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
AC_MSG_CHECKING([for Berkeley DB C++ headers])
BDB_CPPFLAGS=
bdbpath=X
bdb48path=X
bdb53path=X
bdbdirlist=
for _vn in 4.8 48 4 5 5.3 ''; do
for _vn in 5.3 53 5 4.8 48 4 ''; do
for _pfx in b lib ''; do
bdbdirlist="$bdbdirlist ${_pfx}db${_vn}"
done
@ -22,8 +23,8 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <${searchpath}db_cxx.h>
]],[[
#if !((DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 8) || DB_VERSION_MAJOR > 4)
#error "failed to find bdb 4.8+"
#if !((DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR >= 3) || DB_VERSION_MAJOR > 5)
#error "failed to find bdb 5.3+"
#endif
]])],[
if test "x$bdbpath" = "xX"; then
@ -35,27 +36,27 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <${searchpath}db_cxx.h>
]],[[
#if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8)
#error "failed to find bdb 4.8"
#if !(DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR == 3)
#error "failed to find bdb 5.3"
#endif
]])],[
bdb48path="${searchpath}"
bdb53path="${searchpath}"
break
],[])
done
if test "x$bdbpath" = "xX"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([libdb_cxx headers missing, ]AC_PACKAGE_NAME[ requires this library for wallet functionality (--disable-wallet to disable wallet functionality)])
elif test "x$bdb48path" = "xX"; then
elif test "x$bdb53path" = "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 4.8])],[
AC_MSG_WARN([Found Berkeley DB other than 4.8; wallets opened by this build will not be portable!])
AC_ARG_WITH([incompatible-bdb],[AS_HELP_STRING([--with-incompatible-bdb], [allow using a bdb version other than 5.3])],[
AC_MSG_WARN([Found Berkeley DB other than 5.3; wallets opened by this build will not be portable!])
],[
AC_MSG_ERROR([Found Berkeley DB other than 4.8, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)])
AC_MSG_ERROR([Found Berkeley DB other than 5.3, required for portable wallets (--with-incompatible-bdb to ignore or --disable-wallet to disable wallet functionality)])
])
else
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb48path}],db_cxx)
bdbpath="${bdb48path}"
BITCOIN_SUBDIR_TO_INCLUDE(BDB_CPPFLAGS,[${bdb53path}],db_cxx)
bdbpath="${bdb53path}"
fi
else
BDB_CPPFLAGS=${BDB_CFLAGS}
@ -64,7 +65,7 @@ AC_DEFUN([BITCOIN_FIND_BDB48],[
if test "x$BDB_LIBS" = "x"; then
# TODO: Ideally this could find the library version and make sure it matches the headers being used
for searchlib in db_cxx-4.8 db_cxx db4_cxx; do
for searchlib in db_cxx-5.3 db_cxx db5_cxx; do
AC_CHECK_LIB([$searchlib],[main],[
BDB_LIBS="-l${searchlib}"
break

View File

@ -11,5 +11,5 @@ export CONTAINER_NAME=ci_i686_centos_7
export DOCKER_NAME_TAG=centos:7
export DOCKER_PACKAGES="gcc-c++ glibc-devel.x86_64 libstdc++-devel.x86_64 glibc-devel.i686 libstdc++-devel.i686 ccache libtool make git python3 python36-devel python36-zmq which patch lbzip2 dash"
export GOAL="install"
export BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-reduce-exports --with-boost-process"
export BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-reduce-exports --with-incompatible-bdb --with-boost-process"
export CONFIG_SHELL="/bin/dash"

View File

@ -11,13 +11,13 @@ LIBCXX_DIR="${BASE_ROOT_DIR}/ci/scratch/msan/build/"
export MSAN_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -g -O1 -fno-optimize-sibling-calls"
LIBCXX_FLAGS="-nostdinc++ -stdlib=libc++ -L${LIBCXX_DIR}lib -lc++abi -I${LIBCXX_DIR}include -I${LIBCXX_DIR}include/c++/v1 -lpthread -Wl,-rpath,${LIBCXX_DIR}lib -Wno-unused-command-line-argument"
export MSAN_AND_LIBCXX_FLAGS="${MSAN_FLAGS} ${LIBCXX_FLAGS}"
export BDB_PREFIX="${BASE_ROOT_DIR}/db4"
export BDB_PREFIX="${BASE_ROOT_DIR}/db5"
export CONTAINER_NAME="ci_native_msan"
export PACKAGES="clang-9 llvm-9 cmake"
export DEP_OPTS="NO_BDB=1 NO_QT=1 CC='clang' CXX='clang++' CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' boost_cxxflags='-std=c++11 -fvisibility=hidden -fPIC ${MSAN_AND_LIBCXX_FLAGS}' zeromq_cxxflags='-std=c++11 ${MSAN_AND_LIBCXX_FLAGS}'"
export GOAL="install"
export BITCOIN_CONFIG="--enable-wallet --with-sanitizers=memory --with-asm=no --prefix=${BASE_ROOT_DIR}/depends/x86_64-pc-linux-gnu/ CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' BDB_LIBS='-L${BDB_PREFIX}/lib -ldb_cxx-4.8' BDB_CFLAGS='-I${BDB_PREFIX}/include'"
export BITCOIN_CONFIG="--enable-wallet --with-sanitizers=memory --with-asm=no --prefix=${BASE_ROOT_DIR}/depends/x86_64-pc-linux-gnu/ CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}' BDB_LIBS='-L${BDB_PREFIX}/lib -ldb_cxx-5.3' BDB_CFLAGS='-I${BDB_PREFIX}/include'"
export USE_MEMORY_SANITIZER="true"
export RUN_FUNCTIONAL_TESTS="false"
export CCACHE_SIZE=250M

View File

@ -25,10 +25,10 @@ if [ -n "$XCODE_VERSION" ] && [ ! -f "$OSX_SDK_PATH" ]; then
fi
if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
# Use BDB compiled using install_db4.sh script to work around linking issue when using BDB
# Use BDB compiled using install_db5.sh script to work around linking issue when using BDB
# from depends. See https://github.com/bitcoin/bitcoin/pull/18288#discussion_r433189350 for
# details.
DOCKER_EXEC "contrib/install_db4.sh \$(pwd) --enable-umrw CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'"
DOCKER_EXEC "contrib/install_db5.sh \$(pwd) --enable-umrw CC=clang CXX=clang++ CFLAGS='${MSAN_FLAGS}' CXXFLAGS='${MSAN_AND_LIBCXX_FLAGS}'"
fi
if [ -n "$XCODE_VERSION" ] && [ -f "$OSX_SDK_PATH" ]; then

View File

@ -652,11 +652,11 @@ case $host in
dnl It's safe to add these paths even if the functionality is disabled by
dnl the user (--without-wallet or --without-gui for example).
if test "x$use_bdb" != xno && $BREW list --versions berkeley-db4 >/dev/null && test "x$BDB_CFLAGS" = "x" && test "x$BDB_LIBS" = "x"; then
bdb_prefix=$($BREW --prefix berkeley-db4 2>/dev/null)
dnl This must precede the call to BITCOIN_FIND_BDB48 below.
if test "x$use_bdb" != xno && $BREW list --versions berkeley-db5 >/dev/null && test "x$BDB_CFLAGS" = "x" && test "x$BDB_LIBS" = "x"; then
bdb_prefix=$($BREW --prefix berkeley-db5 2>/dev/null)
dnl This must precede the call to BITCOIN_FIND_BDB53 below.
BDB_CFLAGS="-I$bdb_prefix/include"
BDB_LIBS="-L$bdb_prefix/lib -ldb_cxx-4.8"
BDB_LIBS="-L$bdb_prefix/lib -ldb_cxx-5.3"
fi
if test "x$use_sqlite" != xno && $BREW list --versions sqlite3 >/dev/null; then
@ -1233,7 +1233,7 @@ fi
if test x$enable_wallet != xno; then
dnl Check for libdb_cxx only if wallet enabled
BITCOIN_FIND_BDB48
BITCOIN_FIND_BDB53
if test x$suppress_external_warnings != xno ; then
BDB_CPPFLAGS=SUPPRESS_WARNINGS($BDB_CPPFLAGS)
fi

View File

@ -1,9 +1,10 @@
#!/bin/sh
# Copyright (c) 2017-2019 The Bitcoin Core developers
# Copyright (c) 2021 The Dogecoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Install libdb4.8 (Berkeley DB).
# Install libdb5.3 (Berkeley DB).
export LC_ALL=C
set -e
@ -11,7 +12,7 @@ set -e
if [ -z "${1}" ]; then
echo "Usage: $0 <base-dir> [<extra-bdb-configure-flag> ...]"
echo
echo "Must specify a single argument: the directory in which db4 will be built."
echo "Must specify a single argument: the directory in which db5 will be built."
echo "This is probably \`pwd\` if you're at the root of the bitcoin repository."
exit 1
fi
@ -20,9 +21,9 @@ expand_path() {
cd "${1}" && pwd -P
}
BDB_PREFIX="$(expand_path ${1})/db4"; shift;
BDB_VERSION='db-4.8.30.NC'
BDB_HASH='12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef'
BDB_PREFIX="$(expand_path ${1})/db5"; shift;
BDB_VERSION='db-5.3.28.NC'
BDB_HASH='76a25560d9e52a198d37a31440fd07632b5f1f8f9f2b6d5438f4bc3e7c9013ef'
BDB_URL="https://download.oracle.com/berkeley-db/${BDB_VERSION}.tar.gz"
check_exists() {
@ -67,26 +68,6 @@ http_get "${BDB_URL}" "${BDB_VERSION}.tar.gz" "${BDB_HASH}"
tar -xzvf ${BDB_VERSION}.tar.gz -C "$BDB_PREFIX"
cd "${BDB_PREFIX}/${BDB_VERSION}/"
# Apply a patch necessary when building with clang and c++11 (see https://community.oracle.com/thread/3952592)
CLANG_CXX11_PATCH_URL='https://gist.githubusercontent.com/LnL7/5153b251fd525fe15de69b67e63a6075/raw/7778e9364679093a32dec2908656738e16b6bdcb/clang.patch'
CLANG_CXX11_PATCH_HASH='7a9a47b03fd5fb93a16ef42235fa9512db9b0829cfc3bdf90edd3ec1f44d637c'
http_get "${CLANG_CXX11_PATCH_URL}" clang.patch "${CLANG_CXX11_PATCH_HASH}"
patch -p2 < clang.patch
# The packaged config.guess and config.sub are ancient (2009) and can cause build issues.
# Replace them with modern versions.
# See https://github.com/bitcoin/bitcoin/issues/16064
CONFIG_GUESS_URL='https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=55eaf3e779455c4e5cc9f82efb5278be8f8f900b'
CONFIG_GUESS_HASH='2d1ff7bca773d2ec3c6217118129220fa72d8adda67c7d2bf79994b3129232c1'
CONFIG_SUB_URL='https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=55eaf3e779455c4e5cc9f82efb5278be8f8f900b'
CONFIG_SUB_HASH='3a4befde9bcdf0fdb2763fc1bfa74e8696df94e1ad7aac8042d133c8ff1d2e32'
rm -f "dist/config.guess"
rm -f "dist/config.sub"
http_get "${CONFIG_GUESS_URL}" dist/config.guess "${CONFIG_GUESS_HASH}"
http_get "${CONFIG_SUB_URL}" dist/config.sub "${CONFIG_SUB_HASH}"
cd build_unix/
"${BDB_PREFIX}/${BDB_VERSION}/dist/configure" \
@ -96,11 +77,11 @@ cd build_unix/
make install
echo
echo "db4 build complete."
echo "db5 build complete."
echo
# shellcheck disable=SC2016
echo 'When compiling bitcoind, run `./configure` in the following way:'
echo
echo " export BDB_PREFIX='${BDB_PREFIX}'"
# shellcheck disable=SC2016
echo ' ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" ...'
echo ' ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-5.3" BDB_CFLAGS="-I${BDB_PREFIX}/include" ...'

View File

@ -1,10 +1,10 @@
package=bdb
$(package)_version=4.8.30
$(package)_download_path=https://download.oracle.com/berkeley-db
$(package)_version=5.3.28
$(package)_download_path=http://download.oracle.com/berkeley-db
$(package)_file_name=db-$($(package)_version).NC.tar.gz
$(package)_sha256_hash=12edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef
$(package)_sha256_hash=76a25560d9e52a198d37a31440fd07632b5f1f8f9f2b6d5438f4bc3e7c9013ef
$(package)_build_subdir=build_unix
$(package)_patches=clang_cxx_11.patch
$(package)_patches=clang_cxx_11.patch winioctl.patch
define $(package)_set_vars
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication --enable-option-checking
@ -17,6 +17,7 @@ endef
define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/clang_cxx_11.patch && \
patch -p1 < $($(package)_patch_dir)/winioctl.patch && \
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub dist
endef
@ -25,7 +26,7 @@ define $(package)_config_cmds
endef
define $(package)_build_cmds
$(MAKE) libdb_cxx-4.8.a libdb-4.8.a
$(MAKE) libdb_cxx-5.3.a libdb-5.3.a
endef
define $(package)_stage_cmds

View File

@ -1,13 +1,7 @@
commit 3311d68f11d1697565401eee6efc85c34f022ea7
Author: fanquake <fanquake@gmail.com>
Date: Mon Aug 17 20:03:56 2020 +0800
Fix C++11 compatibility
diff --git a/dbinc/atomic.h b/dbinc/atomic.h
index 0034dcc..7c11d4a 100644
--- a/dbinc/atomic.h
+++ b/dbinc/atomic.h
diff --git a/src/dbinc/atomic.h b/src/dbinc/atomic.h
index 6a858f7..9f338dc 100644
--- a/src/dbinc/atomic.h
+++ b/src/dbinc/atomic.h
@@ -70,7 +70,7 @@ typedef struct {
* These have no memory barriers; the caller must include them when necessary.
*/
@ -44,11 +38,11 @@ index 0034dcc..7c11d4a 100644
#else
#define atomic_inc(env, p) __atomic_inc(env, p)
#define atomic_dec(env, p) __atomic_dec(env, p)
diff --git a/mp/mp_fget.c b/mp/mp_fget.c
index 5fdee5a..0b75f57 100644
--- a/mp/mp_fget.c
+++ b/mp/mp_fget.c
@@ -617,7 +617,7 @@ alloc: /* Allocate a new buffer header and data space. */
diff --git a/src/mp/mp_fget.c b/src/mp/mp_fget.c
index 16de695..d0dcc29 100644
--- a/src/mp/mp_fget.c
+++ b/src/mp/mp_fget.c
@@ -649,7 +649,7 @@ alloc: /* Allocate a new buffer header and data space. */
/* Initialize enough so we can call __memp_bhfree. */
alloc_bhp->flags = 0;
@ -56,9 +50,9 @@ index 5fdee5a..0b75f57 100644
+ atomic_init_db(&alloc_bhp->ref, 1);
#ifdef DIAGNOSTIC
if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
__db_errx(env,
@@ -911,7 +911,7 @@ alloc: /* Allocate a new buffer header and data space. */
MVCC_MPROTECT(bhp->buf, mfp->stat.st_pagesize,
__db_errx(env, DB_STR("3025",
@@ -955,7 +955,7 @@ alloc: /* Allocate a new buffer header and data space. */
MVCC_MPROTECT(bhp->buf, mfp->pagesize,
PROT_READ);
- atomic_init(&alloc_bhp->ref, 1);
@ -66,10 +60,10 @@ index 5fdee5a..0b75f57 100644
MUTEX_LOCK(env, alloc_bhp->mtx_buf);
alloc_bhp->priority = bhp->priority;
alloc_bhp->pgno = bhp->pgno;
diff --git a/mp/mp_mvcc.c b/mp/mp_mvcc.c
index 34467d2..f05aa0c 100644
--- a/mp/mp_mvcc.c
+++ b/mp/mp_mvcc.c
diff --git a/src/mp/mp_mvcc.c b/src/mp/mp_mvcc.c
index 770bad8..e28cce0 100644
--- a/src/mp/mp_mvcc.c
+++ b/src/mp/mp_mvcc.c
@@ -276,7 +276,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
#else
memcpy(frozen_bhp, bhp, SSZA(BH, buf));
@ -88,11 +82,11 @@ index 34467d2..f05aa0c 100644
F_CLR(alloc_bhp, BH_FROZEN);
}
diff --git a/mp/mp_region.c b/mp/mp_region.c
index e6cece9..ddbe906 100644
--- a/mp/mp_region.c
+++ b/mp/mp_region.c
@@ -224,7 +224,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
diff --git a/src/mp/mp_region.c b/src/mp/mp_region.c
index 4952030..47645f8 100644
--- a/src/mp/mp_region.c
+++ b/src/mp/mp_region.c
@@ -245,7 +245,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
return (ret);
SH_TAILQ_INIT(&htab[i].hash_bucket);
@ -101,20 +95,20 @@ index e6cece9..ddbe906 100644
}
/*
@@ -269,7 +269,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
hp->mtx_hash = (mtx_base == MUTEX_INVALID) ? MUTEX_INVALID :
mtx_base + i;
@@ -302,7 +302,7 @@ no_prealloc:
} else
hp->mtx_hash = mtx_base + (i % dbenv->mp_mtxcount);
SH_TAILQ_INIT(&hp->hash_bucket);
- atomic_init(&hp->hash_page_dirty, 0);
+ atomic_init_db(&hp->hash_page_dirty, 0);
#ifdef HAVE_STATISTICS
hp->hash_io_wait = 0;
hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
diff --git a/mutex/mut_method.c b/mutex/mut_method.c
index 2588763..5c6d516 100644
--- a/mutex/mut_method.c
+++ b/mutex/mut_method.c
@@ -426,7 +426,7 @@ atomic_compare_exchange(env, v, oldval, newval)
diff --git a/src/mutex/mut_method.c b/src/mutex/mut_method.c
index 09353b0..177353c 100644
--- a/src/mutex/mut_method.c
+++ b/src/mutex/mut_method.c
@@ -474,7 +474,7 @@ atomic_compare_exchange(env, v, oldval, newval)
MUTEX_LOCK(env, mtx);
ret = atomic_read(v) == oldval;
if (ret)
@ -123,11 +117,11 @@ index 2588763..5c6d516 100644
MUTEX_UNLOCK(env, mtx);
return (ret);
diff --git a/mutex/mut_tas.c b/mutex/mut_tas.c
index f3922e0..e40fcdf 100644
--- a/mutex/mut_tas.c
+++ b/mutex/mut_tas.c
@@ -46,7 +46,7 @@ __db_tas_mutex_init(env, mutex, flags)
diff --git a/src/mutex/mut_tas.c b/src/mutex/mut_tas.c
index 106b161..fc4de9d 100644
--- a/src/mutex/mut_tas.c
+++ b/src/mutex/mut_tas.c
@@ -47,7 +47,7 @@ __db_tas_mutex_init(env, mutex, flags)
#ifdef HAVE_SHARED_LATCHES
if (F_ISSET(mutexp, DB_MUTEX_SHARED))
@ -136,7 +130,7 @@ index f3922e0..e40fcdf 100644
else
#endif
if (MUTEX_INIT(&mutexp->tas)) {
@@ -486,7 +486,7 @@ __db_tas_mutex_unlock(env, mutex)
@@ -536,7 +536,7 @@ __db_tas_mutex_unlock(env, mutex)
F_CLR(mutexp, DB_MUTEX_LOCKED);
/* Flush flag update before zeroing count */
MEMBAR_EXIT();

View File

@ -0,0 +1,13 @@
diff --git a/src/dbinc/win_db.h b/src/dbinc/win_db.h
index 6544558..6cb6878 100644
--- a/src/dbinc/win_db.h
+++ b/src/dbinc/win_db.h
@@ -46,7 +46,7 @@
#include <windows.h>
#include <winsock2.h>
#ifndef DB_WINCE
-#include <WinIoCtl.h>
+#include <winioctl.h>
#endif
#ifdef HAVE_GETADDRINFO

View File

@ -30,8 +30,8 @@ BerkeleyDB is only necessary for the wallet functionality. To skip this, pass
`--disable-wallet` to `./configure` and skip to the next section.
```bash
./contrib/install_db4.sh `pwd`
export BDB_PREFIX="$PWD/db4"
./contrib/install_db5.sh `pwd`
export BDB_PREFIX="$PWD/db5"
```
## Building Bitcoin Core

View File

@ -35,16 +35,16 @@ BerkeleyDB is only necessary for the wallet functionality. To skip this, pass
It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library
from ports, for the same reason as boost above (g++/libstd++ incompatibility).
If you have to build it yourself, you can use [the installation script included
in contrib/](/contrib/install_db4.sh) like so:
in contrib/](/contrib/install_db5.sh) like so:
```bash
./contrib/install_db4.sh `pwd`
./contrib/install_db5.sh `pwd`
```
from the root of the repository. Then set `BDB_PREFIX` for the next section:
```bash
export BDB_PREFIX="$PWD/db4"
export BDB_PREFIX="$PWD/db5"
```
### Building Bitcoin Core

View File

@ -35,16 +35,16 @@ BerkeleyDB is only necessary for the wallet functionality. To skip this, pass
It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library
from ports, for the same reason as boost above (g++/libstd++ incompatibility).
If you have to build it yourself, you can use [the installation script included
in contrib/](/contrib/install_db4.sh) like so:
in contrib/](/contrib/install_db5.sh) like so:
```bash
./contrib/install_db4.sh `pwd` CC=cc CXX=c++
./contrib/install_db5.sh `pwd` CC=cc CXX=c++
```
from the root of the repository. Then set `BDB_PREFIX` for the next section:
```bash
export BDB_PREFIX="$PWD/db4"
export BDB_PREFIX="$PWD/db5"
```
### Building Bitcoin Core

View File

@ -46,12 +46,12 @@ In that case the Homebrew package will prevail.
#### Berkeley DB
It is recommended to use Berkeley DB 4.8. If you have to build it yourself,
you can use [this](/contrib/install_db4.sh) script to install it
It is recommended to use Berkeley DB 5.3. If you have to build it yourself,
you can use [this](/contrib/install_db5.sh) script to install it
like so:
```shell
./contrib/install_db4.sh .
./contrib/install_db5.sh .
```
from the root of the repository.
@ -59,7 +59,7 @@ from the root of the repository.
Also, the Homebrew package could be installed:
```shell
brew install berkeley-db4
brew install berkeley-db5
```
## Build Bitcoin Core

View File

@ -41,7 +41,7 @@ Optional dependencies:
Library | Purpose | Description
------------|------------------|----------------------
miniupnpc | UPnP Support | Firewall-jumping support
libdb4.8 | Berkeley DB | Wallet storage (only needed when wallet enabled)
libdb5.3 | Berkeley DB | Wallet storage (only needed when wallet enabled)
qt | GUI | GUI toolkit (only needed when GUI enabled)
libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled)
univalue | Utility | JSON parsing and encoding (bundled version will be used unless --with-system-univalue passed to configure)
@ -85,10 +85,14 @@ Now, you can either build from self-compiled [depends](/depends/README.md) or in
BerkeleyDB is required for the wallet.
Ubuntu and Debian have their own `libdb-dev` and `libdb++-dev` packages, but these will install
BerkeleyDB 5.1 or later. This will 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.
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.3. You
will have to manually download 5.3 from
http://download.oracle.com/berkeley-db/db-5.3.28.NC.tar.gz and compile
it, install it to /usr/local where the configure script should locate it
automatically.
If you do not care about wallet compatibility, pass `--with-incompatible-bdb` to configure.
Otherwise, you can build from self-compiled `depends` (see above).
@ -131,7 +135,7 @@ built by default.
Build requirements:
sudo dnf install gcc-c++ libtool make autoconf automake libevent-devel boost-devel libdb4-devel libdb4-cxx-devel python3
sudo dnf install gcc-c++ libtool make autoconf automake libevent-devel boost-devel libdb5-devel libdb5-cxx-devel python3
Optional (see `--with-miniupnpc` and `--enable-upnp-default`):
@ -173,12 +177,12 @@ 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)
It is recommended to use Berkeley DB 5.3. If you have to build it yourself,
you can use [the installation script included in contrib/](/contrib/install_db5.sh)
like so:
```shell
./contrib/install_db4.sh `pwd`
./contrib/install_db5.sh `pwd`
```
from the root of the repository.
@ -247,7 +251,7 @@ disable-wallet mode with:
./configure --disable-wallet
In this case there is no dependency on Berkeley DB 4.8 and SQLite.
In this case there is no dependency on Berkeley DB 5.3 and SQLite.
Mining is also possible in disable-wallet mode using the `getblocktemplate` RPC call.
@ -270,11 +274,11 @@ This example lists the steps necessary to setup and build a command line only, n
make check
Note:
Enabling wallet support requires either compiling against a Berkeley DB newer than 4.8 (package `db`) using `--with-incompatible-bdb`,
or building and depending on a local version of Berkeley DB 4.8. The readily available Arch Linux packages are currently built using
Enabling wallet support requires either compiling against a Berkeley DB newer than 5.3 (package `db`) using `--with-incompatible-bdb`,
or building and depending on a local version of Berkeley DB 5.3. The readily available Arch Linux packages are currently built using
`--with-incompatible-bdb` according to the [PKGBUILD](https://projects.archlinux.org/svntogit/community.git/tree/bitcoin/trunk/PKGBUILD).
As mentioned above, when maintaining portability of the wallet between the standard Bitcoin Core distributions and independently built
node software is desired, Berkeley DB 4.8 must be used.
node software is desired, Berkeley DB 5.3 must be used.
ARM Cross-compilation