I’ve been following guides like this one, to run a bitcoin node, but upon compiling Berkeley DB 4.8.30 on my Ubuntu virtual machine, I kept getting the error:

 

ln -s libdb-4.8.a libdb.a
./libtool --mode=compile g++ -c -I. -I../dist/..  -D_GNU_SOURCE -D_REENTRANT -O ../dist/../cxx/cxx_db.cpp
libtool: compile:  g++ -c -I. -I../dist/.. -D_GNU_SOURCE -D_REENTRANT -O ../dist/../cxx/cxx_db.cpp  -fPIC -DPIC -o cxx_db.o
In file included from ../dist/../dbinc/mutex_int.h:12,
                 from ../dist/../dbinc/mutex.h:15,
                 from ./db_int.h:884,
                 from ../dist/../cxx/cxx_db.cpp:11:
../dist/../dbinc/atomic.h:179:19: error: definition of 'int __atomic_compare_exchange(db_atomic_t*, atomic_value_t, atomic_value_t)' ambiguates built-in declaration 'bool __atomic_compare_exchange(long unsigned int, volatile void*, void*, void*, int, int)'
 static inline int __atomic_compare_exchange(
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:2018: cxx_db.o] Error 1

The solution is to edit the fileĀ  db-4.8.30.NC/dbinc/atomic.h.

 

Line 147, replace __atomic_compare_exchange((p), (o), (n)) with __atomic_compare_exchange_db((p), (o), (n))

Line 179, replace static inline int __atomic_compare_exchange( with static inline int __atomic_compare_exchange_db(

 

Hope this helps.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.