summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/docs/build-posix.dox
blob: 4f04cc54dd3073c45511947db4bc600cc87e747d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*! @page build-posix Building and installing WiredTiger on POSIX (Linux, *BSD, OS X):

To read instructions on using the legacy autoconf build system, see  @subpage build-autoconf.

@section posix_github Building using Git and GitHub

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

To build from the WiredTiger GitHub repository requires
<a href="http://git-scm.com/">git</a>,
<a href="https://cmake.org/">CMake</a>,
<a href="https://ninja-build.org/">Ninja</a>.
We also suggest <a href="https://ccache.dev/">ccache</a> for improved build times
and <a href="http://www.swig.org/">SWIG</a> for building with Python support.

First, clone the repository:

@code
git clone git://github.com/wiredtiger/wiredtiger.git
@endcode

Now proceed with @ref posix_building.

@section posix_building 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:

@code
cd wiredtiger
mkdir build
cd build
@endcode

Change into your newly created build directory and using CMake run the build configuration
step to generate your ninja build.
@code
cmake -G Ninja ../.
@endcode

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

@section posix_installing 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 <code>/usr/local/lib</code>.  For example:

@code
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'
@endcode

WiredTiger uses
<a href="https://cmake.org/">CMake</a> to build and install the libraries.
By default, the shared libraries are built. To build only static
libraries, configure WiredTiger using the
\c -DENABLE_STATIC=1 argument.

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

To install WiredTiger:

@code
ninja install
@endcode

To uninstall WiredTiger:

@code
xargs rm < install_manifest.txt
@endcode

The \c install_manifest.txt file is created when you run <code>ninja install</code>.

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

@code
cmake -DCMAKE_INSTALL_PREFIX=/c/wiredtiger -G Ninja ../.
@endcode

@section posix_configure Configuring WiredTiger

The WiredTiger software supports some additional configuration options:

@par \c -DHAVE_ATTACH=1
Configure WiredTiger to sleep and wait for a debugger to attach on failure.
<b>DO NOT</b> configure this option in production environments.

@par \c -DHAVE_DIAGNOSTIC=1
Configure WiredTiger to perform various run-time diagnostic tests.
<b>DO NOT</b> configure this option in production environments.

@par \c -DENABLE_LZ4=1
Configure WiredTiger for <a href="https://github.com/Cyan4973/lz4">LZ4</a>
compression; see @ref compression for more information.

@par \c -DENABLE_PYTHON=1
Build the WiredTiger <a href="http://www.python.org">Python</a> API;
requires <a href="http://swig.org">SWIG</a>.

@par \c -DENABLE_SNAPPY=1
Configure WiredTiger for <a href="http://code.google.com/p/snappy/">snappy</a>
compression; see @ref compression for more information.

@par \c -DENABLE_ZLIB=1
Configure WiredTiger for <a href="http://www.zlib.net/">zlib</a>
compression; see @ref compression for more information.

@par \c -DENABLE_ZSTD=1
Configure WiredTiger for <a href="https://github.com/facebook/zstd">Zstd</a>
compression; see @ref compression for more information.

@par \c -DWT_STANDALONE_BUILD=0
Configure WiredTiger to disable standalone build. Standalone build is enabled
by default.

@par \c -DHAVE_BUILTIN_EXTENSION_LZ4=1, \c -DHAVE_BUILTIN_EXTENSION_SNAPPY=1, \c -DHAVE_BUILTIN_EXTENSION_ZLIB=1, \c -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 \c lz4, \c snappy, \c zlib and \c zstd.

@par <code>-DSPINLOCK_TYPE[=pthread, pthread_adaptive, gcc]</code>
Configure WiredTiger to use a specific mutex type for serialization;
options are \c pthread (the default, which configures WiredTiger to use
POSIX 1003.1c pthread mutexes), \c pthread_adaptive (which configures
WiredTiger to use POSIX 1003.1c pthread mutexes configured to be
adaptive (where that functionality is available), or \c gcc (which
configures WiredTiger to use gcc-based spinlocks).

@section posix_compiler Changing compiler or loader options

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

For example, to explicitly specify the GCC toolchain:

@code
cmake -DCMAKE_TOOLCHAIN_FILE=../build_cmake/toolchains/gcc.cmake -G Ninja ../.
@endcode

To explicitly specify the Clang toolchain:

@code
cmake -DCMAKE_TOOLCHAIN_FILE=../build_cmake/toolchains/clang.cmake -G Ninja ../.
@endcode

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

@code
cmake -DCC_OPTIMIZE_LEVEL=-01 -G Ninja ../.
@endcode
*/