Linking completely statically

Thomas DuBuisson thomas.dubuisson at gmail.com
Tue Aug 11 15:38:20 UTC 2020


I was able to get static linking working recently using docker alpine
images and ghcup to install GHC based on the musl library.  The details are
in my Stan fork [1].  This borrowed heavily from ShellCheck's static
linking release system except it uses cabal v2-build instead of v1.


[1]
Script:
https://github.com/TomMD/stan/blob/feature/basic-json-output/mkRelease.sh
Dockerfile:
https://github.com/TomMD/stan/blob/feature/basic-json-output/Dockerfile

On Sun, Aug 9, 2020 at 5:51 AM Volker Wysk <post at volker-wysk.de> wrote:

> Hi!
>
> I know of the command line argument "-static". But this only affects
> the Haskell libraries. I want to link some programs completely
> statically, no external libraries needed.
>
> When just linking with "-static" I still have those dynamically linked
> things:
>
> desktop ~/bin $ ldd sicherung
>         linux-vdso.so.1 (0x00007ffdab53f000)
>         libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6
> (0x00007f3633da0000)
>         librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1
> (0x00007f3633d95000)
>         libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1
> (0x00007f3633d90000)
>         libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
> (0x00007f3633d8a000)
>         libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
> (0x00007f3633d67000)
>         libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10
> (0x00007f3633ce3000)
>         libatomic.so.1 => /lib/x86_64-linux-gnu/libatomic.so.1
> (0x00007f3633cd7000)
>         libffi.so.7 => /lib/x86_64-linux-gnu/libffi.so.7
> (0x00007f3633ccb000)
>         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
> (0x00007f3633ad9000)
>         /lib64/ld-linux-x86-64.so.2 (0x00007f3633f0c000)
>
>
> Is it possible to link the remaining libraries statically too?
>
> Regards,
> Volker
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20200811/fc51d4de/attachment.html>


More information about the Glasgow-haskell-users mailing list