Repository navigation
fix(release): avoid shadowing bundled static C libs in Linux zigbuild - #7380
Merged
Merged
Conversation
Passing host library directories via -L native=/usr/lib/<multiarch> in CARGO_TARGET_*_RUSTFLAGS puts host directories ahead of crate OUT_DIR search paths during rustc rlib archive bundling and final linking. On Ubuntu 26.04 runners, this silently linked the host GCC-built libsqlite3.a (3.46.1) instead of bundled libsqlite3-sys (3.54.1), breaking Nightly compat-gate migration 61 (SQLite 3.46.1 FTS5 leaves p->pReader open inside a savepoint, causing remove_function to fail with SQLITE_BUSY). Pass host library dirs via -C link-arg=-L<dir> so system .so libraries still resolve at final link time without entering rustc's static archive search path ahead of crate OUT_DIRs. Also verify the linked SQLite runtime version against compiled headers on database open (so release smoke tests catch shadowing immediately) and include child exit status plus host.stderr.log tail in test Host::ready() startup failures.
Contributor
|
I independently reproduced the failure in WSL using the Linux x64 archive from nightly 46012434774 and The history also lines up: #7169 introduced the native search path, and the FTS migration from #7287 exposed it on cold upgrades. #7375 fixed the separate v54 queue migration failure; its post-merge debug replay passed, while the next packaged nightly still failed on all four historical capsules. |
me2seeks
approved these changes
Nov 27, 2026
me2seeks
approved these changes
Nov 27, 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.
Root Cause
Nightly
compat-gatefailed on all 4 historical time capsules (Host ready: "original Host exited before ready"), whilecompat-post-merge(Linux debug) and macOSdistbuilds passed on the exact same commit.Inspecting the Linux
distbinary from the failing run showed:host.stderr.log:unable to delete/modify user-function due to active statementsduring migration 61 (populate_all_fts_terms->c.remove_function("maka_v59_recall_grams", 1)).distbinary was 3.46.1 (COMPILER=gcc-15.2.0) instead of bundledlibsqlite3-sys v0.40.0(3.54.1).linuxSystemLibraryRustflagsinscripts/rust/build-cli.mjsinjected-L native=/usr/lib/x86_64-linux-gnu -L native=/usr/libintoCARGO_TARGET_*_RUSTFLAGS. BecauseRUSTFLAGS-L native=precedes crate build-scriptOUT_DIRsearch paths during bothrustc.rlibbundling (-l static=sqlite3) and final linking (-l static:-bundle=...), Ubuntu's hostlibsqlite3.a(3.46.1) silently shadowed bundledlibsqlite3-sys(3.54.1).fts5UpdateMethoddid not close its cachedp->pReadersqlite3_blobhandle on exit (fixed in newer SQLite), leavingdb->nVdbeActive == 1inside the migration savepoint whenremove_functionran.Changes
scripts/rust/build-cli.mjs+scripts/rust/build-cli.test.mjs: Replace-L native=<dir>with-C link-arg=-L<dir>inlinuxSystemLibraryRustflags.-C link-arg=-L<dir>is excluded fromrustc's.rlibarchive search and placed after crate-L <OUT_DIR>arguments at final link time, so bundled static-sysarchives cannot be shadowed while dynamic system libraries (GTK4/X11/Vulkan) still resolve.platform/event-log/src/connection.rs: Reject a linked SQLite runtime older than compiledlibsqlite3-sysheaders on connection open (rusqlite::version_number() < SQLITE_VERSION_NUMBER), so release smoke tests (maka code --root ...) catch any future SQLite shadowing immediately during the build job.products/maka/cli/tests/support/host.rs: WhenHost::ready()observes EOF before ready, reap the child to include itsExitStatus(exit code / signal) and append the tail ofhost.stderr.logso startup failures are directly diagnosable in CI logs.Verification
-L native=<sys>shadowed bothstatic=andstatic:-bundle=archives, while-C link-arg=-L<sys>linked bundled archives and resolveddylib=from<sys>.node --test scripts/rust/build-cli.test.mjs(5/5 pass)npx --no-install biome check scripts/rust/build-cli.mjs scripts/rust/build-cli.test.mjscargo test --locked -p maka-event-log --lib connection(7/7 pass)cargo clippy --no-deps --locked -p maka-event-log -p maka-cli --lib --bins -- -D warningscargo test --locked -p maka-cli --test upgrade_compat --no-runcargo fmt --manifest-path Cargo.toml -p maka-event-log -p maka-cli -- --checknode scripts/ci.mjs check migrationsnode scripts/asf-license-headers.mjs check