Giter VIP home page Giter VIP logo

benz0li / ghc-musl Goto Github PK

View Code? Open in Web Editor NEW
18.0 4.0 0.0 946 KB

Unofficial binary distributions of GHC on Alpine Linux. Multi-arch (linux/amd64, linux/arm64/v8) GHC musl docker images. Please submit Pull Requests to the GitLab repository. Mirror of

Home Page: https://gitlab.com/benz0li/ghc-musl

License: MIT License

Dockerfile 97.81% Haskell 0.04% Shell 2.15%
docker ghc multi-arch musl haskell alpine cabal stack podman quay

ghc-musl's Introduction

About

I devote about 20% of my time to open-source software maintaining dev containers, docker images and deployment templates for Data Scientists, ML/AI Engineers, and the like.

(GPU accelerated) Multi-arch dev containers1:

(GPU accelerated) Multi-arch docker images1:

Customised Docker Hub images1:

Containerised source installations1:

Containerised installations1:

Deployment templates:


I follow the development of

  1. https://gitlab.haskell.org/ghc/ghc
    and
  2. https://gitlab.alpinelinux.org/alpine/aports

in order to maintain GHC musl – Unofficial binary distributions of GHC on Alpine Linux.

Screenshot

ℹ️ The multi-arch (linux/amd64, linux/arm64/v8) docker image used to build the statically linked Linux amd64 and arm64 binary releases of

Images available at

Linked accounts

Footnotes

  1. Current os/arch's: linux/amd64, linux/arm64/v8 2 3 4 5

  2. Use cases (not exhaustive): Parent image, dev container, CI pipeline

  3. Base images: Debian (slim): stable, oldstable; Ubuntu: current LTS, former LTS 2 3

ghc-musl's People

Contributors

benz0li avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ghc-musl's Issues

Support GHC 9.6.3

GHC 9.6.3 is not in the Version Matrix but is now supported by nightly-2023-10-01.

GHC 9.6.3 has an 'official' Alpine Linux/x86_64 version (dynamically linked) that, I think, is free of the problems that trouble the statically-linked versions for that platform.

Also, Stack 2.13.1 has been released. All of its 'official' Linux binary distributions are now statically linked.

GHC 9.10.1: Waiting for `cabal-install` v3.12.[0|1].0 to be released

Modification:

diff --git a/latest.Dockerfile b/latest.Dockerfile
index 0b90abe..3c97655 100644
--- a/latest.Dockerfile
+++ b/latest.Dockerfile
@@ -5,7 +5,7 @@ ARG STACK_VERSION
 ARG GHC_VERSION_BUILD=${GHC_VERSION}
 ARG CABAL_VERSION_BUILD=${CABAL_VERSION}
 
-FROM glcr.b-data.ch/ghc/ghc-musl:9.6.5 as bootstrap
+FROM glcr.b-data.ch/ghc/ghc-musl:9.8.2 as bootstrap
 
 RUN apk upgrade --no-cache \
   && apk add --no-cache \
@@ -36,9 +36,9 @@ RUN cd /tmp \
   && curl -sSLO https://downloads.haskell.org/~ghc/"$GHC_VERSION"/ghc-"$GHC_VERSION"-src.tar.xz \
   && curl -sSLO https://downloads.haskell.org/~ghc/"$GHC_VERSION"/ghc-"$GHC_VERSION"-src.tar.xz.sig \
   && gpg --keyserver hkps://keyserver.ubuntu.com:443 \
-    --receive-keys 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 || \
+    --receive-keys FFEB7CE81E16A36B3E2DED6F2DE04D4E97DB64AD || \
     gpg --keyserver hkp://keyserver.ubuntu.com:80 \
-    --receive-keys 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 \
+    --receive-keys FFEB7CE81E16A36B3E2DED6F2DE04D4E97DB64AD \
   && gpg --verify "ghc-$GHC_VERSION-src.tar.xz.sig" "ghc-$GHC_VERSION-src.tar.xz" \
   && tar -xJf "ghc-$GHC_VERSION-src.tar.xz" \
   && cd "ghc-$GHC_VERSION" \

Build:

docker build \
  --build-arg GHC_VERSION=9.10.1 \
  --build-arg CABAL_VERSION=3.10.3.0 \
  --build-arg STACK_VERSION=2.15.7 \
  -t ghc-musl \
  -f latest.Dockerfile .

Error:

134.4 Error: hadrian: The program 'alex' is required but it could not be found.
134.4 
134.4 ExitFailure 1
134.4 Build failed.

@bgamari Why is alex required now?

Stack dysfunctional in image `glcr.b-data.ch/ghc/ghc-musl:9.2.8`

Error message:

No compiler found, expected minor version match with ghc-9.2.8 (aarch64) (based on resolver setting in /<example>/stack.yaml).
To install the correct GHC into /root/.stack/programs/aarch64-linux/, try running 'stack setup' or use the '--install-ghc' flag. To use your system GHC installation, run 'stack config set system-ghc --global true', or use the '--system-ghc' flag.

GHC 9.4.5 x86_64, linker error during static build with stack

Firstly, thanks for maintaining this project. I wondered if you'd be able to help debug a build issue when using the GHC 9.4.5 container, or suggest something we could try.

We're trying to use ghc-musl to produce static builds for the juvix project but are experiencing a linker issue with the build.

We're using ghc-musl:9.4.5 on x86_64.

The build works with a standard (i.e distributed by GHC) distribution of GHC 9.4.5.

Reproduction steps

  • I used the following script to do the build build.sh.gz
    • The stack command is stack install --allow-different-user --system-ghc --ghc-options='-static -split-sections -optl-static'
    • We link against a static runtime library that we build using clang
  • I launched the container using docker run -v $PWD/build.sh:/build.sh --rm -ti glcr.b-data.ch/ghc/ghc-musl:9.4.5 /bin/bash
  • The resulting transcript of the build session: typescript.gz (after gzip -d this is best viewed using less because of recorded ANSI escapes).

Linker error during build

/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/crtbe
ginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status

<no location info>: error:
    `gcc' failed in phase `Linker'. (Exit code: 1)

Upstream issue?

I found this issue which is related https://gitlab.haskell.org/ghc/ghc/-/issues/20168. The solution given there is to configure GHC to use its internal linker (used by ghci). However this does not seem like an ideal solution, we should use the system linker for this (as noted in the GHC documentation, the internal linker has known bugs, and they'd like to remove it).

Include stack in the image

Currently, stack must be installed manually (linux/amd64 image) or even built manually (linux/arm64/v8 image).

It would be convenient if stack was already available in the image.

GHC tarball stored in intermediate docker layer

The compiled GHC tarball is stored in an intermediate layer in/tmp before extracted and deleted. Therefore, the size of the tarball (roughly 200MB) still counts to the size of final image, and made the image significantly larger and difficult to fetch. See

ghc-musl/latest.Dockerfile

Lines 119 to 123 in 8dcfea3

COPY --from=bootstrap-ghc /tmp/ghc-"$GHC_VERSION"/_build/bindist/ghc-"$GHC_VERSION"-*-alpine-linux.tar.xz /tmp/
RUN cd /tmp \
## Install GHC
&& tar -xJf ghc-"$GHC_VERSION"-*-alpine-linux.tar.xz \

To shrink the size of final docker image, we could

  • Squash the final image, with something like
FROM scratch
COPY --from=ghc-stage1 / /
COPY --from=ghc-stage2 /root/.local/bin/cabal /usr/local/bin/cabal
CMD ["ghci"]
  • use COPY --link for tarball copying

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.