Skip to content

fix(bwrap): emit libcap after standalone archive#21285

Merged
viyatb-oai merged 1 commit intomainfrom
codex/viyatb/fix-bwrap-libcap-link-order
May 6, 2026
Merged

fix(bwrap): emit libcap after standalone archive#21285
viyatb-oai merged 1 commit intomainfrom
codex/viyatb/fix-bwrap-libcap-link-order

Conversation

@viyatb-oai
Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai commented May 6, 2026

Why

#21255 added the standalone codex-bwrap binary. In the Cargo build, pkg_config::probe("libcap") emits -lcap before cc::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_name is still undefined once standalone_bwrap introduces that reference.

The musl setup already builds libcap.a and exposes it through libcap.pc, so the failure is link ordering rather than a missing dependency.

What changed

  • probe libcap with cargo_metadata(false) so pkg-config does not emit its link flags early
  • emit the discovered libcap search paths and libraries after standalone_bwrap is compiled, preserving the needed static-link order

Verification

  • cargo test -p codex-bwrap
  • cargo clippy -p codex-bwrap --all-targets

The affected Linux musl release link is exercised by CI, which is the path this fix targets.

Co-authored-by: Codex noreply@openai.com
@viyatb-oai viyatb-oai marked this pull request as ready for review May 6, 2026 01:54
@viyatb-oai viyatb-oai requested a review from bolinfest May 6, 2026 03:02
@viyatb-oai viyatb-oai merged commit 9766d3d into main May 6, 2026
26 checks passed
@viyatb-oai viyatb-oai deleted the codex/viyatb/fix-bwrap-libcap-link-order branch May 6, 2026 05:22
@github-actions github-actions Bot locked and limited conversation to collaborators May 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants