fix(bwrap): emit libcap after standalone archive#21285
Merged
viyatb-oai merged 1 commit intomainfrom May 6, 2026
Merged
Conversation
Co-authored-by: Codex noreply@openai.com
bolinfest
approved these changes
May 6, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Why
#21255 added the standalone
codex-bwrapbinary. In the Cargo build,pkg_config::probe("libcap")emits-lcapbeforecc::Build::compile("standalone_bwrap")adds the static bwrap archive. The Linux musl link then sees-lcap -lstandalone_bwrap; because static archives are resolved left-to-right,cap_from_nameis still undefined oncestandalone_bwrapintroduces that reference.The musl setup already builds
libcap.aand exposes it throughlibcap.pc, so the failure is link ordering rather than a missing dependency.What changed
libcapwithcargo_metadata(false)sopkg-configdoes not emit its link flags earlylibcapsearch paths and libraries afterstandalone_bwrapis compiled, preserving the needed static-link orderVerification
cargo test -p codex-bwrapcargo clippy -p codex-bwrap --all-targetsThe affected Linux musl release link is exercised by CI, which is the path this fix targets.