Put the libduckdb download client behind a default download-lib feature - #842
Open
gurinderu wants to merge 1 commit into
Open
Put the libduckdb download client behind a default download-lib feature#842gurinderu wants to merge 1 commit into
download-lib feature#842gurinderu wants to merge 1 commit into
Conversation
`ureq` (with rustls/ring) was an unconditional build-dependency of
libduckdb-sys, so every consumer compiled a TLS stack for the build script
even with `bundled`, where the download path is never reached. ring 0.17's
aarch64-apple const-asserts fail on some macOS CI runners, breaking those
builds, and Cargo offers no way to strip a build-dependency from outside.
Move `ureq` and `zip` behind a new `download-lib` feature and gate the
DUCKDB_DOWNLOAD_LIB code path behind it. The feature is on by default, so
default builds behave exactly as before. The `duckdb` crate depends on
libduckdb-sys without defaults and forwards them through its own `default`
feature, so `duckdb = { default-features = false, features = ["bundled"] }`
yields a graph with no ureq/rustls/ring. Setting DUCKDB_DOWNLOAD_LIB without
the feature panics with a message pointing at it.
Author
|
Follow-up on Verification: |
gurinderu
added a commit
to gurinderu/net-observer
that referenced
this pull request
Sep 3, 2026
Upstream libduckdb-sys carries an unconditional build-dependency on ureq, whose rustls feature hard-enables ring. ring then fails to compile on the CI runner — const-assert on aarch64 static CPU features — before a single test runs, which is why the tests workflow has been red on every state of the trunk while lints stayed green. Features only ever add, so it could not be switched off from here. The fork moves that download path behind a default feature, so `default-features = false` with `bundled` drops ureq and ring entirely: cargo tree --invert ring --edges normal,build now finds nothing. Pinned to a revision, not a branch: a branch moves and takes reproducibility with it. The change is upstream as duckdb/duckdb-rs#842 — when it lands, this pin comes off and the dependency returns to crates.io. (realm net-observer, node #45)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
libduckdb-syslistsureq(withrustls) as an unconditional[build-dependencies]entry. Build dependencies are compiled for the host onevery build of every consumer, so each
duckdbuser compiles a TLS stack(
ureq→rustls→ring) for the build script, even withbundled, wherethe download path is never reached.
This has two costs:
It can break builds.
ring0.17.14 (the last release in that line)fails its aarch64-apple CPU-feature const-asserts on some macOS CI runners:
A consumer that has already removed
ringfrom its own runtime graph stillcannot build, because Cargo features are additive and there is no way to
strip a dependency's build-dependency from the outside.
It is wasted work. A
bundledbuild compiles the engine from thevendored tarball and never touches the network, yet still pays for
compiling an HTTP client and a TLS provider.
Changes
Minimal and behaviour-preserving for existing users:
New
download-libfeature onlibduckdb-sysowningureqandzip(both now
optional). It is in the default feature set, so default buildsand
DUCKDB_DOWNLOAD_LIBkeep working exactly as before.The
DUCKDB_DOWNLOAD_LIBcode path inbuild.rsis gated on the feature.Setting the variable without the feature panics with a message pointing at
download-lib.The workspace dependency on
libduckdb-sysis declared withdefault-features = false, and theduckdbcrate forwards the sys defaultsthrough its own
defaultfeature. Consumers can therefore drop the HTTPclient with:
One-line README note. No CI changes,
Cargo.lockunchanged.Verification
cargo tree -p duckdb --no-default-features --features bundled --edges normal,build --invert ringreports no
ringpackage; with default featuresringis present viaureq, as before.cargo clippy -p libduckdb-sys --all-targets -- -D warningspasses withdefault features and with
--no-default-features --features vcpkg,pkg-config.cargo build -p duckdb --no-default-features --features bundledon aarch64-apple is in progress locally; I will post the result in a comment.
Compatibility
No change for anyone using default features. Only consumers who opt into
default-features = falselose the download path, and they get a clearbuild-script error if they also set
DUCKDB_DOWNLOAD_LIB.