Search Shortcut cmd + k | ctrl + k
Search cmd+k ctrl+k
0.10 (stable)
Building Extensions

Extensions can be built from source and installed from the resulting local binary.

Building Extensions using Build Flags

To build using extension flags, set the corresponding BUILD_[EXTENSION_NAME] extension flag when running the build, then use the INSTALL command.

For example, to install the httpfs extension, run the following script:

GEN=ninja BUILD_HTTPFS=1 make
# for release builds
build/release/duckdb -c "INSTALL 'build/release/extension/httpfs/httpfs.duckdb_extension';"
# for debug builds
build/debug/duckdb -c "INSTALL 'build/debug/extension/httpfs/httpfs.duckdb_extension';"

Extension Flags

For every in-tree extension that is maintained by core DuckDB there exists a flag to enable building and statically linking the extension into the build.

BUILD_AUTOCOMPLETE

When this flag is set, the autocomplete extension is built.

BUILD_ICU

When this flag is set, the icu extension is built.

BUILD_TPCH

When this flag is set, the tpch extension is built, this enables TPCH-H data generation and query support using dbgen.

BUILD_TPCDS

When this flag is set, the tpcds extension is built, this enables TPC-DS data generation and query support using dsdgen.

BUILD_TPCE

When this flag is set, the TPCE extension is built. Unlike TPC-H and TPC-DS this does not enable data generation and query support. Instead, it enables tests for TPC-E through our test suite.

BUILD_FTS

When this flag is set, the fts (full text search) extension is built.

BUILD_HTTPFS

When this flag is set, the httpfs extension is built.

BUILD_JEMALLOC

When this flag is set, the jemalloc extension is built.

BUILD_JSON

When this flag is set, the json extension is built.

BUILD_INET

When this flag is set, the inet extension is built.

BUILD_SQLSMITH

When this flag is set, the SQLSmith extension is built.

Debug Flags

CRASH_ON_ASSERT

D_ASSERT(condition) is used all throughout the code, these will throw an InternalException in debug builds.
With this flag enabled, when the assertion triggers it will instead directly cause a crash.

DISABLE_STRING_INLINE

In our execution format string_t has the feature to “inline” strings that are under a certain length (12 bytes), this means they don’t require a separate allocation.
When this flag is set, we disable this and don’t inline small strings.

DISABLE_MEMORY_SAFETY

Our data structures that are used extensively throughout the non-performance-critical code have extra checks to ensure memory safety, these checks include:

  • Making sure nullptr is never dereferenced.
  • Making sure index out of bounds accesses don’t trigger a crash.

With this flag enabled we remove these checks, this is mostly done to check that the performance hit of these checks is negligible.

DESTROY_UNPINNED_BLOCKS

When previously pinned blocks in the BufferManager are unpinned, with this flag enabled we destroy them instantly to make sure that there aren’t situations where this memory is still being used, despite not being pinned.

DEBUG_STACKTRACE

When a crash or assertion hit occurs in a test, print a stack trace.
This is useful when debugging a crash that is hard to pinpoint with a debugger attached.

Using a CMake Configuration File

To build using a CMake configuration file, create an extension configuration file named extension_config.cmake with e.g. the following content:

duckdb_extension_load(autocomplete)
duckdb_extension_load(fts)
duckdb_extension_load(httpfs)
duckdb_extension_load(inet)
duckdb_extension_load(icu)
duckdb_extension_load(json)
duckdb_extension_load(parquet)

Build DuckDB as follows:

GEN=ninja EXTENSION_CONFIGS="extension_config.cmake" make

Then, to install the extensions in one go, run:

# for release builds
cd build/release/extension/
# for debug builds
cd build/debug/extension/
# install extensions
for EXTENSION in *; do
    ../duckdb -c "INSTALL '${EXTENSION}/${EXTENSION}.duckdb_extension';"
done
About this page

Last modified: 2024-04-23