[Haskell-cafe] Re: ghc error: requested module name differs from name found in interface file

Larry Evans cppljevans at suddenlink.net
Tue Oct 21 10:41:29 EDT 2008

On 10/21/08 07:35, Bertram Felgenhauer wrote:
> Larry Evans wrote:
>> On 10/20/08 12:33, Larry Evans wrote:
>>> With a file containing:
>>>  > module Main where
>>>  >
>>>  > import Array
>>>  > import Control.Functor.Fix
>>> I get:
>>>  > make
>>>  > ghc -i/root/.cabal/lib/category-extras-0.53.5/ghc-6.8.2 -c 
>>> catamorphism.example.hs
> Yes, using -i to give paths to installed packages does not work - you
> really have to tell ghc about the corresponding package.conf file,
> using -package-conf file. See also
>   http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html#package-databases
>>>  > catamorphism.example.hs:19:0:
>>>  >     Bad interface file: 
>>> /root/.cabal/lib/category-extras-0.53.5/ghc-6.8.2/Control/Functor/Fix.hi
>>>  >         Something is amiss; requested module main:Control.Functor.Fix 
>>> differs from name found in the interface file 
>>> category-extras-0.53.5:Control.Functor.Fix
>>>  > make: *** [all] Error 1
> The problem is that all modules found by -i are expected to be in the
> current package - which is 'main' by default. (Build tools like Cabal
> specify a different package name for libraries; for example the
> Control.Functor.Fix is in the 'category-extras-0.53.5' package here.)
>> So, I've got to figure how to tell cabal install to install in right
>> place :(
> Have you tried 'cabal install --global'? To make it stick, put
> 'user-install: False' in root's .cabal/config file.
> HTH,
> Bertram


I finally understand what happened.  To manually install cabal-install,
I had to change to root.  I just assumed I had to stay as root to
install category-extras.  Since the default for |cabal install| was
--user, it put the files in /root/.cabal.  I just did
|cabal install category-extras| as myself and now:
<---cut here ---
module Main where

import Data.Generics.Biplate
import Control.Functor.Fix

main = do
   putStr "hello world\n"
 >---cut here---
compiles without error.  Just that one little piece of information,
that |cabal install| , by default, installs in ~/.cabal and
then enables ghc to look there for packages, would have saved
an awful lot of time :(


More information about the Haskell-Cafe mailing list