Repository navigation
fix(rust): unit tests load DuckDB under Cargo 1.100's build-dir layout (#529) - #534
Merged
HananKavitzAmat merged 1 commit intoNov 17, 2026
Merged
Conversation
chunkhound#529) Since Cargo 1.100 the new build-dir layout is always on, and the runtime library path Cargo sets for `cargo test` no longer includes the <profile>/deps directory that libduckdb-sys copies the downloaded library into. The unit-test binary failed to start on every OS (Linux exit 127, macOS dyld abort, Windows 0xc0000135). build.rs now reads DEP_DUCKDB_INCLUDE, hard-links the library into its own OUT_DIR (copying where the filesystem refuses links) and declares that directory with rustc-link-search. Cargo puts such a directory on PATH, LD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH for every binary it runs, so the test binary carries no build-machine path and nothing depends on the build-dir layout. Download mode with the directory or library missing fails the build; static builds and system DuckDB are left alone. Cargo passes `links` metadata to immediate dependents only, so the crate now depends on libduckdb-sys directly, pinned with duckdb. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ofriw
self-requested a review
November 17, 2026 07:21
Collaborator
|
Looks good to me! |
HananKavitzAmat
self-requested a review
November 17, 2026 09:19
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in chunkhound#489, chunkhound#474, chunkhound#488, chunkhound#521, chunkhound#510, chunkhound#504 and chunkhound#534. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in chunkhound#510, chunkhound#504 and chunkhound#534. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in chunkhound#489, chunkhound#474, chunkhound#488, chunkhound#521, chunkhound#510, chunkhound#504 and chunkhound#534. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in the 21 PRs merged to main since this branch was cut (chunkhound#469 through chunkhound#534). No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in chunkhound#534. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in the 21 PRs merged to main since this branch was cut (chunkhound#469 through chunkhound#534). No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in chunkhound#510, chunkhound#504 and chunkhound#534. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
munjikesh
added a commit
to munjikesh/chunkhound
that referenced
this pull request
Nov 17, 2026
Picks up the rust-checks fix (chunkhound#534). Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in chunkhound#521, chunkhound#510, chunkhound#504 and chunkhound#534 on top of the earlier merge of main. realtime/startup.py conflicted only in its imports: chunkhound#504 adds watchdog_event_filter to the .events import and this PR adds the .inotify_overflow import; both are kept. chunkhound#504's event_filter reaches this PR's InotifyObserver through the same schedule() call. One semantic conflict, no textual one: chunkhound#504's test_watches_are_scheduled_without_read_only_events faked _create_watchdog_observer with no arguments and unpacked _bootstrap_fs_monitor as a tuple. This PR changed both (the factory takes on_overflow and returns the observer with its overflow detection; the bootstrap returns WatchdogBootstrap), so the test now fakes and reads them that way, as this PR's own inotify tests do. Its assertions are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in the 24 commits merged to main since this branch was last updated, including chunkhound#534's rust-checks fix. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in the 12 commits merged to main since this branch was last updated, including chunkhound#534's rust-checks fix. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in the 10 commits merged to main since this branch was last updated, including chunkhound#534's rust-checks fix. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in the 36 commits merged to main since this branch was last updated, including chunkhound#534's rust-checks fix. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in the 24 commits merged to main since this branch was last updated, including chunkhound#534's rust-checks fix. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in the 24 commits merged to main since this branch was last updated, including chunkhound#534's rust-checks fix. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in the 14 commits merged to main since this branch was last updated, including chunkhound#534's rust-checks fix. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fstrasz
added a commit
to fstrasz/chunkhound
that referenced
this pull request
Nov 17, 2026
Brings in the 13 commits merged to main since this branch was last updated, including chunkhound#534's rust-checks fix. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 18, 2026
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.
Fixes #529.
Opened at the maintainers' request on #529 ("Go ahead and open the PR", comment), which is why it does not wait in the usual queue.
What changes
build.rs(new): implements the design agreed on rust-checks: make the unit test binary load DuckDB on Cargo 1.100 and later #529, in the order ofriw gave (comment). It readsDEP_DUCKDB_INCLUDE, removes any stale file of the library's name fromOUT_DIR, hard-links the library there (or copies it if the link fails), and emitscargo:rustc-link-search=native=$OUT_DIR. Cargo then putsOUT_DIRonPATH/LD_LIBRARY_PATH/DYLD_FALLBACK_LIBRARY_PATHwhen it runs the test binary. It uses no symlinks. One comment at the top says why it exists, naming the Cargo 1.100 layout change and Cargo's "discouraged" caveat.Cargo.toml: the directlibduckdb-sysdependency above, and one sentence in the duckdb note pointingcargo testlookup atbuild.rs.Cargo.lock: records that dependency (no version changes).When
build.rsacts. It reads the env vars the same way libduckdb-sys does.build.rsdoesDUCKDB_DOWNLOAD_LIB1/true, noDUCKDB_LIB_DIR, not static)DEP_DUCKDB_INCLUDEor the library is missing, the build fails with a message naming what is missing.DUCKDB_STATICset and not0), including the air-gappedDUCKDB_LIB_DIR+DUCKDB_STATIC=1pathDUCKDB_LIB_DIR, dynamic, library in the published dirDownload mode always publishes the directory with the library in it, so a miss there is a wiring failure. In the last row the include dir legitimately holds no library, so a missing library is no error there; that is why "variable set, no library" fails only in download mode.
Known limits (accepted on #529): a test binary run directly, outside
cargo test, gets no library path from Cargo; abuild.build-dirmoved outside the target dir putsOUT_DIRoutside the paths Cargo forwards. Cargo calls relying on this behaviour discouraged; the comment inbuild.rsquotes that caveat and says why it is acceptable for a binary that onlycargo testruns.Acceptance criteria (#529)
Verified with rustc/cargo 1.100.0: Linux locally on a clean
target/(Dockerrust:1.100), and all three OSes in a separate verification workflow on@stable(run 43900691097). That run has two legs per OS. The green legs build this branch and passed: ubuntu, macOS (cancelled on the first attempt, passed on the re-run) and Windows. The red legs build main at 84ab53d without this change and show the "Before" failures below; they end failed, which is why GitHub marks the run as a whole as failed.target/, the full Rust unit test set runs: 140 ubuntu, 140 macOS, 135 Windowslibduckdb.so: cannot open shared object file), macOSdyld: Library not loaded: @rpath/libduckdb.dylib(SIGABRT), Windows0xc0000135 STATUS_DLL_NOT_FOUND.OUT_DIRandDEP_DUCKDB_INCLUDEare used. The test binary (build/chunkhound_native/2d2e2cf3…/out/) and the build script'sOUT_DIR(build/chunkhound_native/98108ad4…/out/) are different directories, and the binary's location is never used.make rust-teston a fresh clone, withLD_LIBRARY_PATHunset.make rust-checkpassesclippy --all-targets -D warningsclean on all three OSes in the verification run.make devandmake dev-releasepasstests/test_smoke.py$ORIGIN:$ORIGIN/../chunkhound.libsand the wheel bundles the samelibduckdb; maturin still resolves it from the download directory.DUCKDB_LIB_DIR+DUCKDB_STATIC=1)build.rsemits no link-search line (cargo check -vvwith an emptyDUCKDB_LIB_DIR). The full static link was not run: it needs alibduckdb_static.a, which I did not have.rust-checksgreen on@stable(1.100 or later)@stabletoo while #527 is open.The mechanism ran as designed (Linux,
cargo test -vv): the build script printedcargo:rustc-link-search=native=…/target/debug/build/chunkhound_native/98108ad474474b3f/out, andls -lishows itslibduckdb.soand the one intarget/duckdb-download/x86_64-unknown-linux-gnu/1.5.4/sharing one inode (link count 2): a hard link, no copy.Binary inspection (after this change)
Linux,
readelf -d <test binary> | grep -E 'RPATH|RUNPATH|NEEDED'(no RPATH or RUNPATH, same as before):macOS,
otool -l <test binary> | grep -A2 LC_RPATHand the DuckDB entry ofotool -L:Windows,
dumpbin /dependents <test binary>.exe:Before this change, the macOS dyld search list already included another build script's
OUT_DIR(target/debug/build/ring/<hash>/out/), which is the path Cargo 1.100 forwards and this change uses.Overlap with open PRs
.github/actions/setup-rust-toolchain/action.yml, so the two merge cleanly in either order. As agreed on rust-checks: make the unit test binary load DuckDB on Cargo 1.100 and later #529, the pin stays until this lands; returning that action to@stableis the follow-up.Cargo.tomlandCargo.lock; those files auto-merge with this change, which adds no conflict to Feat/hub client #442.🤖 Generated with Claude Code, reviewed by FStrasz