reactive-banana
reactive-banana copied to clipboard
the `reactive-banana-wx` package cannot be installed under linux with stack
I'm using stack
to install packages, there is no problem installing reactive-banana
but with stack install reactive-banana-wx
, it shows that cabal-macosx-0.2.4.0
is required, but Linux is absolutely not MacOS, which leads to the failure
/tmp/stack6202/reactive-banana-wx-1.1.1.0/Setup.hs:5:1: error:
Failed to load interface for ‘Distribution.MacOSX’
Perhaps you meant
Distribution.Make (from Cabal-1.24.2.0)
Distribution.GetOpt
Distribution.Package (from Cabal-1.24.2.0)
Use -v to see a list of the files searched for.
so, I wonder if reactive-banana-wx
cannot be installed under Linux?
The cabal-macosx
package is cross-platform. I think the problem is actually that reactive-banana-wx
uses a custom setup script, which needs that cabal-macosx
be installed before the reactive-banana-wx
can be configured in the first place. It appears that stack
currently does not offer a good way to handle this?
Hey @HeinrichApfelmus, is it possible you need a setup-depends
field that just includes Cabal
and cabal-macosx
? Here are the cabal docs for custom setup scripts. I'm not sure how this differs from build-depends
; maybe Setup.hs
isn't given access to build-depends
packages and only to setup-depends
packages?
@jdreaver Oh, this seems to be the right field, indeed. It seems to be new, though. Which version of Cabal introduced the setup-depends
field?
To be honest I have no idea. I was just subscribed to this repo, saw this issue, and thought "hm there has to be a way to solve that." :smile:
I did some brief searching around the cabal Github repo. Here is a commit documenting the feature, and I saw some even older example cabal files with setup-depends
in them. So maybe we can say it's about a year old?
There is also some documentation on this somewhere in their source tree in the form of an error message.
Judging by those error messages, it looks like this might work:
custom-setup
setup-depends:
base >= 4.2 && < 5,
Cabal >= 1.23,
cabal-macosx >= 0.1 && < 0.3
I'm not sure if the actual library depends on cabal-macosx
, so if not you could remove it from the build-dependencies
of the library itself.
For what it's worth, I had this same issue and was able to resolve it by putting:
explicit-setup-deps:
"reactive-banana-wx": true
in my stack.yaml
@jdreaver, when I add those lines to the bottom of reactive-banana-wx.cabal
, I get
~/reactive-banana/reactive-banana-wx master* 15s
❯ stack build
Error: While constructing the build plan, the following exceptions were encountered:
In the dependencies for reactive-banana-wx-1.1.1.0:
Cabal-1.22.5.0 must match >=1.23 (latest applicable is 2.0.0.2)
needed since reactive-banana-wx-1.1.1.0 is a build target.
Plan construction failed.
Is it necessary to add that stanza to each build target? The cabal docs do not seem to be clear on that point.
@lobachevzky The custom-setup
stanza is top-level (it allows you to specify dependencies of runhaskell Setup.hs
itself)
I see. That's what yielded the error I mentioned. In case I'm getting something wrong, here's a gist of my cabal file: https://gist.github.com/lobachevzky/021d9a6173cb4aa47cec0a0a672fef8b
Try putting this in your stack.yaml
:
explicit-setup-deps:
- reactive-banana-wx: true
Those lines are already included as part of the original repository. It seems as if one of the dependencies needs an earlier version of cabal, but I am not sure which one.
So I assume the build works for you? It's strange that it works on one system but not another, since stack is supposed to provide an isolated reproducible environment.
Oh, I missed your original error:
Cabal-1.22.5.0 must match >=1.23 (latest applicable is 2.0.0.2)
The problem is @jdreaver's suggestion was incorrect, but @ReedOei's was correct.
Ok. Oddly,
- I had to remove the
custom-setup
lines. - I had to remove the
explicit-setup-deps
lines. - I had to install
libtinfo
.
Then it worked.