pkgconfig: support static linking#27869
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7d8524ee18
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
7d8524e to
a4476e6
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4476e6893
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
a4476e6 to
952ece8
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 952ece874f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
952ece8 to
6b36c0d
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b36c0d145
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
6b36c0d to
2f710ee
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f710ee23d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
2f710ee to
38fffb7
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38fffb7950
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
38fffb7 to
9068717
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9068717919
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
9068717 to
81ecef0
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 81ecef0d10
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
81ecef0 to
ea799b8
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea799b8e13
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea799b8e13
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ea799b8 to
e1395ec
Compare
|
@codex review but reread the PR description and follow the scope and review instructions stated there. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1395ec850
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
e1395ec to
7fb169a
Compare
|
@codex review but reread the PR description and follow the scope and review instructions stated there. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7fb169a2e5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
7fb169a to
eb54738
Compare
|
@codex review but reread the PR description and follow the scope and review instructions stated there. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb54738718
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
eb54738 to
6e4decc
Compare
|
@codex review but reread the PR description and follow the scope and review instructions stated there. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e4decc5ba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| previous := m.find_visible(fragment) | ||
| if previous >= 0 && m.should_merge_visible(previous, fragment) { | ||
| m.fragments.delete(previous) | ||
| m.merge_visible.delete(previous) |
There was a problem hiding this comment.
Preserve repeated direct archive operands
When a public Libs: field intentionally repeats a direct archive operand, e.g. Libs: /path/libcycle.a /path/libcycle.a, this merge path treats the archive like a normal visible fragment and deletes the earlier occurrence before appending the later one. Repeating a static archive is a valid way for .pc metadata to satisfy circular symbol dependencies, so V can now emit only one archive and fail links that the pkg-config metadata explicitly made repeatable.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The circular-archive scenario is real, but this is not actionable for this PR. For ordinary public Libs fragments, V intentionally follows pkgconf 2.5.1, which also collapses A B A to B A. Repetitions required for circular resolution are already preserved in Libs.private, linker groups, and positional epochs, and the existing tests explicitly encode that policy. Changing public direct archives would diverge from the selected oracle and expand the scope beyond vlang/gui#74.
|
@codex review but reread the PR description and follow the scope and review instructions stated there. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e4decc5ba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if flag.starts_with(prefix) { | ||
| res << flag |
There was a problem hiding this comment.
Preserve split operands in static-only filters
When a static .pc file uses valid split operands such as Libs: -L /dir -l foo or Cflags: -I /dir, this token-by-token filter keeps only the -L/-l/-I control token for --*-only-* queries and drops the following operand; --libs-only-other has the inverse problem and emits those dropped operands as standalone “other” flags. In #pkgconfig --static --libs-only-L ... the checker then feeds a bare -L into parse_pkgconfig_link_flags, which rejects it as missing a path, while the CLI output is also unusable.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Rejected for this PR. pkgconf 2.5.1 produces the same bare controls and standalone operands for split-form ---only- queries, and V's historical dynamic directive behaves identically. The complete static compiler path used by vlang/gui#74 preserves the split pairs and links successfully. Making these metadata-only filters pair-aware would diverge from the selected oracle and expand this PR into a general CLI-filter contract change.
6e4decc to
5ef7e9d
Compare
5ef7e9d to
d2662d9
Compare
Summary
This PR adds generic static pkg-config support to V.
-statictoken is passed through-cflags#pkgconfig --staticdirectives.pcfield names case-insensitivelyThe implementation and tests are fully self-contained. No Pango, vglyph, vcpkg, external consumer, or external pkgconf oracle is added to V or its CI.
This issue was originally identified on vgui.
Scope boundaries and intentionally unchanged behavior
This PR is deliberately limited to explicit static pkg-config resolution and ordered propagation of the resulting flags.
It does not:
CFLAGSorLDFLAGS; these remain opaque compiler pass-through inputs. Static mode is selected through V's parsed-cflags/-ldflags -staticoptions or an explicit#pkgconfig --staticdirective;pkgconfexecutable at compiler runtime;-l*.LIBnormalization behavior.Previously reviewed non-actionable findings
The following recurring Codex findings have already been checked with executable probes:
CFLAGS/LDFLAGSshould select static mode: rejected because these variables are backend pass-through inputs, not semantic dependency-resolution selectors.pkgconf 2.5.1. For shared public/private dependencies, multiple roots, cycles, and diamonds, pkgconf and V emit each dependency once in the same order. Explicit repeated library fragments and positional linker groups are still preserved.pkgconf 2.5.1oracle. Metadata-only queries remain direct reads, while--existsand flag-producing queries validate the required closure.pkgconf 2.5.1.@codex Please do not reopen these findings without a reproducer against the current PR head and the selected
pkgconf 2.5.1oracle.Validation
A dedicated smoke matrix passed on:
All changed V files pass
v fmt -verify, andgit diff --checkis clean.Fixes vlang/gui#74