-
Notifications
You must be signed in to change notification settings - Fork 462
fix: pass pkg-config (extra) args when evaluating the expression #11619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - fix: pass pkg-config (extra) args in all pkgconfig invocations. A missing --personality flag would result in pkgconf not finding libraries in some contexts. (#11619, @MisterDA) |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so I understand the issue: we always had the
--personality $TARGETflag int.pkg_config_args(which I guess is partly populated fromPKG_CONFIG_ARGN), we just forgot to pass it topkgconf?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Say we're looking for libcurl. Then,
C.Pkg_config.query_expr_err pc ~package:"libcurl" ~expr:"libcurl >= 7.28.0"will do three invocations:I just found out that if we're not passing
$PKG_CONFIG_ARGNto the first invocation, then it might fail becausepkgconfwould be looking for libcurl in the "default" personality, which may not be the one the current ocaml install is using. So, yes, we forgot to pass it to the first invocation.Note that
PKG_CONFIG_ARGisn't a variable that's understood by pkgconf or pkg-config, it's an escape hatch from the build systems (CMake and Dune) to allow users to pass extra variables to pkgconf/pkg-config invocations—provided the build system doesn't forget to pass the variable!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get that, but from what I understand there were two bugs being fixed in this PR:
PKG_CONFIG_ARGNwasn't respected when doing the call (thus-staticwasn't passed in the test) and now it is. That much makes sense to me.--personalitywas not passed either and now it is. It did not come fromPKG_CONFIG_ARGN(since the firstdune buildinvocation in the test does not have it set) so I assume it was another bug that also existed and is being fixed by this PR.Am I right in this interpretation?
Please add a changelog entry however since it would be nice for people to learn about this fix when we cut the next Dune release.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the bug was rather that Dune forgot to pass the personality flag to the first invocation of pkgconf.
Reading about
--static:I don't think it matters much in the first invocation (just to detect whether the package is available).
The mechanism Dune uses to pass extra flags to pkgconf, whether auto-detected, or from the user through
PKG_CONFIG_ARGN, works when requesting--libsand--cflags.Dune might even be overzealous in doing that first invocation. If we don't get rid of it, maybe just passing the personality flag is enough and we don't need to pass the full
PKG_CONFIG_ARGN. I'm not sure if that would be surprising to users.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I wasn't very clear.
t.pkg_config_argsis either the content ofPKG_CONFIG_ARGNif set, or--personality=$target(set by Dune). Either way it wasn't passed to the first invocation. I don't think the first invocation need the--staticflag anyway, but the user might be willing to pass additional flags. Thinking about it, I'd be surprised if this first invocation is needed at all, meaning that we can pass the content of the expression to when we look for flags.