Building from Sources
Edit pageTo build from the sources, first you’ll need to fork and clone the repository from GitHub. Once you have a local copy, proceed with the building process.
Requirements
Section titled “Requirements”Xapiand is written in C++20 and it has the following build requirements:
- pkg-config
- Ninja (optional)
- A C++20 compiler: Clang >= 14 (Apple Clang >= 14) or GCC >= 13
- CMake >= 3.14 (FetchContent is used heavily)
- perl >= 5.6 (for a few building scripts)
- Tcl >= 8.6 (to generate unicode/unicode-data.cc)
Dependencies
Section titled “Dependencies”Xapiand makes use of quite a few libraries. Its search engine is a vendored fork
of Xapian 2.0.0, built as part of the tree,
and most of the remaining building blocks (MessagePack, the storage codecs, logging,
the Asio-based reactor runtime, the Lua
scripting engine via sol2, and more) are pulled in automatically at configure time
through CMake’s FetchContent from the standalone Kronuz libraries, so a network
connection is required the first time you configure. (Earlier releases embedded
ChaiScript and a libev event loop; those are now Lua and the Asio reactor.)
The only external system dependencies you need to provide are:
- zlib
- libpthread (internally used by the Standard C++ thread library)
- ICU >= 54.1 (optional)
To install the requirements under macOS you need:
1. Configure Xcode
Section titled “1. Configure Xcode”Simply installing Xcode will not install all of the command line developer tools, the first time you must execute the following in Terminal, before trying to build:
# Install the command line developer tools:xcode-select --install3. Install Requirements
Section titled “3. Install Requirements”brew install ninjabrew install pkg-configbrew install cmakebrew install icuBuilding process
Section titled “Building process”Get the Sources
Section titled “Get the Sources”First download and untar the Xapiand official distribution or clone the repository from https://github.com/Kronuz/Xapiand.git
git clone -b master --single-branch --depth 1 \ "https://github.com/Kronuz/Xapiand.git"Prepare the Build
Section titled “Prepare the Build”cd Xapiandmkdir buildcd buildConfigure the Build
Section titled “Configure the Build”cmake -GNinja ..Build, Test and Install
Section titled “Build, Test and Install”ninjaninja checkninja installBuild Options
Section titled “Build Options”The build is configured with CMake options, toggled at configure time with
-D<OPTION>=ON / -D<OPTION>=OFF. The defaults produce an optimized, clustered
release; you rarely need to change them for a normal build.
| Option | Default | Description |
|---|---|---|
CMAKE_BUILD_TYPE | Release | Build type (Release, RelWithDebInfo, Debug, …) |
LTO | ON | Link-Time Optimization |
CLUSTERING | ON | Remote clustering |
DATABASE_WAL | ON | Database write-ahead log (WAL) |
DATA_STORAGE | ON | Data storage volumes |
TRACEBACKS | OFF (ON in Debug) | Tracebacks in exceptions |
ASSERTS | OFF (ON in Debug) | Runtime assertions |
TRACKED_MEM | OFF | Allocator that attributes memory to call sites |
BUILD_TESTS | OFF | Build the test suite |
ASAN | OFF | AddressSanitizer (see Sanitizers) |
UBSAN | OFF | UndefinedBehaviorSanitizer |
MSAN | OFF | MemorySanitizer |
TSAN | OFF | ThreadSanitizer |
For example, a debug build with tracebacks and assertions:
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DTRACEBACKS=ON -DASSERTS=ON ..Sanitizers
Section titled “Sanitizers”When building sanitized versions of Xapiand, you’ll need to Configure the Build using the proper library:
Address Sanitizer (ASAN)
Section titled “Address Sanitizer (ASAN)”For developing and debugging, generally you’d want to enable the Address Sanitizer, tracebacks in exceptions and debugging symbols, so you’ll have to Configure the Build using something like:
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTRACEBACKS=ON -DASSERTS=ON -DASAN=ON ..UndefinedBehavior Sanitizer (ASAN + UBSAN)
Section titled “UndefinedBehavior Sanitizer (ASAN + UBSAN)”For developing and debugging, generally you’d want to enable the Address Sanitizer and UndefinedBehavior Sanitizer, tracebacks in exceptions and debugging symbols, so you’ll have to Configure the Build using something like:
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTRACEBACKS=ON -DASSERTS=ON -DASAN=ON -DUBSAN=ON ..Memory Sanitizer (MSAN)
Section titled “Memory Sanitizer (MSAN)”For debugging memory issues, enable Memory Sanitizer and debugging symbols in release mode, so you’ll have to Configure the Build using something like:
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTRACEBACKS=ON -DASSERTS=ON -DMSAN=ON ..Thread Sanitizer (TSAN)
Section titled “Thread Sanitizer (TSAN)”For debugging multithread issues, enable Thread Sanitizer and debugging symbols in release mode, so you’ll have to Configure the Build using something like:
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DTRACEBACKS=ON -DASSERTS=ON -DTSAN=ON ..See Also
Section titled “See Also”- Architecture Overview — the layers and how a request flows through them.
- Dependencies — every fetched library, with links and a transitive tree.
- Internals — source layout, conventions, and load-bearing invariants.
- Building the Xapian Library — compiling the search core standalone.
