meaing of Cabal's extra-libraries field

Duncan Coutts duncan.coutts at
Tue Sep 15 15:49:53 EDT 2009

On Tue, 2009-09-15 at 13:13 -0400, Ryan Wisnesky wrote:

> I have a probably very dumb question about how to use Cabal - I'm just  
> starting out with it.  If this list isn't the right place to post the  
> question, please let me know.

This list is fine. For Cabal development discussions we use the cabal-devel list.

> It seems like when I add an Extra-libraries field to a cabal source  
> package description:
> Name: LibraryFoo
> ...
> Library
>   Extra-libraries:  Bar
> this has the effect that when loading package LibraryFoo in ghci, ghci  
> will necessarily try to open a corresponding file:


> What I want to do is statically link LibraryFoo against Bar before  
> Cabal installs the package, 

Cabal's "Simple" build system does not currently provide any mechanism
for adding arbitrary .o files into the static archive and similarly no
way to link one static archive with another. The only builtin mechanism
is to compile C code (specified by the "c-sources" field) and that gets
included into the same static archive as the Haskell library.

In principle it should be possible to hack in extra stuff by writing
code in the Setup.hs script. I don't claim it'd be easy however.

If you'd like to file a feature request then the bug tracker is here:

If it's really important, there are people you can pay to get stuff


More information about the Libraries mailing list