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

`stack ghci` doesn't work while `stack build` does #665

Closed
Fuuzetsu opened this Issue Jul 23, 2015 · 18 comments

Comments

Projects
None yet
10 participants
@Fuuzetsu
Contributor

Fuuzetsu commented Jul 23, 2015

I have a project here where stack build works happily but stack ghci does not. I would expect that if stack build can build the project, stack ghci should have no problem giving me a repl. I inline the description of the particular issue from the mailing list:

We have a test with

#include <Rversion.h>

This is provided by the R language. On my system, the R/lib is in a
non-standard location.

Nevertheless, my CPP/gcc are wrapped in a script which uses NIX_LDFLAGS
env var which amongst other things has
-L/nix/store/jvvpcckvzybr7y0zmj1x5psb5sy7ipa7-R-3.2.1/lib

So everything works when I stack build.

But when I try to use ‘stack ghci’ on the project, I get

     fatal error: Rversion.h: No such file or directory
     #include <Rversion.h>

Is there anything I can do so ‘stack ghci’ just works like ‘stack build’
does?

In my case it is about CPP being used but this is a bit of a general question.

Using stack from a day or so old git checkout.

@rrnewton

This comment has been minimized.

Show comment
Hide comment
@rrnewton

rrnewton Jul 24, 2015

Contributor

The LVish project is also one where stack build works but stack ghci fails on stack 0.1.2.0. In its case it fails with the following on Mac OS:

$ stack ghci
Configuring GHCi with the following packages: concurrent-skiplist, lvish, par-classes, par-collections, test-par-collections, par-mergesort, par-transformers
GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package criterion
    (use -v for more information)

That looks like maybe a mixup with the dependencies of the different targets. I.e. criterion should only be required for benchmark targets, and thus wasn't built by stack buildalone.

On a related note, I also think it is too bad that stack ghci stops working when a build error breaks stack build. That is, a lot of the time I want to poke around in the repl, or at least use the dependencies when I just broke the build. For example, with stack itself, if you put garbage in a module (say, Main.hs for the executable), then:

$ stack ghci
Configuring GHCi with the following packages: stack
GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package stack
    (use -v for more information)
Contributor

rrnewton commented Jul 24, 2015

The LVish project is also one where stack build works but stack ghci fails on stack 0.1.2.0. In its case it fails with the following on Mac OS:

$ stack ghci
Configuring GHCi with the following packages: concurrent-skiplist, lvish, par-classes, par-collections, test-par-collections, par-mergesort, par-transformers
GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package criterion
    (use -v for more information)

That looks like maybe a mixup with the dependencies of the different targets. I.e. criterion should only be required for benchmark targets, and thus wasn't built by stack buildalone.

On a related note, I also think it is too bad that stack ghci stops working when a build error breaks stack build. That is, a lot of the time I want to poke around in the repl, or at least use the dependencies when I just broke the build. For example, with stack itself, if you put garbage in a module (say, Main.hs for the executable), then:

$ stack ghci
Configuring GHCi with the following packages: stack
GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package stack
    (use -v for more information)
@Fuuzetsu

This comment has been minimized.

Show comment
Hide comment
@Fuuzetsu

Fuuzetsu Jul 24, 2015

Contributor

Yes, test/bench dependencies are another thing that doesn't work out of the box in stack ghci though I can somewhat forgive that seeing as the default is ‘load everything’. Still, it could be smarter.

Contributor

Fuuzetsu commented Jul 24, 2015

Yes, test/bench dependencies are another thing that doesn't work out of the box in stack ghci though I can somewhat forgive that seeing as the default is ‘load everything’. Still, it could be smarter.

@snoyberg snoyberg added this to the GHCi milestone Jul 26, 2015

@duplode

This comment has been minimized.

Show comment
Hide comment
@duplode

duplode Jul 26, 2015

Contributor

That looks like maybe a mixup with the dependencies of the different targets. I.e. criterion should only be required for benchmark targets, and thus wasn't built by stack buildalone.

I met the same issue when trying to use my GitHub fork of zip-conduit as a dependency, like this:

# stack.yaml snippet.
packages:
- '.'
- location:
    git: https://github.com/duplode/zip-conduit
    commit: 1eefc8bd91d5f38b760bce1fb8dd16d6e05a671d
    extra-dep: true

In such a situation one would never be interested in running the benchmarks of zip-conduit, as it is just another dependency. Adding the extra-dep flag didn't help.

Contributor

duplode commented Jul 26, 2015

That looks like maybe a mixup with the dependencies of the different targets. I.e. criterion should only be required for benchmark targets, and thus wasn't built by stack buildalone.

I met the same issue when trying to use my GitHub fork of zip-conduit as a dependency, like this:

# stack.yaml snippet.
packages:
- '.'
- location:
    git: https://github.com/duplode/zip-conduit
    commit: 1eefc8bd91d5f38b760bce1fb8dd16d6e05a671d
    extra-dep: true

In such a situation one would never be interested in running the benchmarks of zip-conduit, as it is just another dependency. Adding the extra-dep flag didn't help.

@duplode

This comment has been minimized.

Show comment
Hide comment
@duplode

duplode Jul 27, 2015

Contributor

Adding the extra-dep flag didn't help.

Never mind my complaint above - the extra-dep field is wrongly indented. Still, my (non-)issue has lead me to wonder whether it would be appropriate to fix this with a treat-as-dep-in-ghci field (ideally with a less clunky name). By the way, the "load everything in GHCi" behaviour is, as implied by Fuuzetsu's comment, by design. See #130 for the rationale.

Contributor

duplode commented Jul 27, 2015

Adding the extra-dep flag didn't help.

Never mind my complaint above - the extra-dep field is wrongly indented. Still, my (non-)issue has lead me to wonder whether it would be appropriate to fix this with a treat-as-dep-in-ghci field (ideally with a less clunky name). By the way, the "load everything in GHCi" behaviour is, as implied by Fuuzetsu's comment, by design. See #130 for the rationale.

@chrisdone

This comment has been minimized.

Show comment
Hide comment
@chrisdone

chrisdone Aug 6, 2015

Member

Continuing test/bench dependencies in #629 with PR #726.

Member

chrisdone commented Aug 6, 2015

Continuing test/bench dependencies in #629 with PR #726.

@chrisdone chrisdone self-assigned this Aug 6, 2015

@chrisdone chrisdone added the type: bug label Aug 6, 2015

@chrisdone

This comment has been minimized.

Show comment
Hide comment
@chrisdone

chrisdone Aug 6, 2015

Member

@Fuuzetsu Do you have a minimal test project I can clone to reproduce and fix?

Member

chrisdone commented Aug 6, 2015

@Fuuzetsu Do you have a minimal test project I can clone to reproduce and fix?

@mitchellwrosen

This comment has been minimized.

Show comment
Hide comment
@mitchellwrosen

mitchellwrosen Aug 9, 2015

Contributor

@chrisdone I can describe how to make one, it's simple:

$ stack new
$ vi new-template.cabal
-- add 'tasty' dependency to new-template-test suite
$ stack build
$ stack ghci
Configuring GHCi with the following packages: new-template
GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package tasty
    (use -v for more information)

Workaround:

$ stack test
$ stack ghci
Contributor

mitchellwrosen commented Aug 9, 2015

@chrisdone I can describe how to make one, it's simple:

$ stack new
$ vi new-template.cabal
-- add 'tasty' dependency to new-template-test suite
$ stack build
$ stack ghci
Configuring GHCi with the following packages: new-template
GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package tasty
    (use -v for more information)

Workaround:

$ stack test
$ stack ghci
@chrisdone

This comment has been minimized.

Show comment
Hide comment
@chrisdone

chrisdone Aug 9, 2015

Member

I think @mitchellwrosen your problem differs to that of @Fuuzetsu.

Member

chrisdone commented Aug 9, 2015

I think @mitchellwrosen your problem differs to that of @Fuuzetsu.

@Fuuzetsu

This comment has been minimized.

Show comment
Hide comment
@Fuuzetsu

Fuuzetsu Aug 9, 2015

Contributor

Yes, it does. I'm a bit constrained on time right now but maybe I can produce something soon, sorry for delays.

Contributor

Fuuzetsu commented Aug 9, 2015

Yes, it does. I'm a bit constrained on time right now but maybe I can produce something soon, sorry for delays.

@mitchellwrosen

This comment has been minimized.

Show comment
Hide comment
@mitchellwrosen

mitchellwrosen Aug 9, 2015

Contributor

Oops, I was looking at @rrnewton's comment. Sorry!

Contributor

mitchellwrosen commented Aug 9, 2015

Oops, I was looking at @rrnewton's comment. Sorry!

@rpglover64

This comment has been minimized.

Show comment
Hide comment
@rpglover64

rpglover64 Aug 18, 2015

I think I'm having this same issue... to reproduce:

git clone https://github.com/Gabriel439/Haskell-Turtle-Library.git
cd Haskell-Turtle-Library
git checkout da98f7e
stack init
stack build
stack ghci

Expected behavior: ghci is launched with the project loaded
Actual behavior:

Configuring GHCi with the following packages: turtle
GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package criterion-1.1.0.0
    (use -v for more information)

rpglover64 commented Aug 18, 2015

I think I'm having this same issue... to reproduce:

git clone https://github.com/Gabriel439/Haskell-Turtle-Library.git
cd Haskell-Turtle-Library
git checkout da98f7e
stack init
stack build
stack ghci

Expected behavior: ghci is launched with the project loaded
Actual behavior:

Configuring GHCi with the following packages: turtle
GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package criterion-1.1.0.0
    (use -v for more information)
@chrisdone

This comment has been minimized.

Show comment
Hide comment
@chrisdone

chrisdone Aug 18, 2015

Member

@rpglover64 Are you on a recent stack?

Member

chrisdone commented Aug 18, 2015

@rpglover64 Are you on a recent stack?

@rpglover64

This comment has been minimized.

Show comment
Hide comment
@rpglover64

rpglover64 Aug 18, 2015

Version 0.1.3.0, Git revision 385332d

rpglover64 commented Aug 18, 2015

Version 0.1.3.0, Git revision 385332d

@chrisdone

This comment has been minimized.

Show comment
Hide comment
@chrisdone

chrisdone Aug 18, 2015

Member

Your problem's been fixed since then, try latest master. :-)

Member

chrisdone commented Aug 18, 2015

Your problem's been fixed since then, try latest master. :-)

@rpglover64

This comment has been minimized.

Show comment
Hide comment
@rpglover64

rpglover64 Aug 18, 2015

I'm almost annoyed at how fast stack is moving... On the other hand, my issues are getting fixed. 😃

Thanks.

rpglover64 commented Aug 18, 2015

I'm almost annoyed at how fast stack is moving... On the other hand, my issues are getting fixed. 😃

Thanks.

@ezyang

This comment has been minimized.

Show comment
Hide comment
@ezyang

ezyang Sep 2, 2015

Hi guys, I've opened a GHC ticket to track this issue. https://ghc.haskell.org/trac/ghc/ticket/10827

ezyang commented Sep 2, 2015

Hi guys, I've opened a GHC ticket to track this issue. https://ghc.haskell.org/trac/ghc/ticket/10827

@chrisdone

This comment has been minimized.

Show comment
Hide comment
@chrisdone

chrisdone Sep 2, 2015

Member

Thanks @ezyang!

Member

chrisdone commented Sep 2, 2015

Thanks @ezyang!

@borsboom borsboom modified the milestone: GHCi Sep 12, 2015

@borsboom borsboom added the blocked label Sep 12, 2015

@borsboom borsboom added this to the P2 milestone Sep 12, 2015

@mgsloan

This comment has been minimized.

Show comment
Hide comment
@mgsloan

mgsloan Nov 5, 2015

Collaborator

I'm going to close this issue, since it's old and the GHCi support has had lots of improvements since then. Feel free to open additional issues with concrete cases of the GHCI support being problematic.

Also, I've added some warnings which hopefully will make it clearer why things don't work, at least in the presence of extension flags: #1270

Collaborator

mgsloan commented Nov 5, 2015

I'm going to close this issue, since it's old and the GHCi support has had lots of improvements since then. Feel free to open additional issues with concrete cases of the GHCI support being problematic.

Also, I've added some warnings which hopefully will make it clearer why things don't work, at least in the presence of extension flags: #1270

@mgsloan mgsloan closed this Nov 5, 2015

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