-
Notifications
You must be signed in to change notification settings - Fork 841
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
"stack ghci" doesn't honor configured cpp flags #970
Comments
Yeah, stack doesn't consult Setup.hs for flags at the moment. |
Is there a way to pass the flags in at the command line ? (e.g. |
@ranjitjhala do you mean |
Well, the problem IMHO is not so much passing the appropriate flags to |
I was answering the previous question. I actually have no idea how Setup.hs generated flags work, and I'm not certain we have any way of passing them to ghci. |
I've looked into this a bit, and the issue may actually be quite separate from the If these things can change, then I'm not sure how we'd have full support of this. Stack does its whole build plan without running a single configure. For this particular case, it works fine with We might consider having a special case for |
I seem to be having the same problem with darcsden, which doesn't use cabal extension hooks. A flag is declared in the cabal file, enabled, and further down a conditional block sets a cpp flag. stack build sees the cpp flag but stack ghci doesn't. Even with today's stack from git and the --flag option.
|
@simonmichael I think that's a different issue. Are you sure that you've got today's git version of stack? |
No, the build plan is computed based on the information from the Cabal file.
I believe the
It is clearly impossible to have full support for any type of custom build. But that's fine, IMHO. Having support for those custom builds that do reasonable modification (like adding CPP flags, etc.) would be nice, though.
Yes. All commands that run with a configured build environment available should take that information into account. |
Cool, thanks for the info!
Gotcha. It looks to me like we can reasonably ignore all of the contents of
Other than building |
Due to how this package hacks into the Cabal build process, `cabal repl` didn't work: the `cbits` objects weren't built, and the object files weren't passed to the GHC invocation correctly. This commit fixes this hooking into the `replHook` from `Setup.hs`, and trigger a build of `cbits` objects, and adapting the `ghc-wrapper` script to detect `--interactive` usage of GHC, and adjust the command-line arguments accordingly. Note: `stack repl` doesn't work, because Stack seems to bypass `Setup.hs` in its implementation, see commercialhaskell/stack#970. See: commercialhaskell/stack#970
What's the latest on this bug? My project is hitting it, and we'd love to get it fixed! |
No news on this, I'd be glad to assist someone in addressing this, but probably can't fix the problem myself anytime soon, because it's pretty complex and we don't really need it. The state is pretty much as described in #1364 . That said, I would really like to close this gap in functionality for ghci. I think ideally the way this would work is that custom-setup packages are forced to be loaded individually into ghci. Then we don't have to deal with merging the custom setup configured options with the options derived from the normal build type. At least, I'm assuming we'd get just some arguments to pass along to ghci. If we get a package description to use, then potentially these could be straightforwardly combined the info from other packages. |
I'm running into this limitation for termonad as well. I'm defining new CPP macros in As described above, this works well for Is there any sort of work around for getting this to work with |
Can you try with |
@mihaimaruseac Thanks for the suggestion. Unfortunately I'm not sure if I don't think Maybe you meant $ stack exec -- cabal repl
cabal: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with
Cabal. Use the flag --package-db to specify a package database (it can be used
multiple times). |
Yeah, I got into the same problem (i.e., So I guess the proper fix is to make |
(From haskell/haskell-language-server#481)
Thanks! |
The project https://github.com/peti/nix-paths uses Cabal's extension hooks to register additional flags for CPP in the build process. Both
cabal-install
andstack
can build the project fine. The interactive REPL, however, works only forcabal-install
. When I usestack
to interpret the source code, I get the following error:cabal-install
, on the other hand, works just fine:I suppose this means that
stack
doesn't correctly pick up the extra flags provided by Setup.lhs. I'm using Stack version 0.1.4.The text was updated successfully, but these errors were encountered: