Skip to content

Support conditional build dependencies in cabal files #589

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

Closed
conklech opened this issue Jul 14, 2015 · 8 comments
Closed

Support conditional build dependencies in cabal files #589

conklech opened this issue Jul 14, 2015 · 8 comments

Comments

@conklech
Copy link

I'm not sure whether this is an issue with stack or something else.

I'm trying to build reflex-dom with stack. It depends on ghcjs-dom, which has a conditional dependency on ghcjs-base that should not be triggered when building with ghc. The condition is if impl(ghcjs) && flag(jsffi).

With a stack.yaml file that specifies ghcjs-dom-0.1.1.3 in the extra-deps, I get the following error:

--  While attempting to add dependency,
    Could not find package ghcjs-base in known packages

--  Failure when adding dependencies:
      ghcjs-base: needed (-any), but not present in build plan
    needed for package: ghcjs-dom-0.1.1.3

When building with GHC, ghcjs-base should not be required by ghcjs-dom. I tried to override this requirement by manually setting the flag jsffi to false in stack.yaml, which also should eliminate the ghcjs-base dependency, but that does does not change anything:

flags: 
  ghcjs-dom:
    webkit: true
    jsffi: false
@snoyberg
Copy link
Contributor

I think you're seeing the outcome of #50, which is a workaround in stack for a long standing Cabal bug.

@conklech
Copy link
Author

Does Cabal only handle conditional dependencies using buildable? If so, I guess #50 could cause this behavior.

Since I've removed all my non-stack build tooling, I can't easily test this with cabal-install. I guess I've assumed that ghcjs-dom is actually buildable with GHC/cabal-install, which is an advertised feature.

@snoyberg
Copy link
Contributor

I may have been mistaken, I'm not sure. I'll be able to check later when I'm at a keyboard again.

@conklech
Copy link
Author

Let me know if you'd like me to prepare a minimal test case.

@snoyberg
Copy link
Contributor

A minimal test case would certainly be helpful. Also, seeing your stack.yaml file from the original report would also be useful.

@snoyberg
Copy link
Contributor

FYI, the following worked for me:

flags:
  text:
    integer-simple: false
  ghcjs-dom:
    ghcjs: false
extra-deps:
- StateVar-1.1.0.0
- adjunctions-4.2.1
- aeson-0.8.1.1
- attoparsec-0.13.0.1
- bifunctors-4.2.1
- cairo-0.13.1.0
- comonad-4.2.6
- contravariant-1.3.1.1
- data-default-0.5.3
- data-default-class-0.0.1
- data-default-instances-base-0.0.1
- data-default-instances-containers-0.0.1
- data-default-instances-dlist-0.0.1
- data-default-instances-old-locale-0.0.1
- dependent-map-0.1.1.3
- dependent-sum-0.2.1.0
- distributive-0.4.4
- dlist-0.7.1.1
- exceptions-0.8.0.2
- free-4.12.1
- ghcjs-dom-0.1.1.3
- gio-0.13.1.0
- glib-0.13.1.1
- gtk3-0.13.9
- hashable-1.2.3.3
- kan-extensions-4.2.2
- lens-4.9.1
- mtl-2.2.1
- nats-1
- old-locale-1.0.0.7
- pango-0.13.1.0
- parallel-3.2.0.6
- prelude-extras-0.4
- primitive-0.6
- profunctors-4.4.1
- ref-tf-0.4
- reflection-1.5.2.1
- reflex-0.2
- safe-0.3.9
- scientific-0.3.3.8
- semigroupoids-4.3
- semigroups-0.16.2.2
- stm-2.4.4
- syb-0.5.1
- tagged-0.8.1
- text-1.2.1.1
- these-0.4.1
- transformers-compat-0.4.0.4
- unordered-containers-0.2.5.1
- utf8-string-1
- vector-0.10.12.3
- void-0.7
- webkitgtk3-0.13.1.3
- webkitgtk3-javascriptcore-0.13.0.4
resolver: ghc-7.10

@conklech
Copy link
Author

Hmph. I'm a dummy; I was looking at the .cabal file on Github for version 0.2.*; the version in both our buildplans, 0.1.1.3, uses the ghcjs flag instead. Thanks for the build plan.

Closed: NOTABUG. Sorry for the distraction.

@snoyberg
Copy link
Contributor

No problem

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

No branches or pull requests

2 participants