Skip to content

Conversation

@mlafeldt
Copy link
Member

@mlafeldt mlafeldt commented Nov 18, 2025

How this works:

When DUCKDB_DOWNLOAD_LIB is set, we map CARGO_TARGET_DIR to target/duckdb-download/<target>/<version>, download the matching DuckDB release archive, unzip it, and add the directory to the linker search path.

We also copy the downloaded library into target/<profile>/deps so test binaries can load it without extra env vars, matching the DUCKDB_LIB_DIR flow.

This will make building much easier - no toolchain to compile DuckDB, or manual downloads and fiddling with DUCKDB_LIB_DIR, etc.

Inspired by

@mlafeldt mlafeldt force-pushed the download-libduckdb branch 4 times, most recently from 7a5427a to fc81d12 Compare November 18, 2025 14:47
How this works:

When `DUCKDB_DOWNLOAD_LIB` is set, we map `CARGO_TARGET_DIR` to
`target/duckdb-download/<target>/<version>`, download the matching
DuckDB release archive, unzip it, and extend link-search/rpath to that
directory.

We also copy the downloaded library into `target/<profile>/deps` so test
binaries can load it without extra env vars, matching the `DUCKDB_LIB_DIR`
flow.

Inspired by

- https://github.com/vortex-data/vortex/blob/develop/vortex-duckdb/build.rs
- https://github.com/nbigaouette/onnxruntime-rs/blob/master/onnxruntime-sys/build.rs
@mlafeldt mlafeldt marked this pull request as ready for review November 18, 2025 15:29
@mlafeldt mlafeldt requested a review from Maxxen November 18, 2025 15:29
@mlafeldt mlafeldt self-assigned this Nov 19, 2025
@mlafeldt mlafeldt merged commit 3d54365 into main Nov 20, 2025
3 checks passed
@mlafeldt mlafeldt deleted the download-libduckdb branch November 20, 2025 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants