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

PrevRefNext

Using Berkeley DB XML on UNIX

An application which uses Berkeley DB XML relies on four libraries: Berkeley DB XML, Berkeley DB, XQilla and Xerces C++. When compiling, the include files from these packages must be available, and the libraries must be included when linking the application.

When running the application, each of the shared libraries must be located by the dynamic linker, usually controlled by system settings and the LD_LIBRARY_PATH environment variable. See Dynamic shared libraries for more information

Assuming Berkeley DB XML, Berkeley DB, Xerces C++ and XQilla have all been built using buildall.sh and installed in the default location, a typical command to compile C++ code that uses Berkeley DB XML is:

g++ -c -Ipath_to_distribution/install/include -c myapp.cpp

If the libraries are in different locations, such as Xerces and XQilla in /usr/local, Berkeley DB in /usr/local/BerkeleyDB.4.5, and Berkeley DB XML in /usr/local/BerkeleyDBXML.2.3, a command might be:

g++ -c -I/usr/local/include
-I/usr/local/BerkeleyDBXML.2.3/include
-I/usr/local/BerkeleyDB.4.5/include -c myapp.cpp

Then, corresponding link commands are:

g++ -o myapp myapp.o -Lpath_to_distribution/install/lib
   -lxqilla -lxerces-c -ldbxml-2.3 -ldb_cxx-4.5

and

g++ -o myapp myapp.o -L/usr/local/lib
    -L/usr/local/BerkeleyDBXML.2.3/lib
    -L/usr/local/BerkeleyDB.4.5/lib -lxqilla
    -l xerces-c -ldbxml-2.3 -ldb_cxx-4.5

Note the use of -ldb_cxx-4.5 and not -ldb-4.5. Berkeley DB XML uses the Berkeley DB C++ API internally, so the link step will fail if the wrong library is used.


PrevRefNext

Copyright (c) 1996,2007 Oracle. All rights reserved.