Statically Linked DuckDB in Rust
January 8, 2026 ยท View on GitHub
This is sample code showing how to build a Rust program statically linked to DuckDB, including some extensions.
How to use
Setup vcpkg in ../vcpkg
git clone git@github.com:microsoft/vcpkg.git ../vcpkg
cd ../vcpkg
sh ./scripts/bootstrap.sh -disableMetrics
Clone duckdb into ../duckdb-src, checkout desired commit.
git clone git@github.com:duckdb/duckdb.git ../duckdb-src
cd ../duckdb-src
git checkout v1.4.3
Install other build dependencies. See duckdb docs.
Run ./build-duckdb-libs.sh. This will build a DuckDB static library into ../duckdb-lib, including the desired extensions.
Run ./run.sh to build and run the code.