reactive-banana icon indicating copy to clipboard operation
reactive-banana copied to clipboard

the `reactive-banana-wx` package cannot be installed under linux with stack

Open xchern opened this issue 7 years ago • 13 comments

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?

xchern avatar Jun 14 '17 09:06 xchern

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?

HeinrichApfelmus avatar Jun 17 '17 08:06 HeinrichApfelmus

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 avatar Jun 17 '17 14:06 jdreaver

@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?

HeinrichApfelmus avatar Jun 17 '17 14:06 HeinrichApfelmus

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.

jdreaver avatar Jun 17 '17 14:06 jdreaver

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.

jdreaver avatar Jun 17 '17 14:06 jdreaver

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

ReedOei avatar Aug 17 '17 21:08 ReedOei

@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.

ethanabrooks avatar Aug 26 '17 20:08 ethanabrooks

@lobachevzky The custom-setup stanza is top-level (it allows you to specify dependencies of runhaskell Setup.hs itself)

mitchellwrosen avatar Aug 27 '17 19:08 mitchellwrosen

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

ethanabrooks avatar Aug 28 '17 14:08 ethanabrooks

Try putting this in your stack.yaml:

explicit-setup-deps:
  - reactive-banana-wx: true

mitchellwrosen avatar Aug 28 '17 16:08 mitchellwrosen

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.

ethanabrooks avatar Aug 29 '17 12:08 ethanabrooks

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.

mitchellwrosen avatar Aug 29 '17 16:08 mitchellwrosen

Ok. Oddly,

  1. I had to remove the custom-setup lines.
  2. I had to remove the explicit-setup-deps lines.
  3. I had to install libtinfo.

Then it worked.

ethanabrooks avatar Aug 30 '17 18:08 ethanabrooks