The -static option of ghc,
and choice between user-supplied library types (Unix)
Bjorn Bringert
bringert at cs.chalmers.se
Thu Jan 12 05:28:41 EST 2006
Dimitry Golubovsky wrote:
> The Paragraph 4.10.7 of the GHC users guide contains this:
>
> -static
> Tell the linker to avoid shared Haskell libraries, if possible. This
> is the default.
>
> -dynamic
> Tell the linker to use shared Haskell libraries, if available (this
> option is only supported on Mac OS X at the moment, and also note that
> your distribution of GHC may not have been supplied with shared
> libraries).
>
> As I understand, this is related to the GHC own libraries. What about
> user-supplied libraries (listed in the `extra-libraries' field of a
> Cabal package description) e. g.:
>
> extra-libraries: gd, jpeg, m
>
> from http://www.cs.chalmers.se/~bringert/darcs/haskell-gd/gd.cabal
>
> There are usually files like libm.a and libm.so together in the same
> directory where GHC looks for libraries.
>
> Does the -static / -dynamic ghc flag affect the choice which library
> to link against?Or, to control this, one has to descend to the linker
> options, and the default would be the linker default?
It seems that in order to get static linking to non-Haskell libraries,
you need to, as you suggest, tell the linker about it. I use "-static
-optl-static", which seems to work.
> ...
/Björn
More information about the Glasgow-haskell-users
mailing list