| 1 |
BerkeleyDB |
| 2 |
|
| 3 |
Version 0.66 |
| 4 |
|
| 5 |
14th October 2024 |
| 6 |
|
| 7 |
|
| 8 |
Copyright (c) 1997-2024 Paul Marquess. All rights reserved. This |
| 9 |
program is free software; you can redistribute it and/or modify |
| 10 |
it under the same terms as Perl itself. |
| 11 |
|
| 12 |
|
| 13 |
DESCRIPTION |
| 14 |
----------- |
| 15 |
|
| 16 |
BerkeleyDB is a module which allows Perl programs to make use of the |
| 17 |
facilities provided by Berkeley DB version 2 or greater. (Note: if |
| 18 |
you want to use version 1 of Berkeley DB with Perl you need the DB_File |
| 19 |
module). |
| 20 |
|
| 21 |
Berkeley DB is a C library which provides a consistent interface to a |
| 22 |
number of database formats. BerkeleyDB provides an interface to all |
| 23 |
four of the database types (hash, btree, queue and recno) currently |
| 24 |
supported by Berkeley DB. |
| 25 |
|
| 26 |
For further details see the documentation in the file BerkeleyDB.pod. |
| 27 |
|
| 28 |
PREREQUISITES |
| 29 |
------------- |
| 30 |
|
| 31 |
Before you can build BerkeleyDB you need to have the following |
| 32 |
installed on your system: |
| 33 |
|
| 34 |
* To run the test harness for this module, you must make sure that the |
| 35 |
directory where you have untarred this module is NOT a network |
| 36 |
drive, e.g. NFS or AFS. |
| 37 |
|
| 38 |
* Perl 5.6.0 or greater. |
| 39 |
|
| 40 |
* Berkeley DB Version 2.6.4 or greater |
| 41 |
|
| 42 |
The official web site for Berkeley DB is |
| 43 |
|
| 44 |
http://www.oracle.com/technology/products/berkeley-db/db/index.html |
| 45 |
|
| 46 |
The latest version of Berkeley DB is always available there. It |
| 47 |
is recommended that you use the most recent version available. |
| 48 |
|
| 49 |
The one exception to this advice is where you want to use BerkeleyDB |
| 50 |
to access database files created by a third-party application, |
| 51 |
like Sendmail. In these cases you must build BerkeleyDB with a |
| 52 |
compatible version of Berkeley DB. |
| 53 |
|
| 54 |
|
| 55 |
BUILDING THE MODULE |
| 56 |
------------------- |
| 57 |
|
| 58 |
Assuming you have met all the prerequisites, building the module should |
| 59 |
be relatively straightforward. |
| 60 |
|
| 61 |
Step 1 : If you are running Solaris 2.5, 2.7 or HP-UX 10 read either |
| 62 |
the Solaris Notes or HP-UX Notes sections below. |
| 63 |
If you are running Linux please read the Linux Notes section |
| 64 |
before proceeding. |
| 65 |
If you are running FreeBSD read the FreeBSD Notes section |
| 66 |
below. |
| 67 |
|
| 68 |
|
| 69 |
Step 2 : Edit the file config.in to suit you local installation. |
| 70 |
Instructions are given in the file. |
| 71 |
|
| 72 |
Step 3 : Build and test the module using this sequence of commands: |
| 73 |
|
| 74 |
perl Makefile.PL |
| 75 |
make |
| 76 |
make test |
| 77 |
|
| 78 |
INSTALLATION |
| 79 |
------------ |
| 80 |
|
| 81 |
make install |
| 82 |
|
| 83 |
TROUBLESHOOTING |
| 84 |
=============== |
| 85 |
|
| 86 |
Here are some of the problems that people encounter when building BerkeleyDB. |
| 87 |
|
| 88 |
Missing db.h or libdb.a |
| 89 |
----------------------- |
| 90 |
|
| 91 |
If you get an error like this: |
| 92 |
|
| 93 |
cc -c -I./libraries/ -Dbool=char -DHAS_BOOL -I/usr/local/include -O2 |
| 94 |
-DVERSION=\"0.07\" -DXS_VERSION=\"0.07\" -fpic |
| 95 |
-I/usr/local/lib/perl5/5.00503/i586-linux/CORE BerkeleyDB.c |
| 96 |
BerkeleyDB.xs:52: db.h: No such file or directory |
| 97 |
|
| 98 |
or this: |
| 99 |
|
| 100 |
cc -c -I./libraries/2.7.5 -Dbool=char -DHAS_BOOL -I/usr/local/include -O2 |
| 101 |
-DVERSION=\"0.07\" -DXS_VERSION=\"0.07\" -fpic |
| 102 |
-I/usr/local/lib/perl5/5.00503/i586-linux/CORE BerkeleyDB.c |
| 103 |
LD_RUN_PATH="/lib" cc -o blib/arch/auto/BerkeleyDB/BerkeleyDB.so -shared |
| 104 |
-L/usr/local/lib BerkeleyDB.o |
| 105 |
-L/home/paul/perl/ext/BerkDB/BerkeleyDB/libraries -ldb |
| 106 |
ld: cannot open -ldb: No such file or directory |
| 107 |
|
| 108 |
This symptom can imply: |
| 109 |
|
| 110 |
1. You don't have Berkeley DB installed on your system at all. |
| 111 |
Solution: get & install Berkeley DB. |
| 112 |
|
| 113 |
2. You do have Berkeley DB installed, but it isn't in a standard place. |
| 114 |
Solution: Edit config.in and set the LIB and INCLUDE variables to point |
| 115 |
to the directories where libdb.a and db.h are installed. |
| 116 |
|
| 117 |
#error db.h is not for Berkeley DB at all. |
| 118 |
------------------------------------------ |
| 119 |
|
| 120 |
If you get the error above when building this module it means that there |
| 121 |
is a file called "db.h" on your system that isn't the one that comes |
| 122 |
with Berkeley DB. |
| 123 |
|
| 124 |
Options: |
| 125 |
|
| 126 |
1. You don't have Berkeley DB installed on your system at all. |
| 127 |
Solution: get & install Berkeley DB. |
| 128 |
|
| 129 |
2. Edit config.in and make sure the INCLUDE variable points to the |
| 130 |
directory where the Berkeley DB file db.h is installed. |
| 131 |
|
| 132 |
3. If option 2 doesn't work, try tempoarily renaming the db.h file |
| 133 |
that is causing the error. |
| 134 |
|
| 135 |
#error db.h is for Berkeley DB 1.x - need at least Berkeley DB 2.6.4 |
| 136 |
-------------------------------------------------------------------- |
| 137 |
|
| 138 |
The error above will occur if there is a copy of the Berkeley DB 1.x |
| 139 |
file db.h on your system. |
| 140 |
|
| 141 |
This error will happen when |
| 142 |
|
| 143 |
1. you only have Berkeley DB version 1 on your system. |
| 144 |
Solution: get & install a newer version of Berkeley DB. |
| 145 |
|
| 146 |
2. you have both version 1 and a later version of Berkeley DB |
| 147 |
installed on your system. When building BerkeleyDB it attempts to |
| 148 |
use the db.h for Berkeley DB version 1. |
| 149 |
Solution: Edit config.in and set the LIB and INCLUDE variables |
| 150 |
to point to the directories where libdb.a and db.h are |
| 151 |
installed. |
| 152 |
|
| 153 |
|
| 154 |
#error db.h is for Berkeley DB 2.0-2.5 - need at least Berkeley DB 2.6.4 |
| 155 |
------------------------------------------------------------------------ |
| 156 |
|
| 157 |
The error above will occur if there is a copy of the the file db.h for |
| 158 |
Berkeley DB 2.0 to 2.5 on your system. |
| 159 |
|
| 160 |
This symptom can imply: |
| 161 |
|
| 162 |
1. You don't have a new enough version of Berkeley DB. |
| 163 |
Solution: get & install a newer version of Berkeley DB. |
| 164 |
|
| 165 |
2. You have the correct version of Berkeley DB installed, but it isn't |
| 166 |
in a standard place. |
| 167 |
Solution: Edit config.in and set the LIB and INCLUDE variables |
| 168 |
to point to the directories where libdb.a and db.h are |
| 169 |
installed. |
| 170 |
|
| 171 |
Undefined Symbol: txn_stat |
| 172 |
-------------------------- |
| 173 |
|
| 174 |
BerkeleyDB seems to have built correctly, but you get an error like this |
| 175 |
when you run the test harness: |
| 176 |
|
| 177 |
$ make test |
| 178 |
PERL_DL_NONLAZY=1 /home/paul/perl/install/bin/perl5.00503 |
| 179 |
-Iblib/arch -Iblib/lib -I/usr/local/lib/perl5/5.00503/i586-linux |
| 180 |
-I/usr/local/lib/perl5/5.00503 -e 'use Test::Harness qw(&runtests $verbose); |
| 181 |
$verbose=0; runtests @ARGV;' t/*.t |
| 182 |
t/btree.............Can't load 'blib/arch/auto/BerkeleyDB/BerkeleyDB.so' for |
| 183 |
module BerkeleyDB: blib/arch/auto/BerkeleyDB/BerkeleyDB.so: |
| 184 |
undefined symbol: txn_stat |
| 185 |
at /usr/local/lib/perl5/5.00503/i586-linux/DynaLoader.pm line 169. |
| 186 |
... |
| 187 |
|
| 188 |
This error usually happens when you have both version 1 and a newer version |
| 189 |
of Berkeley DB installed on your system. BerkeleyDB attempts |
| 190 |
to build using the db.h for Berkeley DB version 2/3/4 and the version 1 |
| 191 |
library. Unfortunately the two versions aren't compatible with each |
| 192 |
other. BerkeleyDB can only be built with Berkeley DB version 2, 3 or 4. |
| 193 |
|
| 194 |
Solution: Setting the LIB & INCLUDE variables in config.in to point to the |
| 195 |
correct directories can sometimes be enough to fix this |
| 196 |
problem. If that doesn't work the easiest way to fix the |
| 197 |
problem is to either delete or temporarily rename the copies |
| 198 |
of db.h and libdb.a that you don't want BerkeleyDB to use. |
| 199 |
|
| 200 |
Undefined Symbol: db_appinit |
| 201 |
---------------------------- |
| 202 |
|
| 203 |
BerkeleyDB seems to have built correctly, but you get an error like this |
| 204 |
when you run the test harness: |
| 205 |
|
| 206 |
$ make test |
| 207 |
PERL_DL_NONLAZY=1 /home/paul/perl/install/bin/perl5.00561 -Iblib/arch |
| 208 |
-Iblib/lib -I/home/paul/perl/install/5.005_61/lib/5.00561/i586-linux |
| 209 |
-I/home/paul/perl/install/5.005_61/lib/5.00561 -e 'use Test::Harness |
| 210 |
qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t |
| 211 |
t/btree.............Can't load 'blib/arch/auto/BerkeleyDB/BerkeleyDB.so' for |
| 212 |
module BerkeleyDB: blib/arch/auto/BerkeleyDB/BerkeleyDB.so: |
| 213 |
undefined symbol: db_appinit |
| 214 |
at /home/paul/perl/install/5.005_61/lib/5.00561/i586-linux/DynaLoader.pm |
| 215 |
... |
| 216 |
|
| 217 |
|
| 218 |
This error usually happens when you have both version 2 and version |
| 219 |
3 of Berkeley DB installed on your system and BerkeleyDB attempts |
| 220 |
to build using the db.h for Berkeley DB version 2 and the version 3 |
| 221 |
library. Unfortunately the two versions aren't compatible with each |
| 222 |
other. |
| 223 |
|
| 224 |
Solution: Setting the LIB & INCLUDE variables in config.in to point to the |
| 225 |
correct directories can sometimes be enough to fix this |
| 226 |
problem. If that doesn't work the easiest way to fix the |
| 227 |
problem is to either delete or temporarily rename the copies |
| 228 |
of db.h and libdb.a that you don't want BerkeleyDB to use. |
| 229 |
|
| 230 |
Undefined Symbol: db_create |
| 231 |
--------------------------- |
| 232 |
|
| 233 |
BerkeleyDB seems to have built correctly, but you get an error like this |
| 234 |
when you run the test harness: |
| 235 |
|
| 236 |
$ make test |
| 237 |
PERL_DL_NONLAZY=1 /home/paul/perl/install/bin/perl5.00561 -Iblib/arch |
| 238 |
-Iblib/lib -I/home/paul/perl/install/5.005_61/lib/5.00561/i586-linux |
| 239 |
-I/home/paul/perl/install/5.005_61/lib/5.00561 -e 'use Test::Harness |
| 240 |
qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t |
| 241 |
t/btree.............Can't load 'blib/arch/auto/BerkeleyDB/BerkeleyDB.so' for |
| 242 |
module BerkeleyDB: blib/arch/auto/BerkeleyDB/BerkeleyDB.so: |
| 243 |
undefined symbol: db_create |
| 244 |
at /home/paul/perl/install/5.005_61/lib/5.00561/i586-linux/DynaLoader.pm |
| 245 |
... |
| 246 |
|
| 247 |
This error usually happens when you have both version 2 and version |
| 248 |
3 of Berkeley DB installed on your system and BerkeleyDB attempts |
| 249 |
to build using the db.h for Berkeley DB version 3 and the version 2 |
| 250 |
library. Unfortunately the two versions aren't compatible with each |
| 251 |
other. |
| 252 |
|
| 253 |
Solution: Setting the LIB & INCLUDE variables in config.in to point to the |
| 254 |
correct directories can sometimes be enough to fix this |
| 255 |
problem. If that doesn't work the easiest way to fix the |
| 256 |
problem is to either delete or temporarily rename the copies |
| 257 |
of db.h and libdb.a that you don't want BerkeleyDB to use. |
| 258 |
|
| 259 |
|
| 260 |
Incompatible versions of db.h and libdb |
| 261 |
--------------------------------------- |
| 262 |
|
| 263 |
BerkeleyDB seems to have built correctly, but you get an error like this |
| 264 |
when you run the test harness: |
| 265 |
|
| 266 |
$ make test |
| 267 |
PERL_DL_NONLAZY=1 /home/paul/perl/install/bin/perl5.00503 |
| 268 |
-Iblib/arch -Iblib/lib -I/usr/local/lib/perl5/5.00503/i586-linux |
| 269 |
-I/usr/local/lib/perl5/5.00503 -e 'use Test::Harness qw(&runtests $verbose); |
| 270 |
$verbose=0; runtests @ARGV;' t/*.t |
| 271 |
t/btree............. |
| 272 |
BerkeleyDB needs compatible versions of libdb & db.h |
| 273 |
you have db.h version 2.6.4 and libdb version 2.7.5 |
| 274 |
BEGIN failed--compilation aborted at t/btree.t line 25. |
| 275 |
dubious |
| 276 |
Test returned status 255 (wstat 65280, 0xff00) |
| 277 |
... |
| 278 |
|
| 279 |
Another variation on the theme of having two versions of Berkeley DB on |
| 280 |
your system. |
| 281 |
|
| 282 |
Solution: Setting the LIB & INCLUDE variables in config.in to point to the |
| 283 |
correct directories can sometimes be enough to fix this |
| 284 |
problem. If that doesn't work the easiest way to fix the |
| 285 |
problem is to either delete or temporarily rename the copies |
| 286 |
of db.h and libdb.a that you don't want BerkeleyDB to use. |
| 287 |
If you are running Linux, please read the Linux Notes section below. |
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
Solaris build fails with "language optional software package not installed" |
| 292 |
--------------------------------------------------------------------------- |
| 293 |
|
| 294 |
If you are trying to build this module under Solaris and you get an |
| 295 |
error message like this |
| 296 |
|
| 297 |
/usr/ucb/cc: language optional software package not installed |
| 298 |
|
| 299 |
it means that Perl cannot find the C compiler on your system. The cryptic |
| 300 |
message is just Sun's way of telling you that you haven't bought their |
| 301 |
C compiler. |
| 302 |
|
| 303 |
When you build a Perl module that needs a C compiler, the Perl build |
| 304 |
system tries to use the same C compiler that was used to build perl |
| 305 |
itself. In this case your Perl binary was built with a C compiler that |
| 306 |
lived in /usr/ucb. |
| 307 |
|
| 308 |
To continue with building this module, you need to get a C compiler, |
| 309 |
or tell Perl where your C compiler is, if you already have one. |
| 310 |
|
| 311 |
Assuming you have now got a C compiler, what you do next will be dependant |
| 312 |
on what C compiler you have installed. If you have just installed Sun's |
| 313 |
C compiler, you shouldn't have to do anything. Just try rebuilding |
| 314 |
this module. |
| 315 |
|
| 316 |
If you have installed another C compiler, say gcc, you have to tell perl |
| 317 |
how to use it instead of /usr/ucb/cc. |
| 318 |
|
| 319 |
This set of options seems to work if you want to use gcc. Your mileage |
| 320 |
may vary. |
| 321 |
|
| 322 |
perl Makefile.PL CC=gcc CCCDLFLAGS=-fPIC OPTIMIZE=" " |
| 323 |
make test |
| 324 |
|
| 325 |
If that doesn't work for you, it's time to make changes to the Makefile |
| 326 |
by hand. Good luck! |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
Solaris build fails with "gcc: unrecognized option `-KPIC'" |
| 331 |
----------------------------------------------------------- |
| 332 |
|
| 333 |
You are running Solaris and you get an error like this when you try to |
| 334 |
build this Perl module |
| 335 |
|
| 336 |
gcc: unrecognized option `-KPIC' |
| 337 |
|
| 338 |
This symptom usually means that you are using a Perl binary that has been |
| 339 |
built with the Sun C compiler, but you are using gcc to build this module. |
| 340 |
|
| 341 |
When Perl builds modules that need a C compiler, it will attempt to use |
| 342 |
the same C compiler and command line options that was used to build perl |
| 343 |
itself. In this case "-KPIC" is a valid option for the Sun C compiler, |
| 344 |
but not for gcc. The equivalent option for gcc is "-fPIC". |
| 345 |
|
| 346 |
The solution is either: |
| 347 |
|
| 348 |
1. Build both Perl and this module with the same C compiler, either |
| 349 |
by using the Sun C compiler for both or gcc for both. |
| 350 |
|
| 351 |
2. Try generating the Makefile for this module like this perl |
| 352 |
|
| 353 |
perl Makefile.PL CC=gcc CCCDLFLAGS=-fPIC OPTIMIZE=" " LD=gcc |
| 354 |
make test |
| 355 |
|
| 356 |
This second option seems to work when mixing a Perl binary built |
| 357 |
with the Sun C compiler and this module built with gcc. Your |
| 358 |
mileage may vary. |
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
Network Drive |
| 363 |
------------- |
| 364 |
|
| 365 |
BerkeleyDB seems to have built correctly, but you get a series of errors |
| 366 |
like this when you run the test harness: |
| 367 |
|
| 368 |
|
| 369 |
t/btree........NOK 178Can't call method "txn_begin" on an undefined value at t/btree.t line 637. |
| 370 |
t/btree........dubious |
| 371 |
Test returned status 11 (wstat 2816, 0xb00) |
| 372 |
DIED. FAILED tests 28, 178-244 |
| 373 |
Failed 68/244 tests, 72.13% okay |
| 374 |
t/db-3.0.......NOK 2Can't call method "set_mutexlocks" on an undefined value at t/db-3.0.t line 39. |
| 375 |
t/db-3.0.......dubious |
| 376 |
Test returned status 11 (wstat 2816, 0xb00) |
| 377 |
DIED. FAILED tests 2-14 |
| 378 |
Failed 13/14 tests, 7.14% okay |
| 379 |
t/db-3.1.......ok |
| 380 |
t/db-3.2.......NOK 5Can't call method "set_flags" on an undefined value at t/db-3.2.t line 62. |
| 381 |
t/db-3.2.......dubious |
| 382 |
Test returned status 11 (wstat 2816, 0xb00) |
| 383 |
DIED. FAILED tests 3, 5-6 |
| 384 |
Failed 3/6 tests, 50.00% okay |
| 385 |
t/db-3.3.......ok |
| 386 |
|
| 387 |
This pattern of errors happens if you have built the module in a directory |
| 388 |
that is network mounted (e.g. NFS ar AFS). |
| 389 |
|
| 390 |
The solution is to use a local drive. Berkeley DB doesn't support |
| 391 |
network drives. |
| 392 |
|
| 393 |
|
| 394 |
Berkeley DB library configured to support only DB_PRIVATE environments |
| 395 |
---------------------------------------------------------------------- |
| 396 |
|
| 397 |
BerkeleyDB seems to have built correctly, but you get a series of errors |
| 398 |
like this when you run the test harness: |
| 399 |
|
| 400 |
t/btree........ok 27/244 |
| 401 |
# : Berkeley DB library configured to support only DB_PRIVATE environments |
| 402 |
t/btree........ok 177/244 |
| 403 |
# : Berkeley DB library configured to support only DB_PRIVATE environments |
| 404 |
t/btree........NOK 178Can't call method "txn_begin" on an undefined value at t/btree.t line 638. |
| 405 |
t/btree........dubious |
| 406 |
Test returned status 2 (wstat 512, 0x200) |
| 407 |
Scalar found where operator expected at (eval 153) line 1, near "'int' $__val" |
| 408 |
(Missing operator before $__val?) |
| 409 |
DIED. FAILED tests 28, 178-244 |
| 410 |
Failed 68/244 tests, 72.13% okay |
| 411 |
|
| 412 |
|
| 413 |
Some versions of Redhat Linux, and possibly some other Linux |
| 414 |
distributions, include a seriously restricted build of the |
| 415 |
Berkeley DB library that is incompatible with this module. See |
| 416 |
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=91933 for an |
| 417 |
exhaustive discussion on the reasons for this. |
| 418 |
|
| 419 |
|
| 420 |
Solution: |
| 421 |
|
| 422 |
You will have to build a private copy of the Berkeley DB library and |
| 423 |
use it when building this Perl module. |
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
Linux Notes |
| 428 |
----------- |
| 429 |
|
| 430 |
Some versions of Linux (e.g. RedHat 6, SuSe 6) ship with a C library |
| 431 |
that has version 2.x of Berkeley DB linked into it. This makes it |
| 432 |
difficult to build this module with anything other than the version of |
| 433 |
Berkeley DB that shipped with your Linux release. If you do try to use |
| 434 |
a different version of Berkeley DB you will most likely get the error |
| 435 |
described in the "Incompatible versions of db.h and libdb" section of |
| 436 |
this file. |
| 437 |
|
| 438 |
To make matters worse, prior to Perl 5.6.1, the perl binary itself |
| 439 |
*always* included the Berkeley DB library. |
| 440 |
|
| 441 |
If you want to use a newer version of Berkeley DB with this module, the |
| 442 |
easiest solution is to use Perl 5.6.1 (or better) and Berkeley DB 3.x |
| 443 |
(or better). |
| 444 |
|
| 445 |
There are two approaches you can use to get older versions of Perl to |
| 446 |
work with specific versions of Berkeley DB. Both have their advantages |
| 447 |
and disadvantages. |
| 448 |
|
| 449 |
The first approach will only work when you want to build a version of |
| 450 |
Perl older than 5.6.1 along with Berkeley DB 3.x. If you want to use |
| 451 |
Berkeley DB 2.x, you must use the next approach. This approach involves |
| 452 |
rebuilding your existing version of Perl after applying an unofficial |
| 453 |
patch. The "patches" directory in the this module's source distribution |
| 454 |
contains a number of patch files. There is one patch file for every |
| 455 |
stable version of Perl since 5.004. Apply the appropriate patch to your |
| 456 |
Perl source tree before re-building and installing Perl from scratch. |
| 457 |
For example, assuming you are in the top-level source directory for |
| 458 |
Perl 5.6.0, the command below will apply the necessary patch. Remember |
| 459 |
to replace the path shown below with one that points to this module's |
| 460 |
patches directory. |
| 461 |
|
| 462 |
patch -p1 -N </path/to/BerkeleyDB/patches/5.6.0 |
| 463 |
|
| 464 |
Now rebuild & install perl. You should now have a perl binary that can |
| 465 |
be used to build this module. Follow the instructions in "BUILDING THE |
| 466 |
MODULE", remembering to set the INCLUDE and LIB variables in config.in. |
| 467 |
|
| 468 |
|
| 469 |
The second approach will work with Berkeley DB 2.x or better. |
| 470 |
Start by building Berkeley DB as a shared library. This is from |
| 471 |
the Berkeley DB build instructions: |
| 472 |
|
| 473 |
Building Shared Libraries for the GNU GCC compiler |
| 474 |
|
| 475 |
If you're using gcc and there's no better shared library example for |
| 476 |
your architecture, the following shared library build procedure will |
| 477 |
probably work. |
| 478 |
|
| 479 |
Add the -fpic option to the CFLAGS value in the Makefile. |
| 480 |
|
| 481 |
Rebuild all of your .o files. This will create a Berkeley DB library |
| 482 |
that contains .o files with PIC code. To build the shared library, |
| 483 |
then take the following steps in the library build directory: |
| 484 |
|
| 485 |
% mkdir tmp |
| 486 |
% cd tmp |
| 487 |
% ar xv ../libdb.a |
| 488 |
% gcc -shared -o libdb.so *.o |
| 489 |
% mv libdb.so .. |
| 490 |
% cd .. |
| 491 |
% rm -rf tmp |
| 492 |
|
| 493 |
Note, you may have to change the gcc line depending on the |
| 494 |
requirements of your system. |
| 495 |
|
| 496 |
The file libdb.so is your shared library |
| 497 |
|
| 498 |
Once you have built libdb.so, you will need to store it somewhere safe. |
| 499 |
|
| 500 |
cp libdb.so /usr/local/BerkeleyDB/lib |
| 501 |
|
| 502 |
If you now set the LD_PRELOAD environment variable to point to this |
| 503 |
shared library, Perl will use it instead of the version of Berkeley DB |
| 504 |
that shipped with your Linux distribution. |
| 505 |
|
| 506 |
export LD_PRELOAD=/usr/local/BerkeleyDB/lib/libdb.so |
| 507 |
|
| 508 |
Finally follow the instructions in "BUILDING THE MODULE" to build, |
| 509 |
test and install this module. Don't forget to set the INCLUDE and LIB |
| 510 |
variables in config.in. |
| 511 |
|
| 512 |
Remember, you will need to have the LD_PRELOAD variable set anytime you |
| 513 |
want to use Perl with Berkeley DB. Also note that if you have LD_PRELOAD |
| 514 |
permanently set it will affect ALL commands you execute. This may be a |
| 515 |
problem if you run any commands that access a database created by the |
| 516 |
version of Berkeley DB that shipped with your Linux distribution. |
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
Solaris 2.5 Notes |
| 521 |
----------------- |
| 522 |
|
| 523 |
If you are running Solaris 2.5, and you get this error when you run the |
| 524 |
BerkeleyDB test harness: |
| 525 |
|
| 526 |
libc internal error: _rmutex_unlock: rmutex not held. |
| 527 |
|
| 528 |
you probably need to install a Sun patch. It has been reported that |
| 529 |
Sun patch 103187-25 (or later revisions) fixes this problem. |
| 530 |
|
| 531 |
To find out if you have the patch installed, the command "showrev -p" |
| 532 |
will display the patches that are currently installed on your system. |
| 533 |
|
| 534 |
|
| 535 |
Solaris 2.7 Notes |
| 536 |
----------------- |
| 537 |
|
| 538 |
If you are running Solaris 2.7 and all the tests in the test harness |
| 539 |
generate a core dump, try applying Sun patch 106980-09 (or better). |
| 540 |
|
| 541 |
To find out if you have the patch installed, the command "showrev -p" |
| 542 |
will display the patches that are currently installed on your system. |
| 543 |
|
| 544 |
|
| 545 |
HP-UX Notes |
| 546 |
----------- |
| 547 |
|
| 548 |
Some people running HP-UX 10 have reported getting an error like this |
| 549 |
when building this module with the native HP-UX compiler. |
| 550 |
|
| 551 |
ld: (Warning) At least one PA 2.0 object file (BerkeleyDB.o) was detected. |
| 552 |
The linked output may not run on a PA 1.x system. |
| 553 |
ld: Invalid loader fixup for symbol "$000000A5". |
| 554 |
|
| 555 |
If this is the case for you, Berkeley DB needs to be recompiled with |
| 556 |
the +z or +Z option and the resulting library placed in a .sl file. The |
| 557 |
following steps should do the trick: |
| 558 |
|
| 559 |
1: Configure the Berkeley DB distribution with the +z or +Z C compiler |
| 560 |
flag: |
| 561 |
|
| 562 |
env "CFLAGS=+z" ../dist/configure ... |
| 563 |
|
| 564 |
2: Edit the Berkeley DB Makefile and change: |
| 565 |
|
| 566 |
"libdb= libdb.a" to "libdb= libdb.sl". |
| 567 |
|
| 568 |
3: Build and install the Berkeley DB distribution as usual. |
| 569 |
|
| 570 |
|
| 571 |
FreeBSD Notes |
| 572 |
------------- |
| 573 |
|
| 574 |
On FreeBSD 4.x through 6.x, the default db.h is for version 1. The build |
| 575 |
will fail with an error similar to: |
| 576 |
|
| 577 |
BerkeleyDB.xs:74: #error db.h is from Berkeley DB 1.x - need at least |
| 578 |
Berkeley DB 2.6.4 |
| 579 |
|
| 580 |
Later versions of Berkeley DB are usually installed from ports. |
| 581 |
The available versions can be found by running a find(1) command: |
| 582 |
|
| 583 |
% find /usr/local/include -name 'db.h' |
| 584 |
/usr/local/include/db3/db.h |
| 585 |
/usr/local/include/db4/db.h |
| 586 |
/usr/local/include/db41/db.h |
| 587 |
/usr/local/include/db42/db.h |
| 588 |
/usr/local/include/db43/db.h |
| 589 |
|
| 590 |
The desired version of the library must be specified on the command line or |
| 591 |
via the config.in file. Make sure both values point to the same version: |
| 592 |
|
| 593 |
INCLUDE = /usr/local/include/db43 |
| 594 |
LIB = /usr/local/lib/db43 |
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
FEEDBACK |
| 600 |
-------- |
| 601 |
|
| 602 |
General feedback/questions/bug reports can be sent to |
| 603 |
https://github.com/pmqs/BerkeleyDB/issues (preferred) or |
| 604 |
https://rt.cpan.org/Public/Dist/Display.html?Name=BerkeleyDB |
| 605 |
|
| 606 |
Alternatively, email me at [email protected]. |
| 607 |
|
| 608 |
|
| 609 |
How to report a problem with BerkeleyDB. |
| 610 |
---------------------------------------- |
| 611 |
|
| 612 |
To help me help you, I need of the following information: |
| 613 |
|
| 614 |
1. The version of Perl and the operating system name and version you |
| 615 |
are running. The complete output from running "perl -V" will tell |
| 616 |
me all I need to know. |
| 617 |
If your perl does not understand the "-V" option is too old. |
| 618 |
BerkeleyDB needs Perl version 5.004_04 or better. |
| 619 |
|
| 620 |
2. The version of BerkeleyDB you have. If you have successfully |
| 621 |
installed BerkeleyDB, this one-liner will tell you: |
| 622 |
|
| 623 |
perl -MBerkeleyDB -e 'print qq{BerkeleyDB ver $BerkeleyDB::VERSION\n}' |
| 624 |
|
| 625 |
If you are running windows use this |
| 626 |
|
| 627 |
perl -MBerkeleyDB -e "print qq{BerkeleyDB ver $BerkeleyDB::VERSION\n}" |
| 628 |
|
| 629 |
If you haven't installed BerkeleyDB then search BerkeleyDB.pm for a |
| 630 |
line like this: |
| 631 |
|
| 632 |
$VERSION = "1.20" ; |
| 633 |
|
| 634 |
3. The version of Berkeley DB you have installed. If you have |
| 635 |
successfully installed BerkeleyDB, this one-liner will tell you: |
| 636 |
|
| 637 |
perl -MBerkeleyDB -e 'print BerkeleyDB::DB_VERSION_STRING.qq{\n}' |
| 638 |
|
| 639 |
If you are running windows use this |
| 640 |
|
| 641 |
perl -MBerkeleyDB -e "print BerkeleyDB::DB_VERSION_STRING.qq{\n}" |
| 642 |
|
| 643 |
If you haven't installed BerkeleyDB then search db.h for a line |
| 644 |
like this: |
| 645 |
|
| 646 |
#define DB_VERSION_STRING |
| 647 |
|
| 648 |
4. If you are having problems building BerkeleyDB, send me a complete |
| 649 |
log of what happened. |
| 650 |
|
| 651 |
5. Now the difficult one. If you think you have found a bug in |
| 652 |
BerkeleyDB and you want me to fix it, you will *greatly* enhance |
| 653 |
the chances of me being able to track it down by sending me a small |
| 654 |
self-contained Perl script that illustrates the problem you are |
| 655 |
encountering. Include a summary of what you think the problem is |
| 656 |
and a log of what happens when you run the script, in case I can't |
| 657 |
reproduce your problem on my system. If possible, don't have the |
| 658 |
script dependent on an existing 20Meg database. If the script you |
| 659 |
send me can create the database itself then that is preferred. |
| 660 |
|
| 661 |
I realise that in some cases this is easier said than done, so if |
| 662 |
you can only reproduce the problem in your existing script, then |
| 663 |
you can post me that if you want. Just don't expect me to find your |
| 664 |
problem in a hurry, or at all. :-) |
| 665 |
|
| 666 |
|
| 667 |
CHANGES |
| 668 |
------- |
| 669 |
|
| 670 |
See the Changes file. |
| 671 |
|
| 672 |
Paul Marquess <[email protected]> |