(Answer) (Category) OpenLDAP Faq-O-Matic : (Category) OpenLDAP Software FAQ : (Category) Installation : (Category) Platform Hints : (Category) Sun Microsystems Solaris : (Answer) Identifying Berkeley DB version mismatch
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
Wow ! Setting the LD_LIBRARY_PATH worked for me.

I wrote a shell script to set the compiler and linking flags as follows and this worked for me (after a sleepless night!)


CPPFLAGS="-I/usr/local/BerkeleyDB.4.3/include -I/usr/local/ssl/include/openssl"
export CPPFLAGS
LDFLAGS="-L/usr/local/lib -L/usr/local/BerkeleyDB.4.3/lib -L/usr/local/ssl/lib -
R/usr/local/lib -R/usr/local/BerkeleyDB.4.3/lib -R/usr/local/ssl/lib"
export LDFLAGS
LD_LIBRARY_PATH="/usr/local/BerkeleyDB.4.3/lib"
export LD_LIBRARY_PATH


./configure --with-tls --enable-slurpd --enable-crypt --enable-syslog --sysconfd
ir=/etc


Regards,
Jose F. Osorio
jose@osoriosoft.com
Thank you for this information - it saved me a sleepless night!

#env 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" LD_LIBRARY_PATH="/usr/local/BerkeleyDB.4.6/lib" ./configure
queen_geek@yahoo.com
Here is the line which worked for me (Ubuntu 8.4)

env CPPFLAGS="-I/usr/local/include -I/usr/local/BerkeleyDB.4.7/include -I/usr/local/ssl/include/openssl" LDFLAGS="-L/usr/local/lib -L/usr/local/BerkeleyDB.4.7/lib -L/usr/local/ssl/lib -R/usr/local/lib -R/usr/local/BerkeleyDB.4.7/lib -R/usr/local/ssl/lib" LD_LIBRARY_PATH="/usr/local/BerkeleyDB.4.7/lib" ./configure --with-tls --enable-slurpd --enable-crypt --enable-syslog --sysconfdir=/etc

Thanks for your post!
smilko@gmail.com
[Append to This Answer]
Previous: (Answer) Solaris stock ld and elf error: file ../../libraries/libldbm/libldbm.a: elf_getarsym
Next: (Answer) How to fix "configure: error: Berkeley DB version mismatch"
This document is: http://www.openldap.org/faq/index.cgi?file=1095
[Search] [Appearance]
This is a Faq-O-Matic 2.721.test.
© Copyright 1998-2013, OpenLDAP Foundation, info@OpenLDAP.org