I am trying to get a CentOS 4.4 image running on Amazon EC2, and hit a helluva bug. A time consuming bug at least… CentOS comes with Berkeley db4 compiled with ‘–enable-posixmutexes’. But this doesn’t work under Xen. When installing the perl BerleleyDB package I get a bunch of this:
Berkeley DB library configured to support only DB_PRIVATE environments
The BerkeleyDB README mentions this Red Hat bug. So I compiled my own copy of db-4.4.20 with ‘–disable-posixmutexes’ and installed it to /usr/local/BerkeleyDB.4.4 and linked it from /usr/local/BerkeleyDB. Then while installing perl BerkeleyDB, I started getting a bunch of this crap:
Can't load '/var/tmp/BerkeleyDB-0.31/blib/arch/auto/BerkeleyDB/BerkeleyDB.so' for
module BerkeleyDB: libdb-4.4.so: cannot open shared object file: No such file or
directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230.
I was stuck at this point for a while, then a google search for "libdb-4.4.so: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230." (no quotes) turned up exactly one match – this site.
So the entire solution is:
tar -zxvf db-4.4.20.tar.gz
ln -s BerkeleyDB.4.4 BerkeleyDB
echo "/usr/local/BerkeleyDB/lib" > /etc/ld.so.conf.d/BerkeleyDB.conf
FTP_PASSIVE=1 LANG=en_US LC_CTYPE=en_US perl -MCPAN -e shell
> install BerkeleyDB
Very useful, just solved my problem.
This assumption is prbaboly true that this won’t cause any errors. But after patching and upgrading this could come up to haunt you. This is essentially dying because one or both of the two values in evaluation are not defined. A potentially safer way to fix this is to add the following can make a minor change:$VERSION = 0 if(! defined($VERSION));my $APIVERSION = version();$APIVERSION = 0 if(! defined($APIVERSION));die Perl API Version does not match dynamic library version. unless ($APIVERSION eq $VERSION);Sorry for my randomly nuts rant but this error is one of my biggest pet peeves from maintaining and troubleshooting existing Perl code. It bugs me even more that code like this is distributed and generates all these errors making administrators think that all Perl code is buggy or unstable.