Skip to content
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

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

Open
xchern opened this issue Jun 14, 2017 · 13 comments
Open

Comments

@xchern
Copy link

xchern commented Jun 14, 2017

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?

@HeinrichApfelmus
Copy link
Owner

HeinrichApfelmus commented Jun 17, 2017

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?

@jdreaver
Copy link

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?

@HeinrichApfelmus
Copy link
Owner

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

@jdreaver
Copy link

jdreaver commented Jun 17, 2017

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." 😄

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
Copy link

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.

@ReedOei
Copy link

ReedOei commented Aug 17, 2017

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

@ethanabrooks
Copy link

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

@mitchellwrosen
Copy link
Collaborator

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

@ethanabrooks
Copy link

ethanabrooks commented Aug 28, 2017

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

@mitchellwrosen
Copy link
Collaborator

Try putting this in your stack.yaml:

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

@ethanabrooks
Copy link

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.

@mitchellwrosen
Copy link
Collaborator

mitchellwrosen commented Aug 29, 2017

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.

@ethanabrooks
Copy link

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.

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

No branches or pull requests

6 participants