ghc error: requested module name differs from name found in interface file

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
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 I used cabal to install category-extras:
/home/evansl/download/haskell/libs # cabal install category-extras Resolving dependencies... Downloading category-extras-0.53.5... Configuring category-extras-0.53.5... Preprocessing library category-extras-0.53.5... ... /usr/bin/ar: creating dist/build/libHScategory-extras-0.53.5.a Installing library in /root/.cabal/lib/category-extras-0.53.5/ghc-6.8.2 Registering category-extras-0.53.5... Reading package info from "dist/installed-pkg-config" ... done. Saving old package config file... done. Writing new package config file... done. /home/evansl/download/haskell/libs # What should I do to import the Functor.Fix as shown here:
http://comonad.com/reader/2008/recursion-schemes/ TIA. -Larry

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
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 I used cabal to install category-extras:
/home/evansl/download/haskell/libs # cabal install category-extras Resolving dependencies... Downloading category-extras-0.53.5... Configuring category-extras-0.53.5... Preprocessing library category-extras-0.53.5... ... /usr/bin/ar: creating dist/build/libHScategory-extras-0.53.5.a Installing library in /root/.cabal/lib/category-extras-0.53.5/ghc-6.8.2 [snip] The problem must be where the library was installed. A manual install:
http://www.haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package of http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uniplate followed by compile of: <--- cut here --- module Main where import Data.Generics.Biplate main = do putStr "hello world\n"
--- cut here --- showed no errors: <--- cut here --- make ghc -C import.test.hs
Compilation finished at Mon Oct 20 18:47:54
--- cut here ---
The key difference is the manual installed as: <--- cut here --- /home/evansl/download/haskell/libs/uniplate-1.2.0.1 # runhaskell Setup install Installing library in /usr/local/lib/uniplate-1.2.0.1/ghc-6.8.2 Registering uniplate-1.2.0.1... Reading package info from "dist/installed-pkg-config" ... done. Saving old package config file... done. Writing new package config file... done. /home/evansl/download/haskell/libs/uniplate-1.2.0.1 #
--- cut here --- whereas the cabal install of category-extras installed the library here: <--- cut here --- /root/.cabal/lib/category-extras-0.53.5/ghc-6.8.2: total used in directory 2812 available 148773984 drwxr-xr-x 4 root root 4096 Oct 19 15:09 . drwxr-xr-x 3 root root 4096 Oct 19 15:09 .. drwxr-xr-x 9 root root 4096 Oct 19 15:09 Control drwxr-xr-x 2 root root 4096 Oct 19 15:09 Data -rw-r--r-- 1 root root 1120345 Oct 19 15:09 HScategory-extras-0.53.5.o -rw-r--r-- 1 root root 1728590 Oct 19 15:09 libHScategory-extras-0.53.5.a --- cut here ---
So, I've got to figure how to tell cabal install to install in right place :(

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#packag...
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

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#packag...
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
---cut here--- compiles without error. Just that one little piece of information,
THANK YOU! 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" 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 :( -regards, Larry

On Tue, 2008-10-21 at 09:41 -0500, Larry Evans wrote:
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 :(
Where would you like that information to have been presented? Perhaps something the first time you used the cabal command to say what configuration it was using? Duncan

On 10/21/08 17:55, Duncan Coutts wrote:
On Tue, 2008-10-21 at 09:41 -0500, Larry Evans wrote:
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 :(
Where would you like that information to have been presented? Perhaps something the first time you used the cabal command to say what configuration it was using?
Duncan
I'd suggest putting this information after the brief description of the install option here: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall For example: Commands: install Installs a list of packages. The 'visibility' of the install depends on whether --user or --global FLAG is used. With --user, the package is only visible to the user invoking the cabal command. With --global, the package is visible to all users; however, this requires root authority. list List available packages on the server (cached). ... I'm at fault for not reading: For more information about a command, try 'cabal COMMAND --help'. lower down on that page. I do remember actually doing cabal install --help but I can't remember if that was after or before Bertrand's post. However, even that command's description of the meaning of --user and --global is obscured by so many other options, that it's easy to miss. Also their descriptions: --user Enable doing a per-user installation --global Disable doing a per-user installation doesn't explain what 'per-user installation' means. If it just said: A per-user installation means the installed package is only seen by the haskell compiler if the compiler is invoked by the same user which issued the 'cabal install' command. That would have clearly indicated to me that the root doing 'cabal install' would not make the installed package available to any other user. (I probably should have figured this out by noting the location was /root/.cabal/...; however, that just didn't happen.) HTH and thanks for your interest. -regards, Larry

On 10/21/08 18:55, Larry Evans wrote:
On 10/21/08 17:55, Duncan Coutts wrote:
On Tue, 2008-10-21 at 09:41 -0500, Larry Evans wrote:
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 :(
Where would you like that information to have been presented? Perhaps something the first time you used the cabal command to say what configuration it was using?
Duncan
I'd suggest putting this information after the brief description of the install option here:
http://hackage.haskell.org/trac/hackage/wiki/CabalInstall [snip]
I'm pretty sure another reason why I had difficulty was that I followed the instructions here: http://www.haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package to install cabal itself. Those instructions install globally. I just assumed that |cabal install| would do the same. Maybe if the default install destinations for both manual and |cabal install| were the same, I wouldn't have had this problem. Although I see lower down on that CabalInstall page there's instructions for a user install, I didn't bother to read that far since I was only interested in just getting the package to install ASAP. HTH. -Larry
participants (3)
-
Bertram Felgenhauer
-
Duncan Coutts
-
Larry Evans