Haskell executables dynamic vs static linking

Jens Petersen 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... 
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. 

Jens 

$ cat > Main.hs 
main = putStrLn "hi" 
$ ghc Main 
: 
$ ldd Main | grep libHS 
$ ghc Main -dynamic 
: 
$ ldd Main | grep libHS | wc -l 
4 
$ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.fedoraproject.org/pipermail/haskell/attachments/20140227/7bc3517d/attachment.html>


More information about the haskell mailing list