bitcoin: Unable to build BDB 4.8 on macOS Big Sur beta or Xcode 12.0
Update 22-9-2020: this happens on macOS Catalina as well with Xcode 12.0
Update 9-10-2020; workaround suggested by @willcl-ark:
brew install llvm
export LLVM_PREFIX=$(brew --prefix llvm)
CC=$LLVM_PREFIX/bin/clang CXX=$LLVM_PREFIX/bin/clang++ LDFLAGS="-L$LLVM_PREFIX/opt/llvm/lib -Wl,-rpath,$LLVM_PREFIX/opt/llvm/lib" ./contrib/install_db4.sh .
Update 20-10-2020: better workaround suggested by @fanquake:
CFLAGS="-Wno-error=implicit-function-declaration" ./contrib/install_db4.sh .
For more problems with macOS Big Sur (beta) see #19406.
I’m unable to build Berkeley DB 4.8. When using depends as when using contrib/install_db4.sh
:
checking for mutexes... UNIX/fcntl
configure: WARNING: NO SHARED LATCH IMPLEMENTATION FOUND FOR THIS PLATFORM.
configure: error: Unable to find a mutex implementation
configure.log stdout
from Big Sur beta
config.log on Catalina with Xcode 12.0
I got the same error when compiling for iOs in #12557.
On macOS Catalina it finds the following:
checking for mutexes... POSIX/pthreads/library/x86_64/gcc-assembly
So perhaps something moved or was removed…
Looking at dist/configure
I think I narrowed it down to this check:
#include <pthread.h>
main() {
pthread_cond_t cond;
pthread_mutex_t mutex;
pthread_condattr_t condattr;
pthread_mutexattr_t mutexattr;
exit (
pthread_condattr_init(&condattr) ||
pthread_condattr_setpshared(&condattr, PTHREAD_PROCESS_SHARED) ||
pthread_mutexattr_init(&mutexattr) ||
pthread_mutexattr_setpshared(&mutexattr, PTHREAD_PROCESS_SHARED) ||
pthread_cond_init(&cond, &condattr) ||
pthread_mutex_init(&mutex, &mutexattr) ||
pthread_mutex_lock(&mutex) ||
pthread_mutex_unlock(&mutex) ||
pthread_mutex_destroy(&mutex) ||
pthread_cond_destroy(&cond) ||
pthread_condattr_destroy(&condattr) ||
pthread_mutexattr_destroy(&mutexattr));
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
db_cv_mutex="POSIX/pthreads/library"
fi
If I replace the main()
function body with exit(0);
it still fails, but it’s “happy” when why I use return 0;
. I initially assumed this was a -Werror=return-type
problem, but something like exit(0); return 0;
doesn’t work either. I don’t know how to inspect the compilation output.
I can replace exit
with return
in the above function and it compiles, bitcoind
builds and wallet tests pass.
This suggests an obvious patch, but also a bit of a mystery.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 30 (24 by maintainers)
Commits related to this issue
- build: fix mutex detection when building bdb on macOS Starting with the Clang shipped with Xcode 12, Apple has enabled -Werror=implicit-function-declaration by default. This causes bdbs mutex detecti... — committed to fanquake/bitcoin by fanquake 4 years ago
- build: fix mutex detection when building bdb on macOS Starting with the Clang shipped with Xcode 12, Apple has enabled -Werror=implicit-function-declaration by default. This causes bdbs mutex detecti... — committed to willcl-ark/bitcoin by fanquake 4 years ago
- build: fix mutex detection when building bdb on macOS Starting with the Clang shipped with Xcode 12, Apple has enabled -Werror=implicit-function-declaration by default. This causes bdbs mutex detecti... — committed to fanquake/bitcoin by fanquake 4 years ago
- Merge #20195: build: fix mutex detection when building bdb on macOS d0a829e9632379e42f0be5c554e3b692f0d14a95 build: fix mutex detection when building bdb on macOS (fanquake) Pull request description... — committed to bitcoin/bitcoin by laanwj 4 years ago
- Merge #20195: build: fix mutex detection when building bdb on macOS d0a829e9632379e42f0be5c554e3b692f0d14a95 build: fix mutex detection when building bdb on macOS (fanquake) Pull request description... — committed to syscoin/syscoin by laanwj 4 years ago
- build: fix mutex detection when building bdb on macOS Starting with the Clang shipped with Xcode 12, Apple has enabled -Werror=implicit-function-declaration by default. This causes bdbs mutex detecti... — committed to fanquake/bitcoin by fanquake 4 years ago
- build: fix mutex detection when building bdb on macOS Starting with the Clang shipped with Xcode 12, Apple has enabled -Werror=implicit-function-declaration by default. This causes bdbs mutex detecti... — committed to MarkLTZ/bitcoin by fanquake 4 years ago
- Merge #20195: build: fix mutex detection when building bdb on macOS d0a829e9632379e42f0be5c554e3b692f0d14a95 build: fix mutex detection when building bdb on macOS (fanquake) Pull request description... — committed to xdustinface/dash by laanwj 4 years ago
- build: fix mutex detection when building bdb on macOS Starting with the Clang shipped with Xcode 12, Apple has enabled -Werror=implicit-function-declaration by default. This causes bdbs mutex detecti... — committed to furszy/bitcoin-core by fanquake 4 years ago
- build: fix mutex detection when building bdb on macOS Starting with the Clang shipped with Xcode 12, Apple has enabled -Werror=implicit-function-declaration by default. This causes bdbs mutex detecti... — committed to PRCYCoin/PRCYCoin by lyricidal a year ago
- build: fix mutex detection when building bdb on macOS Starting with the Clang shipped with Xcode 12, Apple has enabled -Werror=implicit-function-declaration by default. This causes bdbs mutex detecti... — committed to PRCYCoin/PRCYCoin by lyricidal a year ago
Another (simpler) workaround:All wallet tests still pass, but the implications of no mutexes in the wallet db are, scary?EDIT: wallet tests do not pass (Was using the wrong db to build Bitcoin Core, had one in src/ and one in src/contrib/)I notice that Core has a specific pthread m4 in
build-aux/m4/ax_pthread.m4
, which seems to be the offending header in the BDB configure, so might investigate the differences if I don’t have any other luck.More promising I think might be to investigate this known issue of Big Sur: