I am using Ubuntu 21.04 and have a system BDB installed (5.3): dpkg_bdbd.log and QT5: dpkg_qt.log.
Bitcoin source is at a0988140b71485ad12c3c3a4a9573f7c21b1eff8 (tag v22.0)
make check runs successfully to completion when using
./contrib/install_db4.sh `pwd`
export BDB_PREFIX="/home/will/src/bitcoin/db4"
./autogen.sh
./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" --without-gui
make check -j`nproc`
However, if I enable the gui package then it will fail with a segmentation fault inside a wallet test:
$ rg Error make_check.log
212:2021-11-05Tmake[3]: *** [Makefile:18087: wallet/test/psbt_wallet_tests.cpp.test] Error 1
3088:Error: A version conflict was detected between the run-time BerkeleyDB library and the one used during compilation.
3094:2021-11-05T10:16:58.271290Z [test] [noui.cpp:43] [noui_ThreadSafeMessageBox] Error: A version conflict was detected between the run-time BerkeleyDB library and the one used during compilation.
5964:Error: A version conflict was detected between the run-time BerkeleyDB library and the one used during compilation.
5970:2021-11-05T10:16:58.309941Z [test] [noui.cpp:43] [noui_ThreadSafeMessageBox] Error: A version conflict was detected between the run-time BerkeleyDB library and the one used during compilation.
8793:Error: A version conflict was detected between the run-time BerkeleyDB library and the one used during compilation.
8799:2021-11-05T10:16:58.333933Z [test] [noui.cpp:43] [noui_ThreadSafeMessageBox] Error: A version conflict was detected between the run-time BerkeleyDB library and the one used during compilation.
11533:Error: A version conflict was detected between the run-time BerkeleyDB library and the one used during compilation.
11539:2021-11-05T10:16:58.356529Z [test] [noui.cpp:43] [noui_ThreadSafeMessageBox] Error: A version conflict was detected between the run-time BerkeleyDB library and the one used during compilation.
11559:2021-11-05T10:16:58.357477Z [test] [txmempool.cpp:633] [check] Checking mempool with 0 make[3]: *** [Makefile:18086: wallet/test/wallet_tests.cpp.test] Error 1
This is causing make to hang indefinitely, but one time it ran (somewhat) to completion and wrote the following to test-suite.log (which is usually more empty than this, containing only up to FAIL):
=============================================
Bitcoin Core 22.0.0: src/test-suite.log
=============================================
# TOTAL: 1
# PASS: 0
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0
.. contents:: :depth: 2
FAIL: qt/test/test_bitcoin-qt
=============================
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
********* Start testing of AppTests *********
Config: Using QtTest library 5.15.2, Qt 5.15.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 10.3.0), ubuntu 21.04
PASS : AppTests::initTestCase()
Error: A version conflict was detected between the run-time BerkeleyDB library and the one used during compilation.
QINFO : AppTests::appTests() Backing up GUI settings to "/tmp/test_common_Bitcoin Core/321e4f587b345b4b1fb1314fd08629f45fc98e29e97937449a178d78d0cce606/regtest/guisettings.ini.bak"
Error: A version conflict was detected between the run-time BerkeleyDB library and the one used during compilation.
QWARN : AppTests::appTests() This plugin does not support propagateSizeHints()
=== Received signal at function time: 300000ms, total time: 300000ms, dumping stack ===
GNU gdb (Ubuntu 10.1-2ubuntu2) 10.1.90.20210411-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 81650
(gdb) === End of stack trace ===
QFATAL : AppTests::appTests() Test function timed out
FAIL! : AppTests::appTests() Received a fatal error.
Loc: [Unknown file(0)]
Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 300048ms
********* Finished testing of AppTests *********
FAIL qt/test/test_bitcoin-qt (exit status: 134)
It is reproducible on my system currently, so let me know if there are any more pieces of info I can provide to help. I don't quite understand why BDB 5.3 is being touched at any point, despite them being system-installed...