-
Notifications
You must be signed in to change notification settings - Fork 704
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
Flag field in cabal.project package stanza does not apply to build tools #7787
Comments
Looks related to #7189 |
I saw that issue but don't think it's related. I did some digging around in the code base and it looks like the issue is in I haven't seen the solver code before, so I could be wrong. But with that fixed I could get the package to build. |
Another reason I don't think it's related is because I can get it to build if I download it and add it to the packages list in cabal.project. |
See pranaysashank@73669e4 which works for me. |
@grayjay looks like you have last touched this part of the code. Perhaps you can help? |
I think that the problem is that there currently isn't a way to specify whether a package section in cabal.project applies to all uses of the package (including use as a build tool) or only the top-level use. I think there is an issue for this, but I wasn't able to find it just now. I was able to make the reproduction progress by using the more expressive constraint field to specify that all uses of happy should be built with -bootstrap, by adding "constraints: any.happy -bootstrap" to the top of cabal.project. Another related issue is #3502, which would add constraint syntax for more of the constraint scope functionality that is already implemented in the solver. For example, it would allow constraining the bootstrap flag of happy only when it is used as a build tool for chc. |
@grayjay Thanks for the breakdown. The package also builds successfully with the flag if I unpack the happy package and add it to the packages section of the project file. Is this difference from when you're downloading from Hackage part of the same issue? I am assuming it works because the flag is applied to the package because its a target. |
Then it is also a local i.e. "top-level" package. i.e. |
- ouroboros-network-lib requires hashtables < 1.3. We would typically constrain hashtables with a constraint in a cabal.project or cabal file. However, because gtk2hs-buildtools is used as a build tool, cabal has no way of applying constraints to gtk2hs-buildtools, so any constraint we enforce from above is ignored. We have to fork the package and apply the constraint at the source. See haskell/cabal#7787
You could also write.. which I imagine will satisfy this use case.
|
Describe the bug
The solver doesn't seem to take into account constraints placed on packages in build-tool-depends.
To Reproduce
With the following cabal file & the cabal.project file:
--- chc.cabal
Expected behavior
Expect the build to succeed with
happy
package built with-bootstrap
flag.System information
cabal
: 3.6.0.0, masterghc
: ghc-9.2.1The text was updated successfully, but these errors were encountered: