Skip to content

t1-platform: emit online-recovery libraries after the static archive - #60

Open
nonderbe wants to merge 1 commit into
standardagents:mainfrom
nonderbe:fix/as-needed-link-order
Open

nonderbe wants to merge 1 commit into
standardagents:mainfrom
nonderbe:fix/as-needed-link-order

Conversation

@nonderbe

@nonderbe nonderbe commented Nov 7, 2026

Copy link
Copy Markdown

compile_recovery() prints cargo:rustc-link-lib for curl, archive, crypto
and udev before link_native() adds the static t1_platform_native archive.
rustc keeps that order on the linker command line. With a linker that defaults
to --as-needed (Debian and Ubuntu toolchains), the shared libraries are
dropped before anything references them, and the t1-platform lib test then
fails to link with undefined archive_* / curl_* references. (The release
binaries link fine without this change; only the test target failed.)

This change emits the four libraries from link_native(), after the archive,
under the same CARGO_FEATURE_ONLINE_RECOVERY condition. Nothing changes on
toolchains without --as-needed.

Testing

  • Ubuntu 26.04, rustc 1.93.1, GNU ld 2.46: cargo test --locked --workspace --all-targets --all-features --no-fail-fast now links everywhere.
  • In a clean offline Debian package build (with t1-release excluded), all
    1046 tests pass.
  • In my development shell, 5 tests failed for environmental reasons only:
    • the 2 t1-release tests need the Arch repository tools;
    • 3 recovery tests got EPERM from a sandbox there.
  • readelf -d target/release/t1bridge still lists libcurl, libarchive,
    libcrypto, liblzma and libudev.
  • I could not run make quality (no rustfmt or clippy on that machine). The
    change is a move of four lines inside build.rs.

🤖 Generated with Claude Code

compile_recovery() printed cargo:rustc-link-lib for curl, archive, crypto
and udev before link_native() added the static t1_platform_native archive.
rustc keeps that order on the linker command line, so with a linker that
defaults to --as-needed (Debian and Ubuntu toolchains) the shared libraries
are dropped before anything references them and the t1-platform lib test
fails to link with undefined archive_*/curl_* references. The release
binaries link fine without this change.

Emit the four libraries from link_native(), after the archive, under the
same CARGO_FEATURE_ONLINE_RECOVERY condition.

Tested on Ubuntu 26.04 (rustc 1.93.1, GNU ld 2.46): with this change
cargo test --workspace --all-targets --all-features links everywhere; in a
clean offline Debian package build (t1-release excluded) all 1046 tests
pass. target/release/t1bridge still NEEDs libcurl, libarchive, libcrypto,
liblzma and libudev.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant