ghci attempts to link entire package

Bayley, Alistair Alistair_Bayley at
Thu Jan 4 08:22:29 EST 2007

> From: Simon Marlow [mailto:simonmarhaskell at] 
> > Is this a feature or a bug?
> Neither really, just a consequence of the design.

Well, that would make it a feature, then ;-)

> There has been talk of adding support to link .a files which 
> would simplify 
> package management, but I guess it might make linking slower.
> If there's a use case that requires partial linking of a 
> package, then we could 
> consider the lack of partial linking a bug  - can you 
> describe why you need it?

With Takusen, all modules, including the DBMS-specific modules, are
compiled into a single library. At present we have 3 DBMS's: Sqlite,
Oracle, and PostgreSQL. For example, suppose you had just the Oracle
DBMS client libraries installed, and you write a program which only uses
the Oracle modules from Takusen. When you link, the gnu ld program
attempts to resolve the symbols in only the modules that you've used.
You don't need to have PostgreSQL or Sqlite installed, and the linker
ignores these modules from the package archive. This is quite nice,
because we can distribute the entire library as a single package, and it
will work even if the user does not have all of the DBMS client
libraries installed.

In contrast, when ghci (or runhaskell) attempts to link it tries to
resolve all of the symbols in the PostgreSQL and Sqlite modules, and
fails because you don't have them installed.

The result is that a user of Takusen can't easily use the library with
ghci/runhaskell "out of the box", unless they have the full set of DBMS
client libraries installed. There are a couple of workarounds, but
they're both a bit fiddly, so it'd be nicer (from my POV) if the ghci
linker behaved like gnu ld.

Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.

More information about the Glasgow-haskell-users mailing list