Skip to content

Commit

Permalink
Merge pull request dogecoin#2885 from patricklodder/1.21-db-53
Browse files Browse the repository at this point in the history
1.21: Update to Berkeley DB 5.3
  • Loading branch information
patricklodder authored May 11, 2022
2 parents 3304cbd + 9c58793 commit a8313b8
Show file tree
Hide file tree
Showing 20 changed files with 867 additions and 223 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ task:
name: 'macOS 10.14 native [GOAL: install] [GUI] [no depends]'
brew_install_script:
- brew update
- brew install boost libevent berkeley-db4 qt@5 miniupnpc ccache zeromq qrencode sqlite libtool automake pkg-config gnu-getopt
- brew install boost libevent qt@5 miniupnpc ccache zeromq qrencode sqlite libtool automake pkg-config gnu-getopt
<< : *GLOBAL_TASK_TEMPLATE
osx_instance:
# Use latest image, but hardcode version to avoid silent upgrades (and breaks)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
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])
if test "x$BDB_CFLAGS" = "x"; then
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
Expand All @@ -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
Expand All @@ -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}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ci/test/00_setup_env_i686_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 2 additions & 1 deletion ci/test/00_setup_env_mac_host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export LC_ALL=C.UTF-8
export HOST=x86_64-apple-darwin16
export PIP_PACKAGES="zmq"
export GOAL="install"
export BITCOIN_CONFIG="--with-gui --enable-reduce-exports --with-boost-process"
export BDB_PREFIX="${BASE_ROOT_DIR}/db5"
export BITCOIN_CONFIG="--with-gui --enable-reduce-exports --with-boost-process BDB_LIBS='-L${BDB_PREFIX}/lib -ldb_cxx-5.3' BDB_CFLAGS='-I${BDB_PREFIX}/include'"
export CI_OS_NAME="macos"
export NO_DEPENDS=1
export OSX_SDK=""
Expand Down
4 changes: 2 additions & 2 deletions ci/test/00_setup_env_native_msan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 7 additions & 2 deletions ci/test/05_before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ 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 [[ $HOST = *-apple-darwin16 ]]; then
# Use BDB compiled using install_db5.sh script as Brew does not supply BDB 5.3
DOCKER_EXEC "contrib/install_db5.sh \$BASE_ROOT_DIR --enable-posixmutexes"
fi

if [ -n "$XCODE_VERSION" ] && [ -f "$OSX_SDK_PATH" ]; then
Expand Down
10 changes: 5 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
106 changes: 0 additions & 106 deletions contrib/install_db4.sh

This file was deleted.

Loading

0 comments on commit a8313b8

Please sign in to comment.