WiredTiger: Building and installing WiredTiger on POSIX

| Version 3.1.0

Fork me on GitHub Join my user group
Building and installing WiredTiger on POSIX

# Building using Git and GitHub

Skip this step if you are building from a WiredTiger release package, and proceed with Building WiredTiger.

To build from the WiredTiger GitHub repository requires git, autoconf, automake, libtool and related tools. The standard options for those tools can be specified when configuring and building WiredTiger.

First, clone the repository:

git clone git://github.com/wiredtiger/wiredtiger.git

Second, run `autogen.sh` to create the `configure` script:

cd wiredtiger
sh autogen.sh

Now proceed with Building WiredTiger.

# Building WiredTiger

To build the WiredTiger software on a POSIX system, change directory to the top-level directory, then configure and build the software:

cd wiredtiger
./configure && make

To rebuild from scratch, discard any previous configuration by cleaning out the build area:

make distclean

To see additional configuration options, run:

./configure --help

WiredTiger uses autoconf automake, and libtool to create the configure script and Makefiles. The standard options for those tools can be specified when configuring and building WiredTiger.

# Installing WiredTiger

The WiredTiger software consists of a library and a single standalone utility.

WiredTiger's distribution follows the GNU Coding Standards installation guidelines, and by default WiredTiger builds and installs four versions of the library in `/usr/local/lib`. For example:

file /usr/local/lib/libwiredtiger*
/usr/local/lib/libwiredtiger-1.0.0.so: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically linked, not stripped
/usr/local/lib/libwiredtiger.a: current ar archive
/usr/local/lib/libwiredtiger.la: libtool library file
/usr/local/lib/libwiredtiger.so: symbolic link to `libwiredtiger-1.0.0.so'

WiredTiger uses libtool to build the libraries. By default, both shared and static libraries are built. To build only static libraries, configure WiredTiger using the `–disable-shared` argument. To build only shared libraries, configure using WiredTiger using the `–disable-static` argument.

In addition, WiredTiger installs a standalone utility program named `wt`. By default, this utility is installed in `/usr/local/bin/wt`.

To install WiredTiger:

make install

To uninstall WiredTiger:

make uninstall

To install WiredTiger's libraries or binaries into alternate locations, use the configuration or installation options described in the GNU coding standards documentation. For example, to install the libraries and binaries into a different location:

./configure --prefix=/c/wiredtiger

# Configuring WiredTiger

The WiredTiger software supports some additional configuration options:

`–enable-attach`
  Configure WiredTiger to sleep and wait for a debugger to attach on failure. DO NOT configure this option in production environments.

`–enable-diagnostic`
  Configure WiredTiger to perform various run-time diagnostic tests. DO NOT configure this option in production environments.

`–enable-java`
  Build the WiredTiger Java API.

`–enable-leveldb`[=basho, hyper, rocksdb]
  Include a Google, Inc. compatible LevelDB API. Optionally, specify `basho` to build a version of the LevelDB API compatible with Basho's Riak product, specify `hyper` to build a version of the LevelDB API compatible with the HyperDex product, and specify `rocksdb` to build a version of the LevelDB API compatible with applications using Facebook's RocksDB engine. See Building and installing the LevelDB compatibility API for more information.

`–enable-lz4`
  Configure WiredTiger for LZ4 compression; see Compressors for more information.

`–enable-python`
  Build the WiredTiger Python API.

`–enable-snappy`
  Configure WiredTiger for snappy compression; see Compressors for more information.

`–enable-zlib`
  Configure WiredTiger for zlib compression; see Compressors for more information.

`–enable-zstd`
  Configure WiredTiger for Zstd compression; see Compressors for more information.

–with-builtins
  Configure WiredTiger to include support for extensions in the main library. This avoids requiring additional libraries for supported extensions. Currently supported options are `lz4`, `snappy`, `zlib` and `zstd`.

–with-python-prefix
  Configure WiredTiger to install Python libraries to a non-standard Python install location.

–with-spinlock[=pthread, pthread_adaptive, gcc]
  Configure WiredTiger to use a specific mutex type for serialization; options are `pthread` (the default, which configures WiredTiger to use POSIX 1003.1c pthread mutexes), `pthread_adaptive` (which configures WiredTiger to use POSIX 1003.1c pthread mutexes configured to be adaptive (where that functionality is available), or `gcc` (which configures WiredTiger to use gcc-based spinlocks).

# Changing compiler or loader options

To change the compiler or loader behavior during the build, use the `CC`, `CFLAGS`, `LDFLAGS`, or `LIBS` environment variables:

`CC`
  The compiler.

`CFLAGS`
  Compiler flags.

`LDFLAGS`
  Loader flags.

`LIBS`
  Additional libraries.

For example, to specify a different compiler:

env CC=mygcc ./configure

By default, WiredTiger builds with the `-O3` compiler optimization flag unless the `–enable-debug` configuration option is specified, in which case the `-g` compiler flag is used instead. For example, to specify a different level of optimization:

env CFLAGS=-Os ./configure

To specify a different set of include files:

env CFLAGS=-I/usr/local/include ./configure

To specify an additional library:

env LIBS="-lrtf -lmin" LDFLAGS=-L/usr/local/lib ./configure