GHC musl
March 25, 2026 · View on GitHub
Unofficial and untested binary distributions of GHC on Alpine Linux.
The multi‑arch (linux/amd64, linux/arm64/v8) docker image used to build the
statically linked Linux amd64 and arm64 binary releases of
Credit to
who laid the groundwork for this.
Credit to
- Celeste of Alpine for GHC bootstrap riscv642
who made it possible to add linux/riscv64 images (GHC versions ≥ 9.10.1).
Table of Contents
Prerequisites
This project requires an installation of docker.
Install
To install docker, follow the instructions for your platform:
- Install Docker Engine | Docker Documentation > Supported platforms
- Post-installation steps for Linux
Usage
Build image
latest:
docker build \
-t ghc-musl \
-f dockerfiles/9.14.1.Dockerfile .
version:
docker build \
-t ghc-musl:MAJOR.MINOR.PATCH \
-f dockerfiles/MAJOR.MINOR.PATCH.Dockerfile .
For MAJOR.MINOR.PATCH GHC versions 8.8.4, 8.10.1 and ≥ 8.10.4.
:point_right: See the Version Matrix for detailed information.
Run container
self built:
docker run --rm -ti ghc-musl:{latest,MAJOR.MINOR.PATCH}
from Quay:
docker run --rm -ti quay.io/benz0li/ghc-musl:{latest,MAJOR[.MINOR[.PATCH]]}[-int-native]
from Docker Hub:
docker run --rm -ti docker.io/benz0li/ghc-musl:{latest,MAJOR[.MINOR[.PATCH]]}[-int-native]
from GitLab (b-data GmbH):
docker run --rm -ti glcr.b-data.ch/ghc/ghc-musl:{latest,MAJOR[.MINOR[.PATCH]]}[-int-native]
As of 2023‑08‑12, the images (versions 9.2.8, 9.4.6, 9.6.2 and later) also include the Haskell Tool Stack (Stack).
On 2024‑02‑23, the binary distribution of GHC version 9.8.2 was released for
Alpine Linux (AArch64).
:exclamation: Use flags --no-install-ghc --system-ghc
GMP licensing restrictions
The regular images produce binaries linked against the
GNU Multiple Precision Arithmetic Library (GMP), which
is used by default by the
integer-gmp library to
provide a big-integer implementation for Haskell.
Unlike most Haskell code, which is licensed under the permissive BSD3 license, the GMP library is licensed under LGPL. This means resulting statically linked binaries must be provided with source code or object files.
If that is not acceptable for your situation, use images with the int-native
subtag. These images provide a GHC that links against the Haskell-native
big-integer backend and produces statically linked binaries that are not
subject to GMP's licensing restrictions.
:information_source: Available for versions 9.6.7, 9.8.4, 9.10.1, 9.12.2 and
later.
The current Dev Containers of this project use images with the int-native
subtag.
Default linker
For GHC versions 9.10.2, 9.12.2 and later, the images with the int-native
subtag use ld.lld (the LLVM linker) by default.
All other images use ld.bfd (the GNU linker) by default.
Dev Containers
The default Dev Container is meant to work on this repository.
The other configurations are custom GHC containers based on
int-native subtag).
For further information, see Dev Containers.
Similar projects
What makes this project different:
- Multi‑arch:
linux/amd64,linux/arm64/v8 - Built using Hadrian3, from source, without docs
- Built using the LLVM backend. Flavours:
- regular images:
perf+split_sections+llvm int-nativesubtag:perf+split_sections+llvm+native_bignum
- regular images:
Interesting to read:
- Opinion piece on GHC backends by @AndreasPK
- Improving Haskell’s big numbers support by @hsyl20
- lsupg Static Builds With GHC 9 by @TravisCardwell
Contributing
PRs accepted. Please submit to the GitLab repository.
This project follows the Contributor Covenant Code of Conduct.
License
Copyright © 2021 Olivier Benz
Distributed under the terms of the MIT License.