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

Using stack ghci outside of any project fails #1304

Closed
sjakobi opened this issue Nov 7, 2015 · 8 comments
Closed

Using stack ghci outside of any project fails #1304

sjakobi opened this issue Nov 7, 2015 · 8 comments

Comments

@sjakobi
Copy link
Member

sjakobi commented Nov 7, 2015

I sometimes use stack ghci to play with packages installed in the default snapshot db.
This used to work with v0.1.6.0 but is no longer possible with the current master.

$ stack ghci
Run from outside a project, using implicit global project config
Using resolver: lts-3.10 from implicit global project's config file: /home/simon/.stack/global/stack.yaml
Error parsing targets: The specified targets matched no packages.
Perhaps you need to run 'stack init'?
Warning: build failed, but optimistically launching GHCi anyway

* * * * * * * *
There are issues with this project which may prevent GHCi from working properly.


To resolve, remove the flag(s) from the cabal file(s) and instead put them at the top of the haskell files.

It isn't yet possible to load multiple packages into GHCi in all cases - see
https://ghc.haskell.org/trac/ghc/ticket/10827
* * * * * * * *

Configuring GHCi with the following packages: 
GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help

<interactive>:1:1:
    Failed to load interface for ‘Prelude’
    It is a member of the hidden package ‘base-4.8.1.0’.

Verbose output:

$ stack ghci --verbose
Version 0.1.7.0, Git revision 3032d66b88855a855d11e52727a85e7b1cfd27d4 (dirty) (2488 commits) x86_64
2015-11-07 12:34:51.078199: [debug] Checking for project config at: /home/simon/stk/stack.yaml @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Config src/Stack/Config.hs:551:9)
2015-11-07 12:34:51.078884: [debug] Checking for project config at: /home/simon/stack.yaml @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Config src/Stack/Config.hs:551:9)
2015-11-07 12:34:51.079324: [debug] Checking for project config at: /home/stack.yaml @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Config src/Stack/Config.hs:551:9)
2015-11-07 12:34:51.079662: [debug] Checking for project config at: /stack.yaml @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Config src/Stack/Config.hs:551:9)
2015-11-07 12:34:51.079972: [debug] No project config file found, using defaults. @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Config src/Stack/Config.hs:578:13)
2015-11-07 12:34:51.083015: [debug] Run process: ldd /home/simon/.local/bin/stack @(stack_1qCQzKMpF5B2dxtC0o3K2h:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-07 12:34:51.112256: [info] Run from outside a project, using implicit global project config @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Config src/Stack/Config.hs:304:13)
2015-11-07 12:34:51.113430: [info] Using resolver: lts-3.10 from implicit global project's config file: /home/simon/.stack/global/stack.yaml @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Config src/Stack/Config.hs:318:32)
2015-11-07 12:34:51.114605: [debug] Trying to decode /home/simon/.stack/build-plan-cache/x86_64-linux/lts-3.10.cache @(stack_1qCQzKMpF5B2dxtC0o3K2h:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:55:5)
2015-11-07 12:34:51.128645: [debug] Success decoding /home/simon/.stack/build-plan-cache/x86_64-linux/lts-3.10.cache @(stack_1qCQzKMpF5B2dxtC0o3K2h:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:64:13)
2015-11-07 12:34:51.129239: [debug] Run process: ghc --info @(stack_1qCQzKMpF5B2dxtC0o3K2h:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-07 12:34:51.197480: [debug] Run process: ghc --numeric-version @(stack_1qCQzKMpF5B2dxtC0o3K2h:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-07 12:34:51.246990: [debug] Run process: ghc-pkg --no-user-package-db field --simple-output Cabal version @(stack_1qCQzKMpF5B2dxtC0o3K2h:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-07 12:34:51.281892: [debug] Run process: ghc-pkg --no-user-package-db list --global @(stack_1qCQzKMpF5B2dxtC0o3K2h:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-07 12:34:51.312089: [debug] Run process: locale -a @(stack_1qCQzKMpF5B2dxtC0o3K2h:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-07 12:34:51.316824: [debug] Checking resolver: lts-3.10 @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Build.Source src/Stack/Build/Source.hs:162:17)
2015-11-07 12:34:51.316998: [debug] Trying to decode /home/simon/.stack/build-plan-cache/x86_64-linux/lts-3.10.cache @(stack_1qCQzKMpF5B2dxtC0o3K2h:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:55:5)
2015-11-07 12:34:51.329745: [debug] Success decoding /home/simon/.stack/build-plan-cache/x86_64-linux/lts-3.10.cache @(stack_1qCQzKMpF5B2dxtC0o3K2h:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:64:13)
2015-11-07 12:34:51.335669: [debug] Checking resolver: lts-3.10 @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Build.Source src/Stack/Build/Source.hs:162:17)
2015-11-07 12:34:51.335945: [debug] Trying to decode /home/simon/.stack/build-plan-cache/x86_64-linux/lts-3.10.cache @(stack_1qCQzKMpF5B2dxtC0o3K2h:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:55:5)
2015-11-07 12:34:51.344521: [debug] Success decoding /home/simon/.stack/build-plan-cache/x86_64-linux/lts-3.10.cache @(stack_1qCQzKMpF5B2dxtC0o3K2h:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:64:13)
2015-11-07 12:34:51.344943: [debug] Trying to decode /home/simon/.stack/indices/Hackage/00-index.cache @(stack_1qCQzKMpF5B2dxtC0o3K2h:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:55:5)
2015-11-07 12:34:51.614585: [debug] Success decoding /home/simon/.stack/indices/Hackage/00-index.cache @(stack_1qCQzKMpF5B2dxtC0o3K2h:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:64:13)
2015-11-07 12:34:51.615082: [debug] Run process: ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(stack_1qCQzKMpF5B2dxtC0o3K2h:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-07 12:34:51.680670: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /home/simon/.stack/snapshots/x86_64-linux/lts-3.10/7.10.2/pkgdb/ dump --expand-pkgroot @(stack_1qCQzKMpF5B2dxtC0o3K2h:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-07 12:34:51.910888: [debug] Run process: ghc-pkg --user --no-user-package-db --package-db /home/simon/.stack/global/.stack-work/install/x86_64-linux/lts-3.10/7.10.2/pkgdb/ dump --expand-pkgroot @(stack_1qCQzKMpF5B2dxtC0o3K2h:System.Process.Read src/System/Process/Read.hs:272:3)
2015-11-07 12:34:51.946032: [debug] Ignoring package lens-tutorial, from (InstalledTo Local,"/home/simon/.stack/global/.stack-work/install/x86_64-linux/lts-3.10/7.10.2/pkgdb/"), due to  it being unknown to the resolver / extra-deps. @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Build.Installed src/Stack/Build/Installed.hs:189:5)
2015-11-07 12:34:51.946781: [debug] Ignoring package bimap, from (InstalledTo Local,"/home/simon/.stack/global/.stack-work/install/x86_64-linux/lts-3.10/7.10.2/pkgdb/"), due to  it being unknown to the resolver / extra-deps. @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Build.Installed src/Stack/Build/Installed.hs:189:5)
2015-11-07 12:34:51.947298: [debug] Checking resolver: lts-3.10 @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Build.Source src/Stack/Build/Source.hs:162:17)
2015-11-07 12:34:51.947714: [debug] Trying to decode /home/simon/.stack/build-plan-cache/x86_64-linux/lts-3.10.cache @(stack_1qCQzKMpF5B2dxtC0o3K2h:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:55:5)
2015-11-07 12:34:51.956228: [debug] Success decoding /home/simon/.stack/build-plan-cache/x86_64-linux/lts-3.10.cache @(stack_1qCQzKMpF5B2dxtC0o3K2h:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:64:13)
2015-11-07 12:34:51.956515: [error] Error parsing targets: The specified targets matched no packages.
Perhaps you need to run 'stack init'? @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:232:21)
2015-11-07 12:34:51.958207: [warn] Warning: build failed, but optimistically launching GHCi anyway @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:233:21)
2015-11-07 12:34:51.958388: [warn]  @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:379:5)
2015-11-07 12:34:51.958562: [warn] * * * * * * * * @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:380:5)
2015-11-07 12:34:51.958724: [warn] There are issues with this project which may prevent GHCi from working properly. @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:334:5)
2015-11-07 12:34:51.958912: [warn]  @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:335:5)
2015-11-07 12:34:51.959045: [warn]  @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:350:5)
2015-11-07 12:34:51.959149: [warn] To resolve, remove the flag(s) from the cabal file(s) and instead put them at the top of the haskell files. @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:351:5)
2015-11-07 12:34:51.959283: [warn]  @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:352:5)
2015-11-07 12:34:51.959448: [warn] It isn't yet possible to load multiple packages into GHCi in all cases - see @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:353:5)
2015-11-07 12:34:51.959755: [warn] https://ghc.haskell.org/trac/ghc/ticket/10827 @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:354:5)
2015-11-07 12:34:51.959828: [warn] * * * * * * * * @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:382:5)
2015-11-07 12:34:51.960065: [warn]  @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:383:5)
2015-11-07 12:34:51.960223: [info] Configuring GHCi with the following packages:  @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Ghci src/Stack/Ghci.hs:94:5)
2015-11-07 12:34:51.960889: [debug] Run process: ghc --interactive -i -odir=/home/simon/.stack/global/.stack-work/odir/ -hidir=/home/simon/.stack/global/.stack-work/odir/ -hide-all-packages -ghci-script=/tmp/ghci-script15294/ghci-script @(stack_1qCQzKMpF5B2dxtC0o3K2h:Stack.Exec src/Stack/Exec.hs:52:5)
GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help

<interactive>:1:1:
    Failed to load interface for ‘Prelude’
    It is a member of the hidden package ‘base-4.8.1.0’.
@mrkkrp
Copy link
Collaborator

mrkkrp commented Nov 7, 2015

I can reproduce this. Perhaps related to #1222.

@rubik
Copy link
Contributor

rubik commented Nov 7, 2015

I cannot reproduce this. My stack version is master from approximately 24 hours ago. So the problem has been introduced later? Does stack upgrade --git store the cloned repository somewhere? I'd like to check out the actual commit at which I built Stack.

@sjakobi
Copy link
Member Author

sjakobi commented Nov 7, 2015

@rubik: What's the output of stack --version?

@rubik
Copy link
Contributor

rubik commented Nov 7, 2015

Ah perfect, I forgot that the commit was in the version. Here it is:

Version 0.1.6.0, Git revision e22271f5ce9afa2cb5be3bad9cafa392c623f85c (2313 commits) x86_64

EDIT: I also forgot that the last build failed, and actually this version is from 25 days ago. I suppose a git bisect would quickly find the offending commit. I would do it myself, but as of now I'm stuck with an old computer which takes ages to compile Stack, so it's really not feasible.

@cocreature
Copy link
Contributor

I encountered this problem yesterday and have actually done a bisect. It's caused by badca16. I hinted at a possible fix in the comments of that commit but I'm not sure if that's the right way to do it so I didn't submit a PR. Also a separate issue is that even with that fix there is a huge wall of text representing error messages which don't make any sense if we're running ghci outside of a project since. I was planning to open a separate issue for that once it's working again.

@sjakobi
Copy link
Member Author

sjakobi commented Nov 7, 2015

@cocreature: Nice analysis! 👍

@mgsloan
Copy link
Contributor

mgsloan commented Nov 8, 2015

I don't think the usage of -hide-all-packages is the thing that changed, as it was being passed to ghc before that commit.

It certainly makes sense to not pass in -hide-all-packages if there aren't any -package* flags being passed in (which there won't be when there aren't any cabal files). I'll give this a try.

@mgsloan
Copy link
Contributor

mgsloan commented Nov 8, 2015

Ahah, it was -hide-all-packages, good call. The difference is that before it was only being passed when there were any local packages.

Sorry for introducing the bug, y'all! At least the fix was easy. Thanks for catching it!

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

5 participants