commercialhaskell / stack-ide

Stack-based JSON interface to ide-backend
98 stars 23 forks source link

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

Closed thomasjm closed 9 years ago

thomasjm commented 9 years ago

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 commented 9 years ago

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: https://github.com/commercialhaskell/stack/issues/662

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

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

thomasjm commented 9 years ago

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!

erikkaplun commented 9 years ago

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?