Version 10.0.2
All Classes Functions Variables Typedefs Enumerations Enumerator Modules Pages
Building and installing WiredTiger on POSIX (Linux, *BSD, OS X):

To read instructions on using the legacy autoconf build system, see Building and installing WiredTiger with autoconf/libtool.

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, CMake, Ninja. We also suggest ccache for improved build times and SWIG for building with Python support.

First, clone the repository:

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

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 create a new directory to run your build from:

cd wiredtiger
mkdir build
cd build

Change into your newly created build directory and using CMake run the build configuration step to generate your ninja build.

cmake -G Ninja ../.

Lastly, in the same directory you configured your build, run the ninja command to start the build:

ninja

Installing WiredTiger

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

WiredTiger's distribution by default builds and installs the shared version library in /usr/local/lib. For example:

file /usr/local/lib/libwiredtiger*
/usr/local/lib/libwiredtiger.so.10.0.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
/usr/local/lib/libwiredtiger.so: symbolic link to `libwiredtiger.so.10.0.1'

WiredTiger uses CMake to build and install the libraries. By default, the shared libraries are built. To build only static libraries, configure WiredTiger using the -DENABLE_STATIC=1 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:

ninja install

To uninstall WiredTiger:

xargs rm < install_manifest.txt

The install_manifest.txt file is created when you run ninja install.

To install WiredTiger's libraries or binaries into alternate locations, configure WiredTiger using the -DCMAKE_INSTALL_PREFIX=custom_path argument. For example, to install the libraries and binaries into a different location:

cmake -DCMAKE_INSTALL_PREFIX=/c/wiredtiger -G Ninja ../.

Configuring WiredTiger

The WiredTiger software supports some additional configuration options:

-DHAVE_ATTACH=1
Configure WiredTiger to sleep and wait for a debugger to attach on failure. DO NOT configure this option in production environments.
-DHAVE_DIAGNOSTIC=1
Configure WiredTiger to perform various run-time diagnostic tests. DO NOT configure this option in production environments.
-DENABLE_LZ4=1
Configure WiredTiger for LZ4 compression; see Compressors for more information.
-DENABLE_PYTHON=1
Build the WiredTiger Python API; requires SWIG.
-DENABLE_SNAPPY=1
Configure WiredTiger for snappy compression; see Compressors for more information.
-DENABLE_ZLIB=1
Configure WiredTiger for zlib compression; see Compressors for more information.
-DENABLE_ZSTD=1
Configure WiredTiger for Zstd compression; see Compressors for more information.
-DWT_STANDALONE_BUILD=0
Configure WiredTiger to disable standalone build. Standalone build is enabled by default.
-DHAVE_BUILTIN_EXTENSION_LZ4=1, -DHAVE_BUILTIN_EXTENSION_SNAPPY=1, -DHAVE_BUILTIN_EXTENSION_ZLIB=1, -DHAVE_BUILTIN_EXTENSION_ZSTD=1
Configure WiredTiger to include support for extensions in the main library. This avoids requiring additional libraries for supported extensions. Currently supported builtin options are for lz4, snappy, zlib and zstd.
-DSPINLOCK_TYPE[=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

By default CMake will use your default system compiler (cc). If you want to use a specific toolchain you can pass a toolchain file. We have provided a toolchain file for both GCC (cmake/toolchains/gcc.cmake) and Clang (cmake/toolchains/clang.cmake). To use either toolchain you can pass the -DCMAKE_TOOLCHAIN_FILE= to the CMake configuration step. For example:

For example, to explicitly specify the GCC toolchain:

cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/gcc.cmake -G Ninja ../.

To explicitly specify the Clang toolchain:

cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/clang.cmake -G Ninja ../.

By default, WiredTiger builds with the -O3 compiler optimization flag unless manually specified through the -DCC_OPTIMIZE_LEVEL configuration option. For example, to specify a different level of optimization:

cmake -DCC_OPTIMIZE_LEVEL=-O1 -G Ninja ../.

Running WiredTiger C/C++ Tests

The WiredTiger CMake build makes available a suite of C/C++ based tests. To run the available tests you can use our smoke test alias (check). Ensure you're in the build directory and execute:

ctest -j$(nproc) -L check

Alternatively to just run all the tests available:

ctest -j$(nproc)

In addition, to get verbose output with your test run you can use the -VV flag:

ctest -j$(nproc) -VV

If you want to focus on running a specific test (i.e. run a test that may be failing) you can use the -R flag:

# Note: -R specifies a regex, where any matching test will be run
ctest -j$(nproc) -R test_name