Need build from source guide for GHC for alpine distribution

Hello, I need help building GHC from source for alpine based distributions. Here in this guide there is no mention of alpine based distributions

1 Like

What have you tried?

I am trying to build a minimal ghc compiler package for wolfi-base. Wolfi-base is very similar to alpine and uses apk. I haven’t tried anything for now sorry I am new to building packages from source. If you have any good guides please share it here

For the same architecture on Linux, you can simply grab a fully-static ghc bindist and then use it to bootstrap ghc on your distro. I did it for chimera linux (also musl & apk based) without any issue, you might find GitHub - TerrorJack/ghc-chimeralinux useful

1 Like

GHC upstream uses alpine images. You can see the environment setup here: images/alpine.dhall · master · Glasgow Haskell Compiler / ci-images · GitLab

You can clone the repo and run make dockerfiles to get the Dockerfiles like this one.

Once you have the environment, you can also use ghcup to compile GHC from source, see ghcup compile ghc --help.

1 Like