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 not passed to GHC when using --ghc-options #796

Closed
rkarp opened this Issue Aug 15, 2015 · 5 comments

Comments

Projects
None yet
2 participants
@rkarp

rkarp commented Aug 15, 2015

When calling for example stack build regex-tdfa-text --ghc-options -XFlexibleContexts (a workaround for a bug in that package) the option --ghc-options has no effect and the build fails.

It's the same problem as in this thread

I've looked at the sources and the reason is this line. If I change it to if True and rebuild Stack, the GHC Options are passed correctly.

There's obviously a reason why this check is there, but it doesn't work properly.

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Aug 15, 2015

This discussion explains a lot of the reasoning around which flags are applied where: https://github.com/commercialhaskell/stack/wiki/FAQ#stack-sometimes-rebuilds-based-on-flag-changes-when-i-wouldnt-expect-it-to-how-come

In order to work around that bug in regex-tdfa-text, you'll likely need to check out the package locally, or possibly via the Git packages feature. Adding ghc-options to stack.yaml (something we've been discussing) may help you get a reliable build out of this situation.

@rkarp

This comment has been minimized.

rkarp commented Aug 15, 2015

Alright, I've read the discussion here. I'm not sure I understand the definition of "wanted". Shouldn't regex-tdfa-text be a wanted dependency in my case?

I actually wanted to build Leksah with Stack, but I cannot do that in a straightforward way due to the regex-tdfa-text package. Problems like this are going to happen again and providing per-package GHC options in stack.yaml would provide an easy solution.

snoyberg added a commit that referenced this issue Aug 16, 2015

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Aug 16, 2015

I've just added this to master and documented it in:

https://github.com/commercialhaskell/stack/wiki/stack.yaml#ghc-options

Can you try this out and confirm that it works for you?

@snoyberg snoyberg added this to the 0.2.0.0 milestone Aug 16, 2015

@rkarp

This comment has been minimized.

rkarp commented Aug 16, 2015

Thanks, setting ghc-options in the stack.yaml works.

--ghc-options still has no effect when building the regex package alone, though. I think how this works exactly needs to be documented somehow and the user should be informed. As a user you'd expect the options to apply at the very least to the packages you've specified to be built.

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Aug 16, 2015

Please see the wiki page, where I've added an explanation. If you have ideas on how to improve the docs on this, please do! Community contributions on this are very welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment