-
Notifications
You must be signed in to change notification settings - Fork 701
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
Profiling with Custom setup < 1.24 doesn't work #3790
Comments
I believe this is due to the new What would be nice is if internally we translate from all these flags into one canonical value representing what it means, and the translate back when we construct the Setup.hs command line, and have that translation be version dependent. |
Oh and just to record what we said elsewhere, that ideally we should not have to force cabal version constraints depending on feature flags because it's rather nice to have the property that the versions chosen does not depend on whether we're testing/profiling etc. In cases where we know it's impossible to support a request to use some new feature with an older Cabal lib (used for a custom setup hs) then we can perhaps suggest that users use a flag (e.g. --constraint="Cabal >= x.y" or in cabal.project.local) so that it is explicit. Note that there's also the old |
Hmm, I thought that we already did that? /cc @ttuegel |
Related #3502; right now constraint on Cabal is an all-or-nothing deal. OK, so if we think we can support this for 1.22 that would solve the problem. I've changed the ticket name. |
Apparently we do that:
So the 1.22 bug is different in some way. |
Oh. Ohhhhhhh. |
OK, so the semantics of HEAD (modestly abridged)
The
1.24.0.0
Hard cases:
1.22.0.0
Hard case:
There is a hack in 1.22.5.0:
I... have no idea what this is. 1.20.0.0, 1.18.0 and probably everything older.
Hard case: So, I think what our setup wrapper script should do is just smooth over all the compatibility differences. EDIT: But none of these problems should be causing the bug reported here. CC @ttuegel |
OK, I've diagnosed the actual problem. The problem is with 1.22.5.0 (and any other version with the hack mentioned in the comment above), the semantics of |
So, I think my suggested fix is that we NEVER pass |
That should be fine. Those flags exist to stop folks from shooting themselves in the foot by doing |
In Cabal 1.22.5.0, the semantics of --disable-profiling/--enable-profiling depend on ordering (because there is a hack that operates by looking at the current flag assignment and doing something). In particular, if I specify --enable-library-profiling --disable-profiling, I end up with library profiling DISABLED. The fix is that we NEVER pass --enable-profiling or --disable-profiling to Cabal. At the moment, and according to my historical analysis, Cabal ONLY uses configProf to affect the effective library/executable profiling, which means that anything we do with --enable-profiling, we can do using the library/executable profiling individually. Since these are always flags for the versions of Cabal library we support, we will get order invariance. Historical versions have varied on whether or not setting executable profiling implies library profiling, but if we set both explicitly this change in behavior doesn't matter. This patch is difficult to test because the bad profiling flags can't be induced on an inplace build. I tested by hand by building a package that depended on 'distributive' by hand. Fixes haskell#3790. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Also fixed on the 1.24 branch in #3953. |
It seems that Cabal 1.22 doesn't understand how to install profiling objects, or maybe it doesn't understand the profiling flag? In any case, if we build a custom setup with Cabal 1.22 we will run into trouble if we try to do profiling; see @bitc's report at #3485 for where this cropped up in the wild.
One possible way to fix this is to add an extra solver parameter saying, "Want profiling" and then add extra Cabal library constraints (preferences?) accordingly. But I am a bit worried, because this means that the solver plan with and without profiling will vary, which is pretty confusing because you wouldn't expect turning on profiling to change what libraries get picked (you just wanted to profile the damn configuration you had!) So it's not altogether clear what we should do here. Maybe a compromise is to print a warning in this case?
The text was updated successfully, but these errors were encountered: