Enforce fully static linking for Linux binaries#13
Merged
Conversation
- Add link-self-contained=yes flag for musl targets - Add strict CI verification that binaries have no dynamic dependencies - Fail CI build if ldd shows any libc or other dynamic dependencies - Update comments to clarify platform-specific static linking behavior Linux binaries will have zero runtime dependencies (no libc). macOS cannot be fully static due to Apple restrictions. Windows uses static CRT. Co-Authored-By: Claude Opus 4.5 <[email protected]>
The musl builds produce "static-pie linked" binaries, not "statically linked". Update grep pattern to match both variants. Co-Authored-By: Claude Opus 4.5 <[email protected]>
ldd outputs "statically linked" for static-pie binaries, not "not a dynamic executable". Update the check to match both patterns. Co-Authored-By: Claude Opus 4.5 <[email protected]>
ldd cannot analyze cross-compiled binaries (wrong architecture). Accept ldd errors like "cannot execute" or "wrong ELF class" as valid since the file command already confirmed static linking. Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.
Summary
link-self-contained=yesflag for musl targets to ensure fully static binarieslddshows any libc or other dynamic dependenciesPlatform behavior
Test plan
cargo build --releasesucceedscargo test --allpasses🤖 Generated with Claude Code