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

"inappropriate type (not a ghc-pkg db file)" #42

Closed
thomasjm opened this issue Aug 6, 2015 · 3 comments
Closed

"inappropriate type (not a ghc-pkg db file)" #42

thomasjm opened this issue Aug 6, 2015 · 3 comments

Comments

@thomasjm
Copy link

thomasjm commented Aug 6, 2015

I run stack ide start in my project and I get the following error:

{"tag":"ResponseWelcome","contents":[0,1,1]}
{"tag":"ResponseUpdateSession","contents":{"tag":"UpdateStatusCrashRestart","contents":"External exception: /Users/tomm/.stack/snapshots/x86_64-osx/lts-2.16/7.8.4/pkgdb/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (not a ghc-pkg db file, wrong file magic number). Local exception: user error (IdeSession.RPC.Stream ended, causing demandInput: not enough bytes)"}}
@mgsloan
Copy link
Contributor

mgsloan commented Aug 6, 2015

My guess is that the ide-backend-server on your path is using a newer version of GHC. ResponseWelcome really ought to give more info about GHC versions and such. I've created this issue to track that: #43

stack ide does not yet streamline making sure that the right version of ide-backend-server is used, and does not yet automate its installation. So for now, that part of things is manual. Relevant stack issue: commercialhaskell/stack#662

If I'm right about the cause, there are two approaches to resolve this:

  • Run stack --stack-yaml=stack-7.8.yaml install in the ide-backend or stack-ide repo. This will install a version that uses ghc 7.8.
  • Run stack install in the ide-backend or stack-ide repo. Update your project to use a very recent nightly resolver (such as nightly-2015-08-06), so that you're using ghc-7.10.2 for your project.

(NOTE: you'll also want to pull both of these repos, I updated all the stack.yaml resolvers a few minutes ago)

@thomasjm
Copy link
Author

thomasjm commented Aug 6, 2015

You're right about that, ide-backend-server was installed with GHC 7.10 but my project uses GHC 7.8. I upgraded my project to use 7.10 as well and it worked. Thanks!

@thomasjm thomasjm closed this as completed Aug 6, 2015
@erikkaplun
Copy link

How about if I need the project to use GHC 7.8.x? I also have another project that needs GHC 7.10.x.

So is there currently no way to use stack-ide on projects with different GHC versions?

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

3 participants