goldfirere / ghc

Mirror of ghc repository. DO NOT SUBMIT PULL REQUESTS HERE
http://www.haskell.org/ghc/
Other
25 stars 1 forks source link

Bad interface file #59

Closed vladfi1 closed 8 years ago

vladfi1 commented 8 years ago

Not sure if I'm doing some cabal stuff wrong, but many packages fail to install with errors such as:

Data/Vector/Generic/Mutable/Base.hs:18:1: error:
    Bad interface file: /home/vlad/.cabal/lib/x86_64-linux-ghc-7.11.20151105/primitive-0.6.1.0-8Jz4K59dPOf6o0RskSAcsI/Control/Monad/Primitive.hi
        Something is amiss; requested module  primitive-0.6.1.0@primitive-0.6.1.0-6e2bf8a246570709ff94b3431f90c219:Control.Monad.Primitive differs from name found in the interface file primi_8Jz4K59dPOf6o0RskSAcsI:Control.Monad.Primitive
Failed to install vector-0.11.0.0
goldfirere commented 8 years ago

I can't be sure, but my guess is that something is amiss locally on your machine. Recent updates to this branch have changed the interface file format. I recommend doing a make maintainer-clean and then building again from scratch. This will also wipe your package database, but that's a good thing in this case. If my hunch is right, could you close this ticket once you have it working locally? Thanks!

vladfi1 commented 8 years ago

That did not work. After installing should I be using cabal any differently than I normally do? As far as I can tell all packages are separated by ghc version...

goldfirere commented 8 years ago

Can you give me steps to reproduce? I use cabal install --with-ghc=<full path, from /, to my built ghc-stage2>

vladfi1 commented 8 years ago
  1. Build following the instructions in the readme.
  2. make install - on my machine this puts ghc in /usr/local/bin which is on my PATH.
  3. cabal install vector
vladfi1 commented 8 years ago

Also, do you have a better way of updating the git submodules than switching the git remote url each time? Possibly related: I notice that one of these submodules is actually vector (edit: and primititive). Could this be conflicting with the cabal installation of vector?

brprice commented 8 years ago

I'm also having this issue (or something very similar), and now it affects vanilla HEAD also. As mentioned in the thread starting https://mail.haskell.org/pipermail/ghc-devs/2015-November/010584.html , using cabal HEAD makes the issue go away. (I don't know what the underlying problem is though.)

vladfi1 commented 8 years ago

Using cabal HEAD did not fix it for me.

goldfirere commented 8 years ago

I've not tried yet to fix this, but I am surprised by this bug. Then I saw this float by, from Simon Marlow, when Simon PJ hit this same problem:

You probably have .hi files generated by a previous version of HEAD installed under your ~/.cabal/lib, and the current HEAD chokes on them. Try rm -rf ~/.cabal/lib/*ghc-7.11*

Does that fix it for you?

vladfi1 commented 8 years ago

After doing that I get errors such as:

Could not find module ‘Control.Monad.Primitive’
There are files missing in the ‘primitive-0.6.1.0@primitive-0.6.1.0-925bc530f2c1182d9da7d86b705f8e46’ package,
try running 'ghc-pkg check'.

ghc-pkg check tells me that

There are problems in package primitive-0.6.1.0:
  Warning: library-dirs: /home/vlad/.cabal/lib/x86_64-linux-ghc-7.11.20151121/primitive-0.6.1.0-FXpuG5lSLDa5olfPk5aI7f doesn't exist or isn't a directory

...

The following packages are broken, either because they have a problem
listed above, or because they depend on a broken package.
primitive-0.6.1.0
th-lift-0.7.5
safe-0.3.9
mtl-2.2.1
syb-0.6
goldfirere commented 8 years ago

What if you ghc-pkg unregister each of those packages and then rebuild your package library from scratch? The comment above that someone ran into this problem in HEAD makes me strongly suspect that the problem is local somehow. (Not saying that GHC couldn't improve in this respect, but that it's all exacerbated by some local setup.)

int-index commented 8 years ago

I've encountered a similar problem today and solved it by switching to cabal HEAD.

vladfi1 commented 8 years ago

Removed .cabal/lib/ghc-7.11*, ghc-pkg unregistered primitive, cabal installed vector using cabal head, and for some reason this time around it just worked.