Berkeley DB: Building for UNIX platforms

Building Berkeley DB on a UNIX platform
Berkeley DB's configuration options
Changing compilers, libraries or compiler and loader options
Installing Berkeley DB

Building Berkeley DB on a UNIX platform:

To perform the default build of Berkeley DB, first change to the build_unix directory, and then enter the following two commands:

	../dist/configure
	make
This will build the Berkeley DB library. To install the Berkeley DB library, enter:

	make install

See below for specific information on what files are installed and in what directories, and how to configure installation on a per-system basis.

If you want to rebuild DB, enter:

	make clean
	make

If you change your mind about how Berkeley DB is configured, you must start from scratch by entering:

	make distclean
	../dist/configure
	make

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

	mkdir build_bsdos3.0
	cd build_bsdos3.0
	../dist/configure
	make

Java support cannot be built using the configuration options. To configure and build the Java API, see the file db/java/README for more information.

If you have trouble with any of these commands, please send email to the addresses found in the Sleepycat Software contact information. In that email, please provide a complete copy of the commands that you entered and their output.


Berkeley DB's configuration options:

There are many options that you can enter to the configuration program, only a few of which are Berkeley DB specific. To see a complete list of the options, enter ../dist/configure --help.

The Berkeley DB specific options are as follows:

--enable-cxx:

--enable-debug:

--enable-diagnostic:

--enable-compat185:

--enable-dump185:

--enable-test:

--disable-bigfile:


Changing compilers, libraries or compiler and loader options:

You can specify a compiler and/or compile and load time flags by using environment variables during configuration. For example, if you want to use a specific compiler, specify the CC environment variable before running configure:

Using anything other than the native compiler will almost certainly mean that you'll want to check the compile and load line flags, too.

To specify debugging and optimization options for the C compiler, use the CFLAGS environment variable:

To specify header file search directories and other miscellaneous options for the C preprocessor and compiler, use the CPPFLAGS environment variable:

To specify debugging and optimization options for the C++ compiler, use the CXXFLAGS environment variable:

To specify miscellaneous options for the linker, use the LDFLAGS environment variable:

If the Tcl or any other include files or libraries are in non-standard places on your system, you will need to specify the directory path where they can be found.

If you want to specify additional libraries and library directories, set the LIBS environment variable before running configure. For example:

would specify two additional directories to search for libraries, /a/b and /e/f, and one additional library to load, "posix".

Make sure that you prepend -L to any library directory names and that you prepend -I to any include file directory names! Also, make sure that you quote the arguments as shown above, i.e. with single or double quotes around the values you're specifying for LIBS, if they contain blank or tab characters.

The env command is available on most systems, and simply sets one or more environment variables before running a command. If the env command is not available to you, you can set the environment variables in your shell before running configure. For example, in sh or ksh, you could do:

and in csh or tcsh, you could do:

See your shell's manual page for further information.


Installing Berkeley DB:

Berkeley DB installs the following files into the following locations, with the following default values:

Variables Default value
prefix /usr/local
bindir $(prefix)/BerkeleyDB/bin
includedir $(prefix)/BerkeleyDB/include
libdir $(prefix)/BerkeleyDB/lib
mandir $(prefix)/BerkeleyDB/docs
File(s) Default location
db.h, db_cxx.h, db_185.h $(includedir)
libdb.a $(libdir)
utilities $(bindir)
documentation $(mandir)

To move the entire installation tree to somewhere besides /usr/local, change the value of prefix. To move the binaries to a different place, change the value of bindir. The values of includedir, libdir and mandir may be similarly changed. These values can be changed as part of configuration:

or when doing the install itself:

Note, the installation process will attempt to create any directories that do not already exist on the system.