(Answer) (Category) OpenLDAP Faq-O-Matic : (Category) OpenLDAP Software FAQ : (Category) Installation : (Category) Platform Hints : (Category) Sun Microsystems Solaris : (Answer) How to fix "configure: error: Berkeley DB version mismatch"
Do one of these (please adjust location of BDB and/or OpenSSL if needed):
1) Define LD_LIBRARY_PATH
LD_LIBRARY_PATH="/usr/lib:/usr/local/lib:/usr/local/BerkeleyDB.4.2/lib:/usr/local/ssl/lib" LDFLAGS="-L/usr/local/lib -L/usr/local/BerkeleyDB.4.2/lib -L/usr/local/ssl/lib" CPPFLAGS="-I/usr/local/include -I/usr/local/BerkeleyDB.4.2/include -I/usr/local/ssl/include" ./configure --enable-bdb --enable-crypt --with-tls

OR
2) As root user run "crle"
crle -c /var/ld/ld.config -l /usr/lib:/usr/local/lib:/usr/local/BerkeleyDB.4.2/lib
Then go back to run
LDFLAGS="-L/usr/local/lib -L/usr/local/BerkeleyDB.4.2/lib -L/usr/local/ssl/lib" CPPFLAGS="-I/usr/local/include -I/usr/local/BerkeleyDB.4.2/include -I/usr/local/ssl/include" ./configure --enable-bdb --enable-crypt --with-tls

 

garyttt@singnet.com.sg
Another example (BDB 4.2, with TLS and SASL) using the "-R" option of LDFLAGS:
env LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib/sasl2:/usr/local/BerkeleyDB. 4.2/lib:/usr/local/ssl/lib" LDFLAGS="-L/usr/local/lib -L/usr/local/lib/sasl2 -L/usr/local/BerkeleyDB.4.2/lib -L/usr/local/ssl/lib -R/usr/local/lib -R/usr/local/lib/sasl2 -R/usr/local/BerkeleyDB.4.2/lib -R/usr/local/ssl/lib" CPPFLAGS="-I/usr/local/include -I/usr/local/include/sasl -I/usr/local/BerkeleyDB.4.2/include -I/usr/local/ssl/include" ./configure --enable-bdb --enable-ldbm --enable-ldap --en able-meta --enable-crypt --with-tls --with-cyrus-sasl

garyttt@singnet.com.sg
I'm no expert, but this is what got me up and running:

Solaris 10/sparc, db-4.4.20, and openldap-2.2.23.  I had all the right env vars set...or so I thought..and was compile, using a precompiled gcc 3.3.2 package.

checking for db.h... yes
checking for Berkeley DB link (default)... no
checking for Berkeley DB link (-ldb44)... no
checking for Berkeley DB link (-ldb-43)... no
checking for Berkeley DB link (-ldb-4.3)... no
checking for Berkeley DB link (-ldb-4-3)... no
checking for Berkeley DB link (-ldb42)... no
checking for Berkeley DB link (-ldb-42)... no
checking for Berkeley DB link (-ldb-4.2)... no
checking for Berkeley DB link (-ldb-4-2)... no
checking for Berkeley DB link (-ldb-4)... yes
checking for Berkeley DB version match... no
configure: error: Berkeley DB version mismatch

When I looked closely at the config.out, I noticed this:

configure:18061: checking for db.h
configure:18071: gcc -E -I/usr/local/BerkeleyDB.4.4/include -I/usr/local/ssl/inc
lude -I/usr/local/include -I/usr/include conftest.c >/dev/null 2>conftest.out
configure:18101: checking for Berkeley DB link (default)
configure:18158: gcc -o conftest -I/usr/local/BerkeleyDB.4.4/include -I/usr/loca
l/ssl/include -I/usr/local/include -I/usr/include -I/usr/local/BerkeleyDB.4.4/in
clude -I/usr/local/ssl/include -I/usr/local/include -I/usr/include -L/usr/local/
BerkeleyDB.4.4/lib -R/usr/local/BerkeleyDB.4.4/lib -L/usr/local/ssl/lib -R/usr/l
ocal/ssl/lib -L/usr/local/lib -R/usr/local/lib conftest.c    -lresolv -lgen -lns
l -lsocket  1>&5
Undefined                       first referenced
 symbol                             in file
db_version                          /var/tmp//ccA79QxQ.o
db_env_create                       /var/tmp//ccA79QxQ.o
ld: fatal: Symbol referencing errors. No output written to conftest
collect2: ld returned 1 exit status
configure: failed program was:
#line 18111 "configure"
#include "confdefs.h"
...

which indicated the configure script didn't automatically add -ldb to tell the compiler to actually USE the Berkeley database althought it certainly detected it (enough to make the mismatch error).

So, in addition to the good advice on the Internet from everyone to use CC, CFLAGS, CPPFLAGS, and LDFLAGS, I needed to explicitly define LIBS.  (More on this in a sec.)

setenv LIBS -ldb


I also ran into a "file not found" error for libgcc_s.so.1:

gcc -I/usr/local/BerkeleyDB.4.4/include -I/usr/local/ssl/include -I/usr/local/include -I/usr/include -o ucgendat ucgendat.o  -L/usr/local/BerkeleyDB.4.4/lib -L/usr/local/ssl/lib -L/usr/local/lib ../../libraries/liblber/.libs/liblber.a ../../libraries/liblutil/liblutil.a -lresolv -lgen -lnsl -lsocket -ldb -lgcc_s -R/usr/local/BerkeleyDB.4.4/lib -R/usr/local/ssl/lib -R/usr/lib
./ucgendat ./UnicodeData.txt -x ./CompositionExclusions.txt
ld.so.1: ucgendat: fatal: libgcc_s.so.1: open failed: No such file or directory
*** Signal 9
make: Fatal error: Command failed for target `ucgendat'
Current working directory /opt/src/openldap-2.2.23/libraries/liblunicode
*** Error code 1

So in the end, I used:

setenv LIBS "-ldb -lgcc_s"


Lastly, I also saw a cross compile error:

checking for LinuxThreads consistency... no
checking if pthread_create() works... yes
checking if select yields when using pthreads... cross
configure: error: crossing compiling: use --with-yielding_select=yes|no|manual

I turned off cross compiling in the configuration step.


> env
CFLAGS=-I/usr/local/BerkeleyDB.4.4/include -I/usr/local/ssl/include -I/usr/local/include -I/usr/include
CPPFLAGS=-I/usr/local/BerkeleyDB.4.4/include -I/usr/local/ssl/include -I/usr/local/include -I/usr/include
LDFLAGS=-L/usr/local/BerkeleyDB.4.4/lib -R/usr/local/BerkeleyDB.4.4/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/local/lib -R/usr/local/lib -L/usr/lib -R/usr/lib
LIBS=-ldb -lgcc_s


> configure  --without-yielding-select

The "make test" worked just fine.
I'm no expert, but this is what got me up and running:
Solaris 10/sparc, db-4.4.20, and openldap-2.2.23. I had all the right env vars set...or so I thought..and was compile, using a precompiled gcc 3.3.2 package.
checking for db.h... yes checking for Berkeley DB link (default)... no checking for Berkeley DB link (-ldb44)... no checking for Berkeley DB link (-ldb-43)... no checking for Berkeley DB link (-ldb-4.3)... no checking for Berkeley DB link (-ldb-4-3)... no checking for Berkeley DB link (-ldb42)... no checking for Berkeley DB link (-ldb-42)... no checking for Berkeley DB link (-ldb-4.2)... no checking for Berkeley DB link (-ldb-4-2)... no checking for Berkeley DB link (-ldb-4)... yes checking for Berkeley DB version match... no configure: error: Berkeley DB version mismatch
When I looked closely at the config.out, I noticed this:
configure:18061: checking for db.h configure:18071: gcc -E -I/usr/local/BerkeleyDB.4.4/include -I/usr/local/ssl/inc lude -I/usr/local/include -I/usr/include conftest.c >/dev/null 2>conftest.out configure:18101: checking for Berkeley DB link (default) configure:18158: gcc -o conftest -I/usr/local/BerkeleyDB.4.4/include -I/usr/loca l/ssl/include -I/usr/local/include -I/usr/include -I/usr/local/BerkeleyDB.4.4/in clude -I/usr/local/ssl/include -I/usr/local/include -I/usr/include -L/usr/local/ BerkeleyDB.4.4/lib -R/usr/local/BerkeleyDB.4.4/lib -L/usr/local/ssl/lib -R/usr/l ocal/ssl/lib -L/usr/local/lib -R/usr/local/lib conftest.c -lresolv -lgen -lns l -lsocket 1>&5 Undefined first referenced
 symbol                             in file
db_version /var/tmp//ccA79QxQ.o db_env_create /var/tmp//ccA79QxQ.o ld: fatal: Symbol referencing errors. No output written to conftest collect2: ld returned 1 exit status configure: failed program was: #line 18111 "configure" #include "confdefs.h" ...
which indicated the configure script didn't automatically add -ldb to tell the compiler to actually USE the Berkeley database althought it certainly detected it (enough to make the mismatch error).
So, in addition to the good advice on the Internet from everyone to use CC, CFLAGS, CPPFLAGS, and LDFLAGS, I needed to explicitly define LIBS. (More on this in a sec.)
setenv LIBS -ldb

I also ran into a "file not found" error for libgcc_s.so.1:
gcc -I/usr/local/BerkeleyDB.4.4/include -I/usr/local/ssl/include -I/usr/local/include -I/usr/include -o ucgendat ucgendat.o -L/usr/local/BerkeleyDB.4.4/lib -L/usr/local/ssl/lib -L/usr/local/lib ../../libraries/liblber/.libs/liblber.a ../../libraries/liblutil/liblutil.a -lresolv -lgen -lnsl -lsocket -ldb -lgcc_s -R/usr/local/BerkeleyDB.4.4/lib -R/usr/local/ssl/lib -R/usr/lib ./ucgendat ./UnicodeData.txt -x ./CompositionExclusions.txt ld.so.1: ucgendat: fatal: libgcc_s.so.1: open failed: No such file or directory *** Signal 9 make: Fatal error: Command failed for target `ucgendat' Current working directory /opt/src/openldap-2.2.23/libraries/liblunicode *** Error code 1
So in the end, I used:
setenv LIBS "-ldb -lgcc_s"

Lastly, I also saw a cross compile error:
checking for LinuxThreads consistency... no checking if pthread_create() works... yes checking if select yields when using pthreads... cross configure: error: crossing compiling: use --with-yielding_select=yes|no|manual
I turned off cross compiling in the configuration step.

> env CFLAGS=-I/usr/local/BerkeleyDB.4.4/include -I/usr/local/ssl/include -I/usr/local/include -I/usr/include CPPFLAGS=-I/usr/local/BerkeleyDB.4.4/include -I/usr/local/ssl/include -I/usr/local/include -I/usr/include LDFLAGS=-L/usr/local/BerkeleyDB.4.4/lib -R/usr/local/BerkeleyDB.4.4/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/local/lib -R/usr/local/lib -L/usr/lib -R/usr/lib LIBS=-ldb -lgcc_s

> configure --without-yielding-select
The "make test" worked just fine.

setenv LIBS -ldb
got me past the "checking for Berkeley DB link (default)... no" error as well.

[Append to This Answer]
Previous: (Answer) Identifying Berkeley DB version mismatch
Next: (Answer) Installing and Configuring OpenLDAP for Solaris9
This document is: http://www.openldap.org/faq/index.cgi?file=1113
[Search] [Appearance]
This is a Faq-O-Matic 2.721.test.
© Copyright 1998-2013, OpenLDAP Foundation, info@OpenLDAP.org