Error checking Berkeley DB versions on Intel Mac
David Relson
relson at osagesoftware.com
Sat Apr 22 12:50:06 CEST 2006
On Fri, 21 Apr 2006 23:46:22 -0700
Chris Wilkes wrote:
> I'm trying to compile bogofilter on an MacBookPro (the new Apple laptop
> with the Intel chip) and I'm getting the following error when running
> ./configure --with-libdb-prefix=/sw/
> (the "fink" program stores its files under /sw/, which is where my
> Berkeley DB 4.3 files are located)
>
> checking how to link with libdb... -L/sw//lib -ldb
> checking db and dependent libraries... -L/sw//lib -ldb
> checking if a program can be linked against Berkeley DB and run... yes
> checking if Berkeley DB header and library versions match... no
> configure: error: db.h header file and db library version do not match.
>
> Here's the part from the config.log file. Any ideas?
>
> configure:12741: checking if Berkeley DB header and library versions
> match
> configure:12783: gcc -o conftest -g -O2 -Wpointer-arith -ggdb -Wall -W
> -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wbad-function-cast
> -Wcast-qual -Wcast-align -Wwrite-strings -Waggregate-return
> -Wmissing-declarations -Wmissing-format-attribute -Wnested-externs
> -fno-common -Wchar-subscripts -Wcomment -Wimplicit -Wsequence-point
> -Wreturn-type -Wno-system-headers -Wformat -I/sw//include conftest.c
> -lm -L/sw//lib
> -ldb >&5
> conftest.c:101: warning: function declaration isn't a prototype
> conftest.c: In function 'main':
> conftest.c:104: warning: implicit declaration of function 'db_version'
> conftest.c:104: warning: nested extern declaration of 'db_version'
> conftest.c:106: error: 'DB_VERSION_MAJOR' undeclared (first use in this
> function)
> conftest.c:106: error: (Each undeclared identifier is reported only once
> conftest.c:106: error: for each function it appears in.)
> conftest.c:106: error: 'DB_VERSION_MINOR' undeclared (first use in this
> function)
> configure:12786: $? = 1
> configure: program exited with status 1
Hi Chris,
gcc gets DB_VERSION_xxx from file db.h. Your problem sounds like gcc
is finding the wrong header file, so you need to find _which_ db.h is
getting read and make sure gcc can find it.
I have BerkeleyDB source code in directory /usr/local/BerkeleyDB.4.4 so
my copy of db.h is in /usr/local/BerkeleyDB.4.4/include/db.h. Gcc's
"-E" flag will write the output of the preprocessor to a file for you
and that will show exactly which copy is being read.
With the following command:
gcc -E -o gcc.out -I /usr/local/BerkeleyDB.4.4/include conftest.c
output file gcc.out shows its including /usr/local/BerkeleyDB.4.4/include/db.h
You'll have to experiment a bit to determine the proper option
for ./configure. Unfortunately I'm out of time at the moment.
HTH,
David
P.S. Here's a copy of conftest.c for you to use::::
#include <db.h>
int
main ()
{
int maj, min;
(void)db_version(&maj, &min, 0);
(void)fprintf(stderr, "headers: %d.%d, library: %d.%d\n",
DB_VERSION_MAJOR, DB_VERSION_MINOR, maj, min);
if (maj != DB_VERSION_MAJOR) exit(1);
if (min != DB_VERSION_MINOR) exit(1);
exit(0);
;
return 0;
}
More information about the Bogofilter
mailing list