Haskell executables dynamic vs static linking
petersen at redhat.com
Fri Feb 28 01:36:38 UTC 2014
Thanks for your reply.
> There's something in the Fedora packaging guidelines about not packaging
> static libraries.
There is also something about it being ok for Haskell packages
in the Haskell Packaging Guidelines we made. :)
Current ghc stable releases only support Linux shared libs on ia32 arch's.
ie all Haskell executables on other archs are statically linked to Haskell libs anyway.
I believe ocaml also links its executables statically to ocaml libs.
I don't think we can drop Haskell static libraries any time soon,
but for ghc-7.8 (Fedora 21) I am thinking to subpackage them
since ghc-pkg no longer screams about missing static libs.
(ghc-7.8 uses dynmically linking internally by default though
which somewhat complicates its use of non-exported libs.)
> I don't know how well it would work to link with Haskell libraries statically
> and others dynamically -- I'm not even sure how to tell ghc to do that.
It works just fine - it is what ghc does by default and has been doing forever. :)
To link dynamically you have to give the -dynamic option to ghc.
As I wrote, afaik other distros do not distribute dynamically linked Hasklell executables.
Anyway my question was more about providing both for some packages in an optimal way.
$ cat > Main.hs
main = putStrLn "hi"
$ ghc Main
$ ldd Main | grep libHS
$ ghc Main -dynamic
$ ldd Main | grep libHS | wc -l
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the haskell