Open Kleidukos opened 3 months ago
@grayjay Do you have a first opinion on the feasibility of such a thing?
I'm not sure which of these you're asking for:
cardano-crypto-class
if you used an older GHC. Who are we to say? And in general the solver error can be more complex.[__3] rejecting: cardano-crypto-class; 2.1.5.0, 2.1.4.0 (conflict: pkg-config package libblst-any, not found in the pkg-config database) this ain't it chief. we're done. sorry.
no trying base 3.0, no endless spam of every minor version of every transitive package and how it doesn't work with some other package
This is what you would get... if someone had put a lower-bound on cardano-crypto-class
. It looks like they haven't and so are advertising that it will work with all historical versions, which is false (and leads to bad error messages like this when we try).
If people want to provide optional system dependency, we have a tool for it, it's called a flag. The solver is even able to switch them on and off if it thinks it will help finding a working plan.
This doesn't make sense to me, can you elaborate? In the example you give it doesn't look like the dependency is optional, rather it became mandatory at some point in the version history.
@michaelpj thank you for popping up,
Don't backtrack if you hit a missing system dependency, instead just fail immediately. This seems like a major change to how the solver works and doesn't obviously seem like a good idea at all. Why shouldn't we look for a plan that works without the system dependency?
That's indeed a major change. Why shouldn't we indeed, because then if the cabal file misses lower bounds as you say, it leads to such messages.
If you in fact don't want to install the system library then perhaps it is helpful to know that you could use an old version of cardano-crypto-class if you used an older GHC.
Can you and other maintainers of this library can tell me if this how cardano-crypto-class
is supposed to be depended on? Because your message above makes me understand that it was involuntary. Maybe @erikd and @angerman can chime in too?
In general, the direction of this flow is a bad heuristic because it cannot differ between people who make a conscious choice of not having the library installed and those who haven't installed the library yes. It assumes that people are all-knowing, whereas the majority of people are just waiting to be told "you haven't installed this system library for the build to proceed".
Who are we to say?
We are the people doing tech support on Discord for beginners, who notice the same UX problems coming up again and again and again.
Staying on a library version that doesn't require the system dependency is as easy as putting a bound in your own cabal file.
This doesn't make sense to me, can you elaborate?
If a package provides an optional system dependency, they can do it with a cabal flag like in text. Indeed that's not the case of cardano-crypto-class
although the end-user nor the solver can't know that, they are just confronted to the ugly error message.
If people want to provide optional system dependency, we have a tool for it, it's called a flag. The solver is even able to switch them on and off if it thinks it will help finding a working plan.
The solver is able to switch automatic flags to avoid system dependencies precisely because it backtracks if any dependency (be it native or system or setup or build tool) is not satisfied. Changing this behavior is likely to be pretty damaging and counterintuitive.
Okay so how do we make it so that the base experience of cabal beginners is improved?
Okay so how do we make it so that the base experience of cabal beginners is improved?
Well, I think there's a lot of low-hanging fruit in simply reporting the current state in a less obscure fashion:
Can you and other maintainers of this library can tell me if this how cardano-crypto-class is supposed to be depended on? Because your message above makes me understand that it was involuntary.
I tried to encourage Cardano folks to use more dependency bounds but it wasn't popular. I guess this is just a consequence :shrug: Perhaps we need to publicize more that poor lower bounds leads to worse errors for your users?
Staying on a library version that doesn't require the system dependency is as easy as putting a bound in your own cabal file.
How are you supposed to know to do that? The solver output, while verbose, does give you the hints you need to see which versions are problematic.
If a package provides an optional system dependency, they can do it with a cabal flag like in text.
There has been some discussion about this recently, but cabal flags as they currently exist are not very good for this purpose and I wouldn't recommend that people do that unless they really have to.
Can you and other maintainers of this library can tell me if this how
cardano-crypto-class
is supposed to be depended on? Because your message above makes me understand that it was involuntary. Maybe @erikd and @angerman can chime in too?
That is maybe libsodium
, but more likely to be libblst
(https://github.com/supranational/blst/) whose authors have decided to make it particularly difficult to package.
I tried to encourage Cardano folks to use more dependency bounds but it wasn't popular. I guess this is just a consequence 🤷 Perhaps we need to publicize more that poor lower bounds leads to worse errors for your users?
Lower bounds everywhere is probably not necessary. However, specific, targeted lower bounds are a good idea. cardano-crypto-class does already have a few lower bounds. Adding another would probably make sense.
The lowest recommended compiler for the Cardano code base is ghc-8.10.7
so a lower bound like base >= 4.14
would make sense.
Are there more lines in the error message? I would have expected cabal to try more versions of base
and print the final conflict set. What was the command? I'm especially interested in whether this run used --minimize-conflict-set
.
I don't think that it is easy to determine which conflicts are more important to users in general, but in this case I would have expected the solver to de-emphasize the conflict with base
. The solver already has a heuristic for choosing base
as early as possible: https://github.com/haskell/cabal/blob/72e54398ab40d0b97d9f342d35c4d6d3128d1736/cabal-install-solver/src/Distribution/Solver/Modular/Preference.hs#L400-L404
I'm wondering if the issue is that the solver applies the heuristic when trying to find a solution (visible with -v3
) but not when generating the summarized log.
Let's take a very real and reproducible solver error message:
Two things happen here:
base
it has picked forbase
. You are then led to believe that the GHC version you use must be modifiedlibblst
system library, and the solver has decided that it would simply find a version that would require it.However these are two very different types of error, and mixing them together does not help anyone!
@PPKFS comments, quite understandably:
If people want to provide optional system dependency, we have a tool for it, it's called a flag. The solver is even able to switch them on and off if it thinks it will help finding a working plan.
Let's get rid of this quirk.