To clarify -- the goal of this package is to statically link against the Haskell dependencies. The non-Haskell libraries (glibc
, gmp
) could be worked around in theory, but need a musl
-based toolchain to do so. I both haven't managed to make such a toolchain work, and doubt it is useful in Arch in practice, given the binaries aren't meant for redistribution to other distros.
If someone wants to try their hand at removing these deps (and so making of them makedepends
), the build
invocation must be passed --ghc-options=-optl-static
, and (though I haven't managed to track down how to do this) GHC must be told to compile with musl-gcc
instead of gcc
(this might require installing a musl-based GHC).
This might not even be easily supported with current cabal
, though, see https://github.com/haskell/cabal/issues/1325
See also https://hasufell.github.io/posts/2024-04-21-static-linking.html
(This investigation was sparked by the realization that hledger-bin
is fully statically linked)
Pinned Comments
gesh commented on 2025-01-15 13:18 (UTC)
To clarify -- the goal of this package is to statically link against the Haskell dependencies. The non-Haskell libraries (
glibc
,gmp
) could be worked around in theory, but need amusl
-based toolchain to do so. I both haven't managed to make such a toolchain work, and doubt it is useful in Arch in practice, given the binaries aren't meant for redistribution to other distros.If someone wants to try their hand at removing these deps (and so making of them
makedepends
), thebuild
invocation must be passed--ghc-options=-optl-static
, and (though I haven't managed to track down how to do this) GHC must be told to compile withmusl-gcc
instead ofgcc
(this might require installing a musl-based GHC).This might not even be easily supported with current
cabal
, though, see https://github.com/haskell/cabal/issues/1325See also https://hasufell.github.io/posts/2024-04-21-static-linking.html
(This investigation was sparked by the realization that
hledger-bin
is fully statically linked)gesh commented on 2024-12-04 16:35 (UTC)
Note: when I wrote the commit message pushing for using
ghc-9.6.5
I was under the mistaken impression that--disable-ld-override
had been made the default forghc
's bindists. This is not the case --ghc
now only provides this as a build configuration option, see https://gitlab.haskell.org/ghc/ghc/-/issues/24565#note_570439 So to build this, the easiest way is to use aghc
provided byghcup
-- see https://www.haskell.org/ghcup/guide/#strategy-1-stack-hooks-new-recommended for how to getstack
to useghcup
to fetch its compiler.