haskell / haskell/cabal

Distributable Binaries for MacOS With Static Linking

Open
#8,713 2 comments 0 reactions 0 assignees View on GitHub
re: dynamic-linking type: discussion
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

Apologies if this isn't the correct place to ask support questions.

I have a haskell application ([hevm](https://github.com/ethereum/hevm)) that links in a few external c dependencies, and I would like to use cabal to produce self contained binaries that can be downloaded and run on a wide range of end user systems. On linux, this is pretty easy using `--enable-executable-static` to proudce a fully static binary ([this](https://github.com/ethereum/hevm/blob/7cf6f2fbd98c7db4b1a06eff740fedab10a66c8d/flake.nix#L42) is how we do it at the moment). On macos things are a little more complicated as fully static executables are not supported. I would like to produce a binary that links the external c dependencies statically, but keeps system provided libraries (i.e. at a minimum `/usr/lib/libSystem.B.dylib`) as dynamically linked.

Is there a set of config / build flags that I can pass to cabal to achieve this? afaict `--enable-executable-static` is not suitable for producing distributable binaries on macos as it will try to force static linking of all dependencies (including system provided ones).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.