| Installing Oracle's BerkeleyDB and Perl's BerkeleyDB |
| Oracle's BerkeleyDB |
| Perl's BerkeleyDB |
On 2012-03-22 I spent a lot of time installing these 2 packages. Here I want to spell out the problems I had.
I downloaded V 5.3.15 from Oracle.
From there, basically everything went well, although the docs are a little bit confusing. To summarize:
shell> tar xvzf db-5.3.15.tar.gz
shell> cd db-5.3.15/build_unix
shell> ../dist/configure --enable-sql --enable-sql_compat
shell> make
shell> sudo make install
Everything ends up in /usr/local/BerkeleyDB.5.3/.
So far, so good. The next problem is beat Debian and Perl over the head until they come to the party...
This package has to be edited before you can install it, so download the distro and unpack it.
Now edit BerkeleyDB-0.51/config.in. Here are my changes:
ron@zigzag:~/Downloads$ diff BerkeleyDB-0.51/config.in config.in
12c12
< INCLUDE = /usr/local/BerkeleyDB/include
---
> INCLUDE = /usr/local/BerkeleyDB.5.3/include
21c21
< LIB = /usr/local/BerkeleyDB/lib
---
> LIB = /usr/local/BerkeleyDB.5.3/lib
34c34
< # DBNAME = -ldb-2.6.4
---
> # DBNAME = -ldb-2.6.4
43c43
< #DBNAME = -ldb-3.0
---
> DBNAME = -ldb
I should say I'm using perlbrew, which may well have added complexity to the situation.
After reading the docs for ExtUtils::MakeMaker a few times, I ended up using this incantation:
shell> perl Makefile.PL INSTALL_BASE=~/perl5/perlbrew/perls/perl-5.14.2
since Perl's BerkeleyDB doesn't come with a Build.PL. Now:
shell> make
shell> make test
both work. We seem to be making progress. Try:
shell> make install
Of course, we've all installed the marvellous Module::Version, which gives us the mversion script. So the 1st test is:
shell> mversion BerkeleyDB
returns 0.51, as expected. Let's run BerkeleyDB ourselves!
shell> perl -MBerkeleyDB -e 1
$WTF!? We get an error. I just tried to re-construct the sequence, and I can't replicate the exact error. It was of the form: Cannot find loadable module... Not the 'Module "BerkeleyDB" does not seem to be installed' you'd expect.
Of course, we're also installed the marvellous App::moduleswhere, which gives us the mwhere script. But:
shell> mwhere BerkeleyDB
also returns an error. $WTF x 2? How can this be? The version is available but the module itself is not? You-can't-be-serious!!?? I felt uneasy; I've never seen this before.
I assumed it was my fault, and so I spend a hour or so playing with ~/.bashrc and ~/.profile, trying to determine what was wrong.
I had needed to set $LD_LIBRARY_PATH in the past, so I suspected that was the problem. I also remembered I'd never had to use $LD_RUN_PATH, although I did play with it too.
All this lead me to summarize the experience in my other blog, posted a few minutes ago: Bash and Its Startup File Execution Algorithm.
Eventually, I wondered if Perl itself, via BerkeleyDB's Makefile.PL was at fault. Studying the output of that carefully, and running 'find' to find to installed BerkeleyDB.pm, I realized the INSTALL_BASE option I used (above) lead to the module being installed in the 'wrong' directory. Not happy.
Rectification required:
shell> cd /home/ron/perl5/perlbrew/perls/perl-5.14.2/lib/
shell> mv perl5/x86_64-linux-thread-multi/auto site_perl/5.14.2/x86_64-linux-thread-multi/
shell> mv perl5/x86_64-linux-thread-multi/B* site_perl/5.14.2/x86_64-linux-thread-multi/
Now all these work:
shell> mversion BerkeleyDB
shell> mwhere BerkeleyDB
shell> perl -MBerkeleyDB -e 1
Happy at last. But, umm, what was I trying to do in the first place ...?