Software used:
gcc 3.3
make 3.8
openldap-2.2.15
bdb-4.2
openssl 0.9.7c
solaris 2.9
If you get this error, try the following:
* Set LDFLAGS and CPFFLAGS to locate the BerkeleyDB libraries/include files. Here's an example. The -R flag forces the specific flags to libtool so that the compiled binaries know where to look.
LDFLAGS="-L/usr/local/lib -L/usr/local/BerkeleyDB/lib -L/usr/local/ssl/lib -R/usr/local/lib -R/usr/local/BerkeleyDB/lib -R/usr/local/ssl/lib" CPPFLAGS="-I/usr/local/include -I/usr/local/BerkeleyDB/include -I/usr/local/ssl/include" ./configure
One of the ways I discovered this is by looking at the config.log file and noticed that it would fail on the following code snippet:
### sampletest.c
#include "confdefs.h"
#ifdef HAVE_DB_185_H
choke me;
#else
#include <db.h>
#endif
#ifndef DB_VERSION_MAJOR
# define DB_VERSION_MAJOR 1
#endif
#ifndef NULL
#define NULL ((void *)0)
#endif
main()
{
#if DB_VERSION_MAJOR > 1
char *version;
int major, minor, patch;
version = db_version( &major, &minor, &patch );
# added for debugging
printf("version: %d, %d, %d, %s and %s.\n", major, minor, patch, DB_VERSION_STRING, version);
if( major != DB_VERSION_MAJOR || minor < DB_VERSION_MINOR ) {
printf("Berkeley DB version mismatch\n"
"\texpected: %s\n\tgot: %s\n",
DB_VERSION_STRING, version);
return 1;
}
#endif
return 0;
}
So I compiled this program using the same compile options as configure:
# gcc -o conftest -g -O2 -I/usr/local/include -I/usr/local/BerkeleyDB/include -I/usr/local/ssl/include -L/usr/local/lib -L/usr/local/BerkeleyDB/lib -L/usr/local/ssl/lib sampletest.c -ldb-4.2 -pthreads -lresolv -lgen -lnsl -lsocket
and tried to run the program and sure enough it fails until I pass it the location to the BDB library:
# LD_LIBRARY_PATH="/usr/local/BerkeleyDB/lib" ./conftest
version: 4, 2, 52, Sleepycat Software: Berkeley DB 4.2.52: (December 3, 2003) and Sleepycat Software: Berkeley DB 4.2.52: (December 3, 2003).
So lessons learned? I guess (a) read the config.log and (b) make sure that the proper libraries are being included.
Hope that helps you.
JM
08-16-04
shinji_ikari@mail.com |