Dynamic libraries by default and GHC 7.8

Ian Lynagh ian at well-typed.com
Tue Nov 27 19:02:34 CET 2012


On Tue, Nov 27, 2012 at 12:07:34PM -0500, Stephen Paul Weber wrote:
> Somebody claiming to be Ian Lynagh wrote:
> >On Tue, Nov 27, 2012 at 10:22:12AM -0500, Stephen Paul Weber wrote:
> >>IIRC, one of the problems with dynamic linking in GHC is that when
> >>the GHC version is different, the ABI can often be different enough
> >>to making such shared libraries incompatible with each other /
> >>binaries made on different GHCs.  This makes distribution a
> >>potential nightmare (where you have to package all the *.so files
> >>and send them along with your binary, which is essentially the same
> >>as static linking, but more pain).
> >
> >That is still the case. However, if you want to distribute binaries then
> >you will still be able to build with -static if you don't want to have
> >ot bundle a load of DLLs. It's only the default that will change.
> 
> If the default changes, though, that would mean that before
> distribution I would have to re-build all my cabal packages with
> -static?  And if I change my default so that cabal builds with
> -static GHCI would no longer work for me?

You can configure Cabal to build both static and dynamic libraries
whenever you install anything - but it'll take twice as long.

We actually have half a plan to fix this, so that a single compilation
would build both static and dynamic libraries. Most of the work
(parsing, type checking, optimising) can be shared; it's just the
codegen phase that needs to be different.

The tricky bit is that it only works if all the dependencies have been
compiled for both ways at the same time too. If any dependencies were
built with different options for static and dynamic, or even if there
was just a different random name generated, then things can go wrong.
So we need to work out the details so that nothing breaks.


Thanks
Ian




More information about the Glasgow-haskell-users mailing list