-
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
--ghc-options
are cached, but shouldn't be
#7816
Comments
This may be a left-over from the v1- system where you "configured" a package first and it kept various settings in a configuration. But now Are we correct that this is a bug? Where does it reside? Cabal library, client, elsewhere? |
We don't want to recompile packages (especially dependencies, as command line See #4247 |
Hmm, arguably, |
They change the compiler debug output, but they don't change the result of compilation.
(I'm not sure what |
@konsumlamm: could you try that? Is that an acceptable workflow for you? |
@phadej: so, for my continued education, the deps compiled with the flags will remain in store/, but removing the build directory deletes the cache of flags, so the next build will not pick up the fancy deps, but will use/build vanilla ones? |
So cabal has a list of flags that are non-output changing? Then why are those flags still applied when rebuilding a single module? |
@konsumlamm: I don't understand your question. The flags remain in flag cache (whatever it is), right? |
Toggling |
Yes, the flags from the previous builds are reused, but not everything is recompiled (only the module that changed). So this implies to me that this only happens with certain flags (non-output changing ones, otherwise it should recompile everything). Or are all flags passed via
That works even better, I think this a good enough workaround (at least for my use case), thanks! |
Yes, that's how I undrerstands @phadej's comment above and that's what I find in the linked ticket and PRs relating to it. |
So then my question is: Why are the flags from the previous build reused instead of using the new ones (which in my case are none), when they don't change the output anyway? |
A good question. In theory, there could be flags that break the build if they are not applied consistently to all files. Not sure if that's the answer, though. |
This has been resolved by #7973, thanks all! |
@jneira could you clarify whether that pr disables/fixes caching only for output-changing flags or for all flags? I agree with @phadej that non-output-changing flags should not invalidate the cache. Or does it simply fix #7816 (comment)?
iirc those flags do not get into the hash inputs at all (the output will be the same anyway), so the deps will be reused |
sorry I misunderstood the mentioned pr, it only made ghc-option be applied to local packages and did not affect its caching |
For this particular issue, it's easiest to ignore dependencies. #7973 should have fixed non-local packages to behave more as you would expect (re-used when possible, not rebuilt for flag changes like -ddump*, etc). For this issue: compiler flags are cached as part of the configuration. But, that caching is blind to a specific set of flags (see
Unfortunately, this causes the ignored flags to be "sticky". You can't add/remove an ignored flag in the cache by itself. You either have to delete the cache ( For example,
See "Caching and Recompilation Avoidance" and bullet 3 under "Proposal" for more info: #7998 |
Describe the bug
When passing GHC options to
cabal build
(via--ghc-options
), those options are still applied on later invocations ofcabal build
(unlesscabal clean
has been performed in the meantime).To Reproduce
Steps to reproduce the behavior:
Expected behavior
No core output when building the second time (i.e. don't use the GHC options from the previous build).
System information
cabal-install version: 3.6.2.0
GHC version: 8.10.7
The text was updated successfully, but these errors were encountered: