1

I have 3 versions of BerkelyDB installed on my server

following 2 versions

Package db4-4.3.29-10.el5_5.2.x86_64 
Package db4-4.3.29-10.el5_5.2.i386 

which are included in the Centos 5 Distro

and a 3rd version installed from source located here

/usr/local/BerkeleyDB.4.5

(and all Berkeley utility installed here /usr/local/BerkeleyDB.4.5/bin )

When I execute a program which uses Berkeley (I am using ASSP 2.4.4) it can see and use BerkeleyDB 4.3.29 . This is bad because ASSP needs Berkeley version >= 4.5 .

How can I set as default BerkeleyDB.4.5 installed in /usr/local/BerkeleyDB.4.5 instead of 4.3.29 ?

  • Are you sure that other installed components do not need 4.3? One solution to you problem is to put /usr/local/BerkeleyDB.4.5/bin at the top of your PATH environment variable (and export it of course) – mdpc Jan 29 '15 at 7:23
1

Generally, if you are trying to run something from a package (i.e. pre-compiled binaries) you could set PATH and/or LD_LIBRARY_PATH, or use chrpath to tweak the binaries themselves. If you're careful, there's no reason you cannot have many versions of BerkeleyDB installed. (The configure script is setup to make this easy, and supports --program-suffix (and transform) so you can more easily keep versioned binaries in your PATH.)

ASSP is implemented in perl however, so it's going to use the current compiled perl BerkeleyDB.so library which will be linked against whichever Berkeley it was built against. (Unlike many packages which use DB::File, assp uses BerkeleyDB directly.)

You can see what library perl is using with something like:

perl -e 'print join "\n",@INC;' | xargs -i find {} -name BerkeleyDB.so

then run ldd on the module(s) found.

Normally when using CentOS, you buy into the CentOS package-centric world (whether you like it or not), so the "correct" solutions are to find an ASSP package that matches your CentOS version, or a Berkeley RPM which also includes a working perl BerkeleyDB.so, or upgrade CentOS.


I avoid deploying services on CentOS because of package dependency issues. I build from source, but that's "old school". (Gentle readers who may experience deleterious effects when software is installed other than via RPMs should have stopped reading above the line.)

To fix this manually you may either install a parallel version of perl just for ASSP (a potential maintenance headache, though last time I checked CentOS 5.x came with perl-5.8 which won't run ASSP so you may have already done this); or you may upgrade just your BerkelyDB module following the instructions in the README, and check/set the correct paths in config.in before compiling. This module is include in the BerkeleyDB.4.5 source archive, the defaults are:

INCLUDE=/usr/local/BerkeleyDB/include
LIB=/usr/local/BerkeleyDB/lib

So just add a symlink /usr/local/BerkeleyDB/usr/local/BerkeleyDB.4.5 and manually build (or use CPAN to install/upgrade it, the CPAN one will be the latest though, it has support for just about any underlying bdb version).

If you upgrade BerkeleyDB you run a small risk of some other perl scripts having problems if they rely on it, or a specific version of it. This isn't a commonly installed module, as far as I can tell, it's not included in either the normal perl or Berkeley db4 CentOS packages (it's in perl-BerkelyDB in RHEL, never seen it on CentOS 5.x).

cd /usr/local/src/db-4.5.x       # or where ever you build
cd perl/BerkeleyDB
vi config.in                     # check INCLUDE and LIB [optional]
perl Makefile.pl                 # select the correct perl
make
make test && make install

Then repeat the find/ldd instructions above to confirm all is as expected. (If you have more than one perl it's usually a good idea to export the environment variable PERL before starting, but I don't think it's needed here.)

  • I installed a parallel perl 5.16.3 (installed all ASSP perl modules for this perl) and installed BerkeleyDB perl module as per your instructions. It works.. Thank you ! – gr68 Jan 29 '15 at 14:06
  • Unluckly I still can't vote your excellent and useful reply, sorry.I hope it will help someone else too. – gr68 Jan 29 '15 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.