Dynamic only GHC

Austin Seipp austin at well-typed.com
Mon Oct 20 14:21:48 UTC 2014

As far as I'm aware, Dynamic-by-default GHC is actually broken, and I
don't know for how long this has been the case.

For some history: originally when all this was being decided to try
and fix the linker issues in GHC, dynamic by default was considered an
option, but was rejected in favor of DynamicGhcPrograms. Why was it
rejected? Well, dynamic by default particularly hurts 32bit x86, which
suffers from a very pathetic set of registers, and dynamic programs
steal one of these for the GOT (%ebx IIRC).

On the other hand, DynamicGhcPrograms instead means GHC builds
everything statically, *except itself*, which it builds as a
dynamically linked executable. The idea is you dynamically link GHC
itself to fix linker issues, and end-user programs remain static,
which is the expected mode of operation.

In all honesty, we should probably remove any traces of
DYNAMIC_BY_DEFAULT unless someone is actively interested in it, since
it's bitrotten at this point.

On Mon, Oct 20, 2014 at 7:53 AM, Jeremy <voldermort at hotmail.com> wrote:
> I'm trying to build a minimal GHC 7.8.3 on Debian Wheezy with only dynamic
> libraries (this is for a system where disc space is scarce). I'm using this
> build.mk:
> GhcRTSWays = thr
> GhcLibWays = dyn
> GhcDynamic = YES
> Tried with and without GhcDynamic (asked on beginners how it's different to
> DYNAMIC_GHC_PROGRAMS but still waiting for an answer). It gets near the end
> of the build, then fails with:
>   HC [stage 1] ghc/stage2/build/Main.dyn_o
>   HC [stage 1] ghc/stage2/build/tmp/ghc-stage2
> /usr/bin/ld: cannot find -lHSrts_thr-ghc7.8.3
> collect2: error: ld returned 1 exit status
> make[1]: *** [ghc/stage2/build/tmp/ghc-stage2] Error 1
> make: *** [all] Error 2
> If I build with only static libraries, everything seems to work OK.
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Austin Seipp, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/

More information about the Glasgow-haskell-users mailing list