[Haskell-cafe] Re: Compiling packages for GHCi

Simon Marlow simonmarhaskell at gmail.com
Wed Jun 6 07:55:41 EDT 2007


Grzegorz wrote:
> Hi,
> I'm having problems using a package which links in foreign libraries from GHCi.
> 
> I use a .cabal file to build the package and have the following option there:
> 
> extra-libraries:    stdc++ maxent z m gfortran m gcc_s
> 
> 
> After installation, it works fine when I compile code using that package.
> However, when I try it from GHCi I get:
> 
> Loading package binary-0.3 ... linking ... done.
> Loading package filepath-1.0 ... linking ... done.
> Loading package haskell98 ... linking ... done.
> Loading package mtl-1.0.1 ... linking ... done.
> Loading package parsec-2.0 ... linking ... done.
> Loading package gramlab-lib-0.1 ... linking ... done.
> Loading package maxent-0.0 ... can't load .so/.DLL for: maxent (libmaxent.so:
> cannot open shared object file: No such file or directory)
> 
> I don't have a libmaxent.so, the maxent library in at /usr/local/lib/libmaxent.a
> 
> Can I somhow use my package with GHCi?

No, you need the .so.  GHCi can't load static .a libraries.  If you really have 
no way to get a .so, then it is possible to create a .o from the .a that GHCi 
can load using 'ld --whole-archive', but you're into hacker territory there.

Cheers,
	Simon


More information about the Haskell-Cafe mailing list