[milters] Archive

Lists Index Date Thread Search

Article: 540
From: Anthony Howe
Date: 2005-05-03 08:18:40 -0400
Subject: Re: Problem compiling libsnert & milter-sender on SuSE

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

Mike wrote:
> 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:

> 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"

This is because the 4.3.27 db.h was found instead of the 4.2 db.h. The 
source does not account for future versions.  You need to change in 
every file that #defines DBTXN:

	com/snert/include/com/snert/lib/mail/smdb.h
	com/snert/src/util/cache.c
	com/snert/src/milter-1_OF_9/milter-1_OF_9.c

you need to replace the DB_VERSION testing with this, which allows for 
newer versions of BDB:

# if defined(HAVE_WITH_DB_DB_H)
/* $with_db/include/db.h */
#  include <db.h>
# elif defined(HAVE_DB4_DB_H)
/* /usr/include/db4/db.h */
#  include <db4/db.h>
# elif defined(HAVE_DB3_DB_H)
/* /usr/include/db3/db.h */
#  include <db3/db.h>
# elif defined(HAVE_DB_H)
/* /usr/include/db.h */
#  include <db.h>
# else
#  error "LibSnert must be built with Berkeley DB support"
# endif

# if   DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1
#  define DBTXN		(DB_TXN *) 0,
# elif DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 0
#  define DBTXN
# elif DB_VERSION_MAJOR == 3
#  define DBTXN
# elif DB_VERSION_MAJOR == 2
#  error "Berkeley DB 2.x not supported. Only 1.85 or 3.2 or better."
# elif defined(HAVE_DBOPEN)
#  define DB_VERSION_MAJOR		1
#  define DB_VERSION_MINOR		85
#  define DB_NOTFOUND			1
#  define db_strerror(x)		strerror(errno)
#  include <fcntl.h>
# else
#  error "Berkeley DB 1.85 or 3.2 or better required."
# endif

The above snippet is from the upcoming LibSnert 1.41 release.

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

You linked with 4.2, but I bet your default /usr/include/db.h is for 4.3

 >   LIBS.........: -ldb-4.2 -lpthread -lrt

These multiple db issues have been addressed in the upcoming release.

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

Please note, my milters are NOT open source, they're free and come with 
source, but I guard copyright and distribution rights. I suggest you 
look at the license, its not GPL, BSD, Mozilla, Apache, or anything like 
them.

-- 
Anthony C Howe                                 +33 6 11 89 73 78
http://www.snert.com/       ICQ:
7116561         AIM: Sir Wumpus

in the mist of night / by the silent sea / a siren calls - Anthony

Lists Index Date Thread Search