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 --enable-executable-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:12 (UTC) (edited on 2025-01-15 13:15 (UTC) by gesh)
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--enable-executable-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:41 (UTC)
The default makepkg configuration sets LDFLAGS but not LD. GHC used to take this as its cue to select its own choice of LD. However GHC would not check that its choice of LD supports LDFLAGS. This is a problem for dependencies with C components, which get linked using this LD.
Starting with ghc 9.6.5 (2024-04-16), one can build this behaviour out of ghc[1].
ghcup
has picked up this configuration for its bindists[2], and is to my knowledge the only bindist fixing this -- my recommendation is to use itsghc
to build the package.[1] - https://gitlab.haskell.org/ghc/ghc/-/issues/24565 [2] - https://github.com/haskell/ghcup-hs/issues/1033