Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ghc can't find my cabal installed packages

Tags:

haskell

cabal

I've installed ghc 6.12.3, and then the Haskell Platform. I'm trying to compile a test program:

$ ghc test.hs
test.hs:3:0:
    Failed to load interface for `Bindings':
      Use -v to see a list of the files searched for.

so, naturally, I do

cabal install Bindings

Which works fine, and places the package in ~/.cabal/lib/bindings-0.1.2 The problem is, that when I go to compile again with ghc, it still doesn't find the package I've installed with cabal. compiling in verbose mode gives:

ghc -v test.hs
Using binary package database: /home/ludflu/ghc/lib/ghc-6.12.3/package.conf.d/package.cache
Using binary package database: /home/ludflu/.ghc/x86_64-linux 6.12.3/package.conf.d/package.cache

As suggested by another stackoverflow user, I tried:

ghc-pkg describe rts > rts.pkg
vi rts.pkg                      # add the /home/ludflu/.cabal/lib to `library-dirs` field
ghc-pkg update rts.pkg

But to no avail. How to I add the .cabal to the list of package directories to search? Thank you!

like image 722
nont Avatar asked Jan 09 '11 20:01

nont


1 Answers

You can check which packages are installed with ghc-pkg list. It may be that you need to either specify the packages to ghc with -package <pkgname> or I believe adding --make to will trigger a chasing down of dependencies, including packages.

Edit: the bindings package is obsolete indeed, see the hackage page. This isn't a package management problem, the only module available is Bindings.Deprecated, which you are perfectly able to load, even though it is an empty module. I believe the relevant parts have been broken out into bindings-<module>, so if you want the bindings functionality you should look to those packages.

like image 157
ScottWest Avatar answered Oct 22 '22 07:10

ScottWest