Chapter 2.  Building Berkeley DB XML for UNIX/POSIX systems

Table of Contents

Using the buildall.sh Script
Preparing to build
Building Berkeley DB XML and third-party libraries
Configuring Berkeley DB XML and third-party libraries
Advanced Building and Troubleshooting
Building Individual Berkeley DB XML Libraries for UNIX
Building Individual Libraries
Configuring and building Berkeley DB XML
Building the Java API
Configuring Berkeley DB XML
Changing compilation and link options
Installing Berkeley DB XML
Dynamic shared libraries
Building and Using Berkeley DB XML Applications on UNIX/POSIX Systems
Building C++ Applications
Building Java Applications
Architecture Independent Build FAQ
AIX Build Notes
Solaris Build Notes
FreeBSD Build Notes
Mac OS X Build Notes
Cygwin Build Notes

The Berkeley DB XML distribution comprises several libraries: a base C++ library, three third-party libraries, and optional libraries for additional language interfaces such as Java, Perl, Python, PHP, and Tcl. Instructions for building the base libraries as well as Java and Tcl interfaces are included here. Instructions for the other language bindings appear in their respective directories:

dbxml-6.0.xx/dbxml/src/{perl,php,python}

All bindings require the C++ library and third-party libraries. Building for Linux, Mac OS X, and Cygwin (Windows) is the same as building for a conventional UNIX platform.

Using the buildall.sh Script

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. For ease of use Berkeley DB XML uses a shell script called buildall.sh to drive the build process. It wraps the configure and make steps associated with autoconf.

Preparing to build

Berkeley DB XML makes use of several third-party libraries. Berkeley DB XML provides a shell program that makes it possible to build all of the libraries in one command. The Berkeley DB XML distribution includes the complete source for compatible versions of the third-party libraries. No additional downloads are required. Use of other versions may not work, and may not be supported.

Each of these packages is freely available and distributed under an Open Source license, although Berkeley DB XML depends on specific versions of each. 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 includes Berkeley DB 6.1.x release, and requires the Berkeley DB 4.3.28 release or later.

  • Xerces

    Xerces is the Apache implementation of XML parsing technology and DOM. The build requires a source release of Xerces, not just a binary release. This release of Berkeley DB XML bundles Xerces-C 3.1.2, and requires the Xerces 3.0.1 release or newer.

  • XQilla

    XQilla is an open source partial implementation of XQuery 3.0 and XPath 2.0. Berkeley DB XML bundles a specific public release of XQilla which must be used. Later versions of XQilla may work, but are not implicitly supported.

It is necessary to use GNU make (gmake) to build Berkeley DB XML and its third-party libraries. If you do not already have GNU make on your system, you will need to install it. When using gcc/g++, Berkeley DB XML requires at least a 3.x release of gcc.

Building Berkeley DB XML and third-party libraries

These instructions assume that you are building in the Berkeley DB XML distribution. The simplest possible build command is the following:

cd dbxml-6.0.xx 
sh buildall.sh

This will configure, build, and install all of the libraries using default settings, which installs them into the following directory:

dbxml-6.0.xx/install

The default build supports the C++ interface only. The default build also compiles Berkeley DB XML examples, and places them in the following directory:

dbxml-6.0.xx/dbxml/build_unix

The buildall.sh script has a number of configuration options. You can see them with this command:

sh buildall.sh --help
  • --enable-debug to build debug libraries

  • --prefix=path to change the default common installation path (from ./install)

  • --enable-java to build the Java API. This also requires that there is a working javac in your PATH. The resulting .jar files are created in the install/lib directory. Java examples are also built, and put in:

    dbxml-6.0.xx/dbxml/build_unix/dbxmlexamples.jar
  • --enable-perl to build the Perl interface

  • --disable-compression to disable default compression

  • --clean to clean (make clean) the entire build

  • --distclean to clean (make distclean) the entire build. This option clears the configuration state as well as the compilation state.

There is no option for per-library clean or rebuild in buildall.sh. See Building Individual Berkeley DB XML Libraries for UNIX for information on how to work with each library build.

Configuring Berkeley DB XML and third-party libraries

The buildall.sh script has a number of configuration flags to handle platform-specific issues, change target and destination directories, as well as product configuration options. The flags that start with "--with-" apply to each of the libraries, depending on the name used. In these examples, "libname" is used to represent one of "dbxml," "xerces," "xqilla," or "berkeleydb." For example, a valid flag may be "--with-berkeleydb-prefix=path" or "--with-xerces-prefix=path." The following is a partial list of options:

  • --help

    Use this flag to return a help message for buildall.sh.

  • --enable-debug

    Use this flag to build with -g as a compiler flag and with DEBUG #defined during compilation. This will create libraries and utilities with debugging symbols. This argument should not be specified when configuring to build production binaries.

  • --enable-java

    Use this flag to build with Java support. This builds Java support for both Berkeley DB and Berkeley DB XML. It is necessary to ensure that there is a working javac in your PATH. The resulting .jar files are created in the install/lib directory. Java examples are also built, and put in:

    dbxml-6.0.xx/dbxml/build_unix/dbxmlexamples.jar
  • --enable-perl

    Use this flag to build with Perl support. This builds Perl support for both Berkeley DB and Berkeley DB XML. This option requires a working perl program in your PATH.

  • --with-tcl=path

    Use this flag to build with Tcl support. path is the directory in which the Tcl tclConfig.sh file may be found. See Loading Berkeley DB with Tcl in the Berkeley DB Programmer's Reference Guide for information on sites from which you can download Tcl and which Tcl versions are compatible with Berkeley DB XML.

  • --disable-compression

    Disables default compression. Compression is turned on by default. Default compression requires the library ZLIB. --with-zlib can by used to specify the path to the ZLIB installation.

  • --enable-static-zlib

    Causes the ZLIB library to be linked statically instead of dynamically.

  • --with-zlib=path

    Default compression requires the ZLIB library. If ZLIB is not installed in the directory /usr/local then use this argument to specify the directory in which it is installed. If no ZLIB installation can be found then default compression is disabled automatically.

  • --enable-test

    Enables test suite support. This option requres --with-tcl and --enable-debug, and if using --enable-java it also requires --with-junit.

  • --with-junit

    Path to a JUnit (4) .jar file. This option is required if both --enable-test and -enable-java are specified.

  • -p platform

    To specify a platform type to the Xerces runConfigure script, use -p platform. For most platforms, configure guesses the type correctly. Use this option only if there are configuration errors without it.

  • -c C compiler name

    To build with C compiler other than gcc, specify the name of the compiler, for example, -c cc.

  • -x C++ compiler name

    To build with C++ compiler other than g++, specify the name of the compiler, for example, -x cxx.

  • -m make_command

    To build with make program other than make, specify the name of the program. For example, -m gmake.

  • --no-configure

    To build without re-running the configure step for each library, enter --no-configure as an argument to buildall.sh.

  • --clean

    To clean compilation and linking object from all libraries, use --clean.

  • --distclean

    To clean configuration state from all libraries, use --distclean. After this is done, configuration must be run again in order to build.

  • --build-one=library

    To build, or clean only one of the libraries, use --build-one=library, where library is one of berkeleydb, xerces, xqilla or dbxml.

  • --prefix=path

    To change the common installation directory prefix from the default (./install), specify an alternate path.

  • --with-libname=path

    To use library sources from a location other than the default, specify a path to the source. For example, if Xerces source were located in /home/xerces-c-src_3_1_1, specify, --with-xerces="/home/xerces-c-src_3_1_1"

  • --with-libname-prefix=path

    To change the installation directory for only a single library, specify the path using --with-libname-prefix=path. For example, if Berkeley DB is to be installed in /usr/local/BerkeleyDB.6.1, specify:

    --with-berkeleydb-prefix="/usr/local/BerkeleyDB.6.0"
  • --with-libname-conf=configure flags

    All of the library configurations use the configure program. Use --with-libname-conf=configure flags to pass library-specific configuration flags.

Advanced Building and Troubleshooting

If buildall.sh does not provide enough control for your environment, or if you have trouble with any of these commands, please see the next section, which goes into more detail on build options. At the end of that section, there is information on what to do if build problems persist.