Update 22-9-2020: this happens on macOS Catalina as well with Xcode 12.0
Update 9-10-2020; workaround suggested by @willcl-ark:
0brew install llvm
1export LLVM_PREFIX=$(brew --prefix llvm)
2CC=$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:
0CFLAGS="-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
:
0checking for mutexes... UNIX/fcntl
1configure: WARNING: NO SHARED LATCH IMPLEMENTATION FOUND FOR THIS PLATFORM.
2configure: 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:
0checking 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:
0#include <pthread.h>
1main() {
2 pthread_cond_t cond;
3 pthread_mutex_t mutex;
4 pthread_condattr_t condattr;
5 pthread_mutexattr_t mutexattr;
6 exit (
7 pthread_condattr_init(&condattr) ||
8 pthread_condattr_setpshared(&condattr, PTHREAD_PROCESS_SHARED) ||
9 pthread_mutexattr_init(&mutexattr) ||
10 pthread_mutexattr_setpshared(&mutexattr, PTHREAD_PROCESS_SHARED) ||
11 pthread_cond_init(&cond, &condattr) ||
12 pthread_mutex_init(&mutex, &mutexattr) ||
13 pthread_mutex_lock(&mutex) ||
14 pthread_mutex_unlock(&mutex) ||
15 pthread_mutex_destroy(&mutex) ||
16 pthread_cond_destroy(&cond) ||
17 pthread_condattr_destroy(&condattr) ||
18 pthread_mutexattr_destroy(&mutexattr));
19}
20_ACEOF
21if ac_fn_c_try_run "$LINENO"; then :
22 db_cv_mutex="POSIX/pthreads/library"
23fi
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.