[Haskell-cafe] Partial statical linking
Edward Z. Yang
ezyang at MIT.EDU
Thu Dec 1 09:08:21 CET 2011
libgmp and libffi are external libraries not associated with
Haskell, so I don't think -static (which is for Haskell libraries)
applies to them. You'll have the same problem with any other
sort of library of this type, like libdl and friends ;-)
Edward
Excerpts from Jason Dusek's message of Sat Nov 26 01:59:18 -0500 2011:
> Some time ago, I wrote to this list about making shared
> libraries with GHC, in such a way that the RTS was linked and
> ready to go. Recently, I've been looking a similar but, in a
> sense, opposite problem: linking Haskell executables with some
> of their non-Haskell dependencies, for distribution.
>
> I tried passing a few different sets of options to the linker
> through GHC, with -optl:
>
> -optl'-Wl,-r'
> -optl'-Wl,-r,-dy'
> -optl'-Wl,-static,-lffi,-lgmp,-dy'
>
> None of these had the desired effect. In the end, running GHC
> with -v and carefully editing the linker line produced the
> desired change (I have linked to and provided the diff below).
>
> The effect -optl seems to be to introduce options in the linker
> line just before -lHSrtsmain, which would seem to prevent one
> from linking libffi and libgmp differently. Is editing and
> storing away the linker script the best option at present for
> partially static linking?
>
> --
> Jason Dusek
> () ascii ribbon campaign - against html e-mail
> /\ www.asciiribbon.org - against proprietary attachments
>
>
>
>
> https://github.com/solidsnack/arx/commit/90ec5efdb0e991344aa9a4ad29456d466e022c3e
> #@@ -122,10 +122,8 @@
> # -lHSarray-0.3.0.2 \
> # -lHSbase-4.3.1.0 \
> # -lHSinteger-gmp-0.2.0.3 \
> #- -lgmp \
> # -lHSghc-prim-0.2.0.0 \
> # -lHSrts \
> #- -lffi \
> # -lm \
> # -lrt \
> # -ldl \
> #@@ -136,4 +134,7 @@
> # -lgcc_s --no-as-needed \
> # /usr/lib/gcc/x86_64-linux-gnu/4.6.1/crtend.o \
> # /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/crtn.o \
> #+ -static \
> #+ -lgmp \
> #+ -lffi \
>
More information about the Haskell-Cafe
mailing list