# Statically-linked binary distributions for Linux

**URL:** <https://discourse.haskell.org/t/statically-linked-binary-distributions-for-linux/7248>\
**Category:** Learn\
**Created:** [August 9, 2023, 6:38pm UTC](https://discourse.haskell.org/t/statically-linked-binary-distributions-for-linux/7248 "2023-08-09T18:38:06Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mpilgrem](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/mpilgrem/32/2529_2.png) [@mpilgrem](https://discourse.haskell.org/u/mpilgrem)\
**Post date:** [August 9, 2023, 9:21pm UTC](https://discourse.haskell.org/t/statically-linked-binary-distributions-for-linux/7248/4 "2023-08-09T21:21:29Z")

</div>

At the _promising_ discussion, @hasufell offered up the following - but I _think_ that is dependent on the existence of a working ‘Alpine Linux’ version of GHC. Cabal’s `--enable-executable-static` flag is documented [here](https://cabal.readthedocs.io/en/stable/setup-commands.html#cmdoption-runhaskell-Setup.hs-configure-enable-executable-static):

> [@Portable Haskell executables, anyone doing that (possibly using Nix)?](http://discourse.haskell.org/t/portable-haskell-executables-anyone-doing-that-possibly-using-nix/4816/8):
>
> Use an alpine linux docker container and build your binaries with cabal build --enable-executable-static. Don’t use cabal install. That’s all there is to it. GHCup, cabal and HLS all do this to build static executables.

EDIT: On ubuntu (via WSL 2) applying in Stack’s configuration:

```yaml
configure-options: # Configure Cabal's configuration options
  $locals:
  - --enable-executable-static

```

saw `stack build` end badly in the same way as my post above.

---

_[View the full topic](https://discourse.haskell.org/t/statically-linked-binary-distributions-for-linux/7248)._
