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

Strange package.cache issue with GHC 7.10.1 #50

Open
mgsloan opened this issue Mar 30, 2015 · 3 comments
Open

Strange package.cache issue with GHC 7.10.1 #50

mgsloan opened this issue Mar 30, 2015 · 3 comments

Comments

@mgsloan
Copy link

mgsloan commented Mar 30, 2015

It seems others have successfully used GHC 7.10 with hsenv, so I'm not sure what's going on here. Using hsenv-0.5 and the Linux (x86_64) tarball:

mgsloan@computer:~/fpco/ghc-7.10-sandbox$ hsenv --ghc=../ghc-7.10.1.tar.xz 
Creating Virtual Haskell directory structure
Installing GHC
  Installing GHC from ../ghc-7.10.1.tar.xz
Initializing GHC Package database at /home/mgsloan/fpco/ghc-7.10-sandbox/.hsenv/ghc_pkg_db
Copying necessary packages from original GHC package database
  Using user-wide (~/.cabal/packages) Hackage download cache directory
Installing cabal config at /home/mgsloan/fpco/ghc-7.10-sandbox/.hsenv/cabal/config
Installing activate script
Installing cabal wrapper using /home/mgsloan/fpco/ghc-7.10-sandbox/.hsenv/cabal/config at /home/mgsloan/fpco/ghc-7.10-sandbox/.hsenv/bin/cabal
Skipping 'cabal update' step, Hackage download cache already downloaded
  to ~/.cabal/packages/. You can update it manually with 'cabal update'
  (from inside or outside the virtual environment).

To activate the new environment use 'source .hsenv/bin/activate'
mgsloan@computer:~/fpco/ghc-7.10-sandbox$ source .hsenv/bin/activate 
Activating  Virtual Haskell Environment (at /home/mgsloan/fpco/ghc-7.10-sandbox).

Use regular Haskell tools (ghc, ghci, ghc-pkg, cabal) to manage your Haskell environment.

To exit from this virtual environment, enter command 'deactivate_hsenv'.
[hsenv]mgsloan@computer:~/fpco/ghc-7.10-sandbox$ runhaskell Test.hs 
/home/mgsloan/fpco/ghc-7.10-sandbox/.hsenv/ghc_pkg_db/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (not a ghc-pkg db file, wrong file magic number)

Thankfully, I figured out that doing the following resolved the problem:

rm .hsenv/ghc_pkg_db/package.cache
cp .hsenv/ghc/lib/ghc-7.10.1/package.conf.d/package.cache .hsenv/ghc_pkg_db/package.cache
@cosmo0920
Copy link

I've encountered this problem at Mac OS X 10.9.5 with ghcformacosx 7.10.1.
It seems to be a ghc's problem, I think.

I resolved this problem as follows:

$ ~/.hsenv/bin/activate
[hsenv] $ ghc-pkg recache

@tmhedberg
Copy link
Owner

If either of you knows of anything that hsenv can do differently to work around the problem, let me know.

@ppelleti
Copy link

FWIW, I ran into this same issue on both OS X and Ubuntu. On both operating systems, the "ghc-pkg recache" workaround did not help, but mgsloan's workaround with rm and cp fixed the 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

4 participants