Documentation Index
Fetch the complete documentation index at: https://mintlify.com/duckdb/duckdb/llms.txt
Use this file to discover all available pages before exploring further.
Overview
All DuckDB extensions, whether in-tree or out-of-tree, are built using the same underlying mechanism:- DuckDB’s root
CMakeLists.txtserves as the root CMake file - Extensions to build are passed as parameters
- Each extension can be configured for different build modes (loadable binary, statically linked, etc.)
Build Methods
There are several ways to specify which extensions to build when compiling DuckDB.Using Makefile Variables
The simplest method uses theDUCKDB_EXTENSIONS variable with a semicolon-separated list:
Using CMake Directly
You can also pass extensions directly to CMake:Using Build Variables
For convenience, you can use individual build variables:Makefile and are syntactic sugar around the DUCKDB_EXTENSIONS variable.
Extension Configuration Files
For more control over how extensions are built, use extension configuration files. These are CMake files that control extension loading.Configuration File Locations
DuckDB searches for configuration files in this order (later files override earlier ones):Base configuration
extension/extension_config.cmakeExtensions specified here are built every time DuckDB is built. This configuration is always loaded.Client-specific configuration (optional)
tools/*/duckdb_extension_config.cmakeSpecifies which extensions are built and linked into each client (CLI, Python, etc.).Local configuration (optional)
extension/extension_config_local.cmakeYour personal configuration for custom/dev builds. This file is gitignored and should be created by you.Configuration Priority
DuckDB loads these files in reverse order, ignoring subsequent attempts to load an extension with the same name. This allows you to override the base configuration with local settings.The duckdb_extension_load Function
The duckdb_extension_load() function is used in configuration files to specify how extensions should be loaded.
Automatic Loading
The simplest form automatically locates and loads an extension:./extension and ./extension_external directories for the extension.
Don’t Link Option
To build the loadable extension binary without statically linking it:Custom Path
Specify a custom location for the extension:INCLUDE_DIR parameter is optional.
Load from GitHub
Directly install and build an extension from a GitHub repository:Explicitly Disable Extensions
To override and disable an extension enabled in another config:Example Workflows
Override Default Extension Configuration
By default, the parquet extension is statically linked because of this line inextension/extension_config.cmake:
Build Multiple Extensions
Build Out-of-Tree Extension
To build an out-of-tree extension based on the extension-template:Build Extension from GitHub
VCPKG Dependency Management
DuckDB extensions can use VCPKG to manage their dependencies. See the Extension Template for setup examples.Building Multiple Extensions with VCPKG
When building DuckDB with multiple extensions that use VCPKG, you need to merge their dependency manifests:Build Output
After building, you’ll see output indicating which extensions were built:Testing Your Extension
After building a loadable extension:Next Steps
Extension Template
Start building your own extension using the official template
Core Extensions
Study the source code of built-in extensions
Loading Extensions
Learn how to load your built extension