-
Notifications
You must be signed in to change notification settings - Fork 848
Fix cabal warning about use of a deprecated profiling flag (Fixes #2350) #2377
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
Fix cabal warning about use of a deprecated profiling flag (Fixes #2350) #2377
Conversation
From cabal 1.21.1 onwards, the flag --enable-profiling is preferred over --enable-executable-profiling. Cabal emits a warning when using the latter flag which also happens to be visible to the user, possibly causing confusion as to whether the warning is due to stack or because of misconfiguration. You can reproduce this bug by running stack build --profile or an equivalent command. This commit fixes this by using --enable-profiling for cabal 1.21.1 or later. This fixes commercialhaskell#2350.
Refactor two options in configureOptsNoDir to use the style based on list comprehensions used elsewhere in the function. This improves consistency and readability.
Thanks for working on this @hesiod! The code looks good to me! How did you test this with a Cabal version < 1.21.1? Do you know some tricks that I don't know? I've only tested this with Cabal-1.24.0.0 and Cabal-1.22.7.0, which were already in my package db, the latter by executing |
And could you add a changelog entry, please! |
After some tinkering, I finally got a way to test this with
The three changes to the cabal file seem to be "real bugs", and while the third case ( Otherwise, stack builds fine with the changes and |
Seems like there's a misunderstanding here. Sorry for not communicating more clearly! When I asked about testing with different Cabal versions above, I was referring to This version of Cabal is entirely unrelated to the version of Cabal that the So when I asked
I wondered if you managed to make I guess |
It seems like the distinction of the two Cabal versions should also be documented somewhere. Do you possibly have a suggestion how to do this, so people might actually find it, @hesiod? What about the haddocks for |
Oops - I probably just read "test with older Cabal versions" and went ahead and tried to build stack with Cabal-1.20.0.4! Furthermore, I didn't realize there was a Regarding documenting the distinction between different Cabal versions: I'm not sure whether I understood you right, but if you mean documenting the difference in the profiling flag used by stack, I don't think that's really required or useful: First, the change is solely a syntactic change, AFAIK, there is no actual difference between |
Since Cabal-1.21.1 was an unreleased development version, we might as well merge the newerProfFlagCabal constraint with newerCabal, which looks for Cabal >= 1.22, i.e. the first stable release following 1.21.1.
No, I was under the impression that you didn't realize the distinction between the But you did? |
cabalVersion = envConfigCabalVersion econfig | ||
newerCabal = cabalVersion >= $(mkVersion "1.22") | ||
newerProfFlagCabal = cabalVersion >= $(mkVersion "1.21.1") | ||
newerCabal = envConfigCabalVersion econfig >= $(mkVersion "1.22") |
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.
Thanks, that's a nice improvement.
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 certainly looks like an improvement from this POV, but actually, this just reverts the changes I made earlier to check for Cabal >= 1.21.1, because checking for a Cabal development version just isn't really useful. But thanks for the compliment anyway!
Well, @sjakobi, I think we managed to misunderstand each other on multiple levels 😄
|
@@ -617,7 +618,9 @@ configureOptsNoDir :: EnvConfig | |||
configureOptsNoDir econfig bco deps isLocal package = concat | |||
[ depOptions | |||
, ["--enable-library-profiling" | boptsLibProfile bopts || boptsExeProfile bopts] | |||
, ["--enable-executable-profiling" | boptsExeProfile bopts && isLocal] | |||
-- Cabal < 1.21.1 does not support --enable-profiling, use --enable-executable-profiling instead | |||
, let profFlag = "--enable-" <> concat ["executable-" | newerCabal] <> "profiling" |
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 this is the wrong way around now – we want to use --enable-profiling
for the more recent versions of Cabal
.
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.
Good catch - fixed in c39acbd
Ha! :) Ok, I think this will be good to merge once my comment on I would really like to have this tested at least manually with Cabal-1.20 though, so in case you'd also like to pick up #2386 be sure to let me know! :) |
Use --enable-executable-profiling for older cabal version (< 1.22), i.e. not newerCabal.
LGTM! |
This fixes issue #2350. See the commit for details.
This PR also includes a minor refactoring commit which improves consistency.