Berkeley DB Reference Guide:
Building Berkeley DB XML for UNIX/POSIX systems

PrevRefNext

Building Berkeley DB XML for UNIX/POSIX

The Berkeley DB XML distribution builds up to three separate libraries: the base C++ API Berkeley DB XML library and the optional Java API and Tcl test libraries. Building for Linux and Mac OS X is the same as building for a conventional UNIX platform

The Berkeley DB XML distribution uses the Free Software Foundation's autoconf and libtool tools to build on UNIX platforms. In general, the standard configuration and installation options for these tools apply to the Berkeley DB XML distribution.

Preparing to build

Berkeley DB XML makes use of several third-party libraries. You can build Berkeley DB XML using installed versions of these libraries, or you can build Berkeley DB XML using the standard distributions of these libraries which have been built but not installed. Each of these packages is freely available and distributable under an Open Source license. In the examples below, it is assumed that the source distributions of the libraries are in dbxml-1.2/lib; this is not a requirement. To build Berkeley DB XML, you will need the following third-party libraries:

Berkeley DB
Berkeley DB is a general purpose database toolkit. This release of Berkeley DB XML requires Sleepycat Software's Berkeley DB 4.1.25 release or higher. We recommend Berkeley DB 4.2.52.

When you build Berkeley DB, you must specify the --enable-cxx configuration option, so the minimal build commands for Berkeley DB are:

cd dbxml-1.2/lib/db-4.2.52/build_unix
../dist/configure --enable-cxx
make
make install

This will install Berkeley DB in /usr/local/BerkeleyDB.4.2. If you want to install in a different directory, add --prefix=/path/to/install to the configure line.

If you want to use the Berkeley DB XML Java API, you must also build Berkeley DB with Java support by adding --enable-java to the configure line.

Mac OS X note: Because of shared library namespace issues, it's necessary to specify LD_TWOLEVEL_NAMESPACE=1 on the Berkeley DB configure line. If you enable Tcl, you will need to also need to specifiy LIBTSO_LIBS=-ltcl8.4 (for example) to link with the appropriate Tcl library.

Xerces
Xerces is the Apache implementation of DOM. The build requires a source release of Xerces, not just a binary release. This release of Berkeley DB XML requires the Xerces 2.4.0 release or newer.

The Bourne shell build commands we use for Xerces are:

cd dbxml-1.2/lib/xerces-c-src2_4_0
export XERCESCROOT=`pwd`
cd src/xercesc
./runConfigure -plinux -d -cgcc -xg++ -minmem -nsocket -tnative -rnone
make
make install

You may have to adjust your system type and compiler information, of course.

This will install Xerces under /usr/local. If you want to install in a different directory, add -P/path/to/install to the configure line.

Pathan
Pathan is an XPath 1.0 to Xerces DOM implementation. Berkeley DB XML requires Pathan 1.2 release 2 from DecisionSoft.

If there is a binary release of Pathan for your platform, feel free to use that. Otherwise, you will need to build Pathan from source, which requires GNU make, so you will need to install GNU make if you don't already have it on your system.

The Bourne shell build command we use for Pathan is:

# Keep XERCESCROOT from the Xerces build above
cd dbxml-1.2/lib/libpathan-1.2
./runConfigure
gmake
gmake install

This will install Pathan under /usr/local. If you want to install in a different directory, add --prefix=/path/to/install to the configure line.

Configuring and building Berkeley DB XML

The --with-berkeleydb, --with-pathan and --with-xerces configuration options can be used to specify the location of the install trees. Alternatively, the CFLAGS, LDFLAGS and other standard environment variables can be used to specify the location of the already installed include and library files.

To do a standard UNIX build of Berkeley DB XML using standard distributions of the third-party libraries, change to the build_unix directory and then enter the following two commands, adjust the paths as necessary:

cd dbxml-1.2/build_unix
../dist/configure
make

If you have changed the locations where Berkeley DB, Pathan or Xerces are installed from the defaults, add the arguments --with-berkeleydb=/path/to/db, --with-pathan=/path/to/pathan and/or --with-xerces=/path/to/xerces to configure.

By default, Berkeley DB XML is installed in /usr/local/BerkeleyDBXML.1.2. To change that, add --prefix=/path/to/install to configure. To install the Berkeley DB XML library, enter the following command:

make install

To rebuild Berkeley DB XML, enter:

make clean
make

If you change your mind about how Berkeley DB XML is to be configured, you must start from scratch by entering the following command:

make distclean
../dist/configure
make

To build multiple UNIX versions of Berkeley DB XML in the same source tree, create a new directory at the same level as the build_unix directory, and then configure and build in that directory as described previously.

Building the Java API

To build the DB XML Java API, make sure there is a working javac in your PATH, and specify --enable-java when running both the Berkeley DB and Berkeley DB XML configure scripts. When you run make, the Java support library for Berkeley DB XML will be built, creating the file dbxml.jar in your build directory.

To make use of the DB XML Java API set your environment variable CLASSPATH to include the full pathname of the dbxml.jar file, as well as the db.jar file from Berkeley DB, and your environment variable LD_LIBRARY_PATH to include the .libs subdirectory of your build directory.

Reporting problems

If you have trouble with any of these commands, please send email to the support addresses found in the Sleepycat Software contact information. In that email, please include the following information:


PrevRefNext

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.