Code Monkey home page Code Monkey logo

ghc-musl's People

Contributors

benz0li avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

ghc-musl's Issues

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

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.

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).

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.