meaing of Cabal's extra-libraries field

Hello, 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. 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 Bar.so/.dll/.dylib file:
ghci -package LibraryFoo Loading package LibraryFoo-0.1 ... <command line>: can't load .so/.DLL for: Bar (dlopen(Bar.dylib, 10): image not found)
What I want to do is statically link LibraryFoo against Bar before Cabal installs the package, (so that, for instance, I can run ghci without a bunch of command line linking arguments and don't need to have Bar around anymore), and I have a Bar.o file for just such a purpose. Is there a way to get Cabal to do this? Thanks for your help, Ryan Wisnesky

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 Bar.so/.dll/.dylib file:
Right.
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: http://hackage.haskell.org/trac/hackage/ If it's really important, there are people you can pay to get stuff done. Duncan
participants (2)
-
Duncan Coutts
-
Ryan Wisnesky