[Haskell-cafe] Re: Cabal and linking with static libs (.a files)
Simon Marlow
simonmarhaskell at gmail.com
Tue Jun 13 06:24:55 EDT 2006
Ketil Malde wrote:
> Now you see it, now you don't. :-/
>
> * .a files in /local/lib/foo-0.0/ghc-xxxx/ -- check
> * .a files named libfoo.a -- check
> * -lfoo on the command line -- check
>
> Using strace shows that the .a file is indeed being read by ghc, but I
> still get "undefined reference".
No idea, I'm afraid. ghc -v might help you. Try cut-and-pasting the
linker command line and play around with ordering of -l options.
As a matter of style, rather than using -lfoo on the command line you
should use the extra-libraries field in the .cabal file.
> Apologies for being dense, but I can't seem to make it work at all.
> Is there a cabalized library that does this (links to a .a type C
> library) that I can look at?
Some of the standard packages do this, eg.
http://darcs.haskell.org/package/network comes with a small amount of C
code. GHC doesn't currently use Cabal to build this, though. I'm sure
there are other Cabal packages out there that link to .a libraries, it's
quite a common thing to do.
Cheers,
Simon
More information about the Haskell-Cafe
mailing list