[milters] Archive

Lists Index Date Thread Search

Article: 535
From: Mike
Date: 2005-05-03 05:04:19 -0400
Subject: Problem compiling libsnert & milter-sender on SuSE 9.3 (db related)

Removal...........: milters-request@milter.info?subject=remove
More information..: http://www.milter.info/#Support
--------------------------------------------------------

Hi,

I just upgraded a test mail server from SuSE 9.2 to SuSE 9.3 (fresh install) and I'm
having problems compiling libsnert & milter-sender. The problems are DB related. The
following db packages are installed:

==================================================
db-4.3.27-3
db-devel-4.3.27-3
db-utils-4.3.27-3
db1-1.85-89
db1-devel-1.85-89
db40-4.0.14-152
db40-devel-4.0.14-152
db41-4.1.25-76
db41-devel-4.1.25-76
db42-4.2.52-3
db42-devel-4.2.52-3
==================================================

Multiple db's are installed, because of compatibility with other software.

Running "./configure" in /usr/local/src/com/snert/src/lib does not show (AFAIK)
any problems regarding db:

==================================================
[cut]
checking for library containing db_create... -ldb-4.2
checking for db4/db.h... yes
checking for db3/db.h... no
checking for db.h... yes
checking for db_create... yes
checking for dbopen... no
checking which Berkeley DB to use... yes -ldb-4.2
[cut]

LibSnert/1.40.622
Copyright 1996, 2004 by Anthony Howe. All rights reserved.

  Mutex........: SYSTEMV_API
  Shared Memory: SYSTEMV_API
  Time.........: POSIX_API
  Berkeley DB..: yes
  libmilter....: yes
  CFLAGS.......:  -D_REENTRANT -g -Wall -fvolatile -I/usr/local/include
  LDFLAGS......:  -L/usr/local/lib
  LIBS.........: -ldb-4.2 -lpthread -lrt
==================================================

Running "make" however fails:

==================================================
gcc -D_REENTRANT -g -Wall -fvolatile -I/usr/local/include
-I/usr/local/src/com/snert/include -oCache.o -c Cache.c
Cache.c: In function `CacheBdbOpen':
Cache.c:330: error: `DBTXN' undeclared (first use in this function)
Cache.c:330: error: (Each undeclared identifier is reported only once
Cache.c:330: error: for each function it appears in.)
Cache.c:330: error: syntax error before "name"
make[1]: *** [Cache.o] Error 1
make[1]: Leaving directory `/usr/local/src/com/snert/src/lib/util'
make: *** [build] Error 1
==================================================

It seems that DBTXN is undeclared. If I change
/usr/local/src/com/snert/src/lib/util/Cache.c and
/usr/local/src/com/snert/include/com/snert/lib/mail/smdb.h to contain the following,
compiling libsnert succeeds:

==================================================
--- util/Cache.c.orig 2004-09-05 09:58:18.000000000 +0200
+++ util/Cache.c      2005-04-29 01:52:59.000000000 +0200
@@ -192,6 +192,9 @@
 # undef LIBSNERT_WITH_BERKELEY_DB
 #endif

+/* MIKE - new - begin */
+# define DBTXN         (DB_TXN *) 0,
+/* MIKE - new - end */
 #if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 2 && DB_VERSION_PATCH
>= 50
 # define DBTXN         (DB_TXN *) 0,
 #elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 1 && DB_VERSION_PATCH
>= 25


--- smdb.h.orig 2004-09-02 11:33:54.000000000 +0200
+++ smdb.h      2005-04-29 01:55:51.000000000 +0200
@@ -55,6 +55,9 @@
 #  error "LibSnert must be built with Berkeley DB support"
 # endif

+/* MIKE - new - begin */
+#  define DBTXN                (DB_TXN *) 0,
+/* MIKE - new - end */
 # if DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 2 &&
DB_VERSION_PATCH >= 50
 #  define DBTXN                (DB_TXN *) 0,
 # elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 1 && DB_VERSION_PATCH
>= 25
@@ -71,8 +74,10 @@
 #  define DB_NOTFOUND                  1
 #  define db_strerror(x)               strerror(errno)
 #  include <fcntl.h>
+/* MIKE - old - begin
 # else
 #  error "Berkeley DB 1.85 or 3.2 or better required."
+   MIKE - old - end */
 # endif

 #else /* not LIBSNERT_WITH_BERKELEY_DB */
==================================================

After these changes, libsnert.a compiles just fine, as does milter-sender. HOWEVER,
milter-sender segfaults each time (last 8 lines):

==================================================
munmap(0xb7fd5000, 131072)              = 0
open("/proc/stat", O_RDONLY)            = 4
fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ff4000
read(4, "cpu  1211184 236576 441325 30956"..., 1024) = 698
read(4, "", 1024)                       = 0
close(4)                                = 0
munmap(0xb7ff4000, 4096)                = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
==================================================

I restored the milter-sender binary compiled under SuSE 9.2 and it works fine. If I strace
that binary, I notice that the segfault of the SuSE 9.3 compiled binary happens just
before a db related function is called (first 8 lines of the trace are identical):

==================================================
munmap(0xb7fd5000, 131072)              = 0
open("/proc/stat", O_RDONLY)            = 4
fstat64(4, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7ff4000
read(4, "cpu  1212068 237611 442166 30975"..., 1024) = 698
read(4, "", 1024)                       = 0
close(4)                                = 0
munmap(0xb7ff4000, 4096)                = 0

stat64("DB_CONFIG", 0xbfffeae0)         = -1 EACCES (Permission denied)
open("DB_CONFIG", O_RDONLY|O_LARGEFILE) = -1 EACCES (Permission denied)
stat64("/var/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=80, ...}) = 0
stat64("__db.002", 0xbfffeb90)          = -1 EACCES (Permission denied)
mmap2(NULL, 282624, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fb0000
open("/var/lib/milter/milter-sender/cache.db", O_RDONLY|O_LARGEFILE) = 4
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
_llseek(4, 0, [0], SEEK_SET)            = 0
read(4, "\0\0\0\0\1\0\0\0\0\0\0\0a\25\6\0\10\0\0\0\0@\0\0\0\10\0"..., 512) = 512
==================================================

I would appreciate any advice on how to fix this problem, as this piece of Open Source
software is excellent!

Regards,
Mike Klinkert.



Lists Index Date Thread Search