Skip to content

Unable to build BDB 4.8 on macOS Big Sur beta or Xcode 12.0 #19411

@Sjors

Description

@Sjors

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions