-
Notifications
You must be signed in to change notification settings - Fork 696
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 mega issue #7998
Comments
@patrickdoc hi! could be this closed after #7973? |
#7973 only addresses the first item under "proposal" (fixing the scope of command line and program-options to be local-only). Item 2 is mostly just about cleaning up the docs/user interface for using ghc-options in cabal.project, so not a huge deal. Item 3 is a "gotcha". Some flags (basically any options like -ddump or -Wall) can only be added/removed from a project by first running It can probably be closed because 2 and 3 are not really bugs, just rough edges. |
Oh, so i was wrong about #7973 fixing the cache issue and i have to reopen the linked issues (#4247 and #7816) 🤦 @patrickdoc could you confirm those ones should be reopened, please? thanks! |
ok I ve reopened the issues related with caching, sorry for the noise! |
There are a bunch of tickets around some weird behaviors when trying to apply
ghc-options
. I've linked some below, but there are others that are semi-related as well.This issue tries to capture most of the problems in a single place to resolve them.
There are a few ways to pass
ghc-options
(or, more generally${program}-options
for programs likeld
,gcc
,alex
,happy
)cabal.project
In
cabal.project
:[1] The
configureCompiler
phase pulls the options from the local config, which then gets applied to the entire plan's config, triggering a full rebuild. Reproducer:Problematic code:
cabal/cabal-install/src/Distribution/Client/ProjectPlanning.hs
Lines 464 to 515 in 65318cc
Related tickets:
program-options
stanza was intended to only apply locally)-O0
or-fno-code
is supplied as--ghc-options
#7368Command line
Input from the command line suffers a similar fate:
This time it is more intentional:
cabal/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs
Lines 198 to 220 in 65318cc
This note indicates that the idea behind applying these options globally is that you want a consistent tool-chain for the entire build. While that seems reasonable for program paths, I can't think of any good examples for program args.
Related tickets:
Caching and Recompilation Avoidance
These problems are complicated by recompilation avoidance. Some flags do not affect output, so are excluded from the package hash. This same logic is used to determine whether or not the config has changed:
cabal/cabal-install/src/Distribution/Client/ProjectBuilding.hs
Lines 346 to 349 in 65318cc
This causes some flags to get stuck in the config cache until either a
cabal clean
or a non-ignored flag is applied. Reproducer:Related tickets:
--ghc-options
are cached, but shouldn't be #7816Proposal
cabal/cabal-install/src/Distribution/Client/ProjectPlanning.hs
Lines 1969 to 1982 in 65318cc
This makes only-local flags possible, and the previous functionality is still available with:
and make a top-level
ghc-options
legal to be consistent with all the other package settings. This is technically a breaking change, but the stanza is currently undocumented and broken, so it's unlikely to break too many workflows.a. Only cache the normalized config so that we aren't left with a
-ddump-simpl
that we can't get rid ofb. Use the non-normalized config when building so that the user still gets what they want
The text was updated successfully, but these errors were encountered: