Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Berkeley DB 4.8 patch for compilers that have __atomic_compare_exchange.
Binary files dbxml-2.5.16.orig/db-4.8.26/dbinc/.atomic.h.un~ and dbxml-2.5.16/db-4.8.26/dbinc/.atomic.h.un~ differ
diff -ruN dbxml-2.5.16.orig/db-4.8.26/dbinc/atomic.h dbxml-2.5.16/db-4.8.26/dbinc/atomic.h
--- dbxml-2.5.16.orig/db-4.8.26/dbinc/atomic.h 2013-06-03 21:04:07.000000000 +0200
+++ dbxml-2.5.16/db-4.8.26/dbinc/atomic.h 2013-06-03 21:10:53.000000000 +0200
@@ -144,7 +144,7 @@
#define atomic_inc(env, p) __atomic_inc(p)
#define atomic_dec(env, p) __atomic_dec(p)
#define atomic_compare_exchange(env, p, o, n) \
- __atomic_compare_exchange((p), (o), (n))
+ __atomic_compare_exchange_db((p), (o), (n))
static inline int __atomic_inc(db_atomic_t *p)
int temp;
@@ -176,7 +176,7 @@
* which configure could be changed to use.
-static inline int __atomic_compare_exchange(
+static inline int __atomic_compare_exchange_db(
db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
atomic_value_t was;
Copy link

danieldk commented Jan 25, 2020

...or just use patch. From the main dbxml directory:

patch -p1 < gistfile1.txt 

Copy link

nerdlabs001 commented May 26, 2021

I had to change lines 9 AND 18 from the commit above but now im good to go , Thanks all =)

Copy link

DavidDevGit commented May 29, 2021

How do I apply this patch?

Navigate to the file atomic.h that is in the dbinc directory. Somewhere around line 147, you will see _atomic_compare_exchange((p), (o), (n)) (as in line 9 above). Change that line to be __atomic_compare_exchange_db((p), (o), (n)). You are just adding a _db at the end of the function name.

You will also do something simolar around line 179. After that, re-run make to build Berkeley DB 4.8.

clear, concise instructions. This worked for me. Thank you

Copy link

Edison4mobile commented Aug 6, 2021

You can just run sed -i 's/__atomic_compare_exchange/__atomic_compare_exchange_db/g' db-4.8.30.NC/dbinc/atomic.h

great thanks

Copy link

Hongdeshuai commented Feb 25, 2022

Yeah, it works perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment