Undefined reference to txn_abort/txn_begin/txn_commit

Russ Allbery rra at stanford.edu
Mon Jan 26 22:39:01 UTC 2004


Marco d'Itri <md at Linux.IT> writes:

> I had to add these to storage/ovdb/ovdb.c to compile inn with the debian
> libdb 4.1 package:

> #define txn_begin __txn_begin_4001
> #define txn_commit __txn_commit_4001
> #define txn_abort __txn_abort_4001

> I don't know if this actually works, the libdb maintainer has not been
> cooperative and since nobody complained I did not investingate this
> further.

Could you try this patch instead?  I think I understand what's going on;
the change towards making txn_begin and friends methods rather than
functions was actually put in place with 4.0.  I think this should fix the
problem without requiring the above workaround.

The other person who was having compilation problems with ovdb should try
this patch instead of the earlier one that I sent, since it will work
correctly with the version of BerkeleyDB you had installed.

--- inn/storage/ovdb/ovdb-private.h	2003/03/13 09:22:47	1.13
+++ inn/storage/ovdb/ovdb-private.h	2004/01/26 22:37:56
@@ -188,8 +188,7 @@ label: { \
 
 #define TRYAGAIN EAGAIN
 
-#else
-/* version 3 */
+#elif DB_VERSION_MAJOR == 3
 
 #define TXN_START(label, tid) \
 label: { \
@@ -209,6 +208,26 @@ label: { \
 
 #define TRYAGAIN DB_LOCK_DEADLOCK
 
-#endif /* DB_VERSION_MAJOR == 2 */
+#else /* DB_VERSION_MAJOR == 4 */
+
+#define TXN_START(label, tid) \
+label: { \
+  int txn_ret; \
+  txn_ret = OVDBenv->txn_begin(OVDBenv, NULL, &tid, 0); \
+  if (txn_ret != 0) { \
+    syslog(L_ERROR, "OVDB: " #label " txn_begin: %s", db_strerror(ret)); \
+    tid = NULL; \
+  } \
+}
+
+#define TXN_RETRY(label, tid) \
+{ (tid)->abort(tid); goto label; }
+
+#define TXN_ABORT(label, tid) (tid)->abort(tid)
+#define TXN_COMMIT(label, tid) (tid)->commit(tid, 0)
+
+#define TRYAGAIN DB_LOCK_DEADLOCK
+
+#endif /* DB_VERSION_MAJOR == 4 */
 
 #endif /* USE_BERKELEY_DB */

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list