-
Notifications
You must be signed in to change notification settings - Fork 697
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
build pkgconfig db individually when bulk fails #8496
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dc6e136
build pkgconfig db individually when bulk fails
gbaz 51c15d7
fix typo
gbaz 57df0b3
Merge branch 'master' into gb/pkgconfig-fallback
gbaz 7cb27dd
changelog, comments
gbaz f0c5e82
address comments
gbaz 08bfbb6
revert unnecessary extra failure check
gbaz 1d2409f
fix changelog
gbaz c42caf8
Merge branch 'master' into gb/pkgconfig-fallback
mergify[bot] 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 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 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,10 @@ | ||
synopsis: build pkgconfig db individually when bulk fails | ||
packages: cabal-install cabal-install-solver | ||
prs: #8496 | ||
issues: #8494 | ||
|
||
description: { | ||
|
||
- When pkg-config fails to get versions for all packages in bulk, falls back to querying one-by-one. | ||
|
||
} |
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.
As witnessed by
pkg-config --list-all segfaults
on macOS-{11,12} actions/runner-images#6364pkg-config
might be present butpkg-config --list-all
might segfault. What is the strategy in such situations? (Maybe building a pkg-config database eagerly isn't so great after all, one could fill it lazily by demand in the solver, could one?)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.
It looks like cabal treats an error in
pkg-config --list-all
similarly to the inability to find pkg-config, so the solver would only fail in the case where all potential solutions require at least one pkg-config package.The solver is currently pure, so querying packages on demand would be a big change.
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 acknowledge the problem that the solver would not be pure anymore, although it could be made almost pure by placing it into a service monad that only provides a method to resolve a package version via pkg-config (rather than placing it flatly into
IO
). Something like:Lazy querying
pkg-config
would solve the problem wherepkg-config --modversion
is available but notpkg-config --list-all
.There are numerous packages out there that unconditionally declare a
pkgconfig-depends
(not the least,text-icu
), and these all break (in certain circumstances) in the current approach withpkgconfig --list-all
.Note also that the contract given to
--list-all
is minimal, e.g., myman pkg-config
tells me:This does not specify any particular output format, something that
cabal
crucially relies on.In contrast, this is the contract for
--modversion
:Looks rather more specific (thus, binding) to me.
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.
Programming around "an external program is segfaulting" seems like its really pushing it, though I do understand a frustration with images being broken. I would again advise that text-icu put in a flag that varies depending on pkg-config being present and working or not.
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.
Yeah, but I'd like to know whether
pkg-config --list-all
works at all onmacOS-11/12
. Unfortunately, I cannot test it directly as I my machine is still onmacOS-10
. Anyone with a recent macOS willing to investigate thie?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.
So, upstream came back with an analysis: Homebrew/homebrew-core#112785
Not that the details matter, but the upshot is that one broken package configuration breaks
pkg-config --list-all
and consequentlycabal-3.8.1.0
.So, install
imagemagick
orhighway
and suddently your haskell packages fail to build with cabal. Nightmare scenario? Yes!Lesson to learn: stay away from the
pkg-config --list-all
path and only querypkg-config
for the packages you are interested in.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.
Another idea is to work around the segfault by not enforcing pkg-config dependencies when pkg-config exists but the --list-all command fails. Not enforcing pkg-config dependencies is the same behavior as before #7621.
I also think that we should merge this PR first, since it already handles one case where a pkg-config command fails.
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 a broken pkg-config is the same situation as a missing one -- a hard fail is fine, because the intended user pattern should be that there is an auto flag in the package that can switch to how to handle the case where pkg-config is unavailable (because non-existent or broken).
I am aware that not all packages have that flag that allows this switching. But we should encourage them to add it!