[Haskell-cafe] Using GHC option '-optl-static' causes segfault

Niklas Hambüchen mail at nh2.me
Tue Mar 10 09:21:33 UTC 2020


Hi,

> It seems that it something has to do with glibc. What can I do with this problem?

that's right, you cannot statically link against glibc, especially not networking code, without getting crashes.

Your specific issue is described on: https://github.com/nh2/static-haskell-nix/issues/17

Check out

    https://github.com/nh2/static-haskell-nix/#static-haskell-nix

for the background and more information of how you can link statically correctly.

Your current 2 choices are this (static-haskell-nix), and building in an Alpine docker container.

* Stack+Docker is conceptually easier, but makes you dependent on good support for the Haskell ecosystem in Alpine, which sometimes breaks (and it is only partially under our control to fix it).
* static-haskell-nix requires you to learn some nix, but allows you to override any (system) package so you have control to fix things in case things do not work (for example, if some system package is compiled without .a files you need for static linking).

Finally, don't hesitate to ask me anything about it; I have spent multiple hundreds of hours on statically linking Haskell :)

Niklas


More information about the Haskell-Cafe mailing list