Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing pkgsMusl.haskell.compiler.ghc927 to .ghc945: segmentation fault with hsc2hs-created executable #239357

Open
mpilgrem opened this issue Jun 23, 2023 · 11 comments

Comments

@mpilgrem
Copy link

Describe the bug

Apologies if I am posting this in the wrong place - outside of maintaining the Haskell Tool Stack (Stack) project I am not a Nix user or a Docker user.

hsc2hs is a preprocessor executable that comes with GHC. It produces a C program from an *.hsc file that GHC compiles to an executable named *_hsc_make, that produces Haskell code when it is run.

In a Docker container, with Alpine Linux 3.17.2, pkgsMusl.haskell.compiler.ghc927 works fine. However, a change to pkgsMusl.haskell.compiler.ghc945 (with Alpine Linus 3.18.2) seems to result in the executable produced by hsc2hs generating a segmentation fault when it is run.

The 'official' build of GHC 9.4.5 - https://downloads.haskell.org/~ghc/9.4.5/ghc-9.4.5-x86_64-alpine3_12-linux-static-int_native.tar.xz - outside of a Docker container, does not exhibit the same hsc2hs problem (but it has different problems - with Template Haskell - https://gitlab.haskell.org/ghc/ghc/-/issues/23043#note_506034).

Steps To Reproduce

I've created a respository with a small Haskell package hsc2hs-test that illustrates the problem in its CI: https://github.com/mpilgrem/alpine-haskell-stack-test. Its dependency clock is a small package that makes use of hsc2hs. The log in the failed CI job Test CI (9.4.5) shows the problem. (Clock_hsc_make is the name of executable created by hsc2hs.)

Expected behavior

hsc2hs with pkgsMusl.haskell.compiler.ghc945 works, as it did with pkgsMusl.haskell.compiler.ghc945.

Additional context

The Docker image used is created here: https://github.com/fpco/alpine-haskell-stack. The ghc-musl.nix creates image psibi/alpine-haskell-stack:v3. The Dockerfile adds things to it. The justfile builds what is now image ghcr.io/fpco/alpine-haskell-stack:9.4.5.

This first came to light here: commercialhaskell/stack#6161. The (unrelated) Template Haskell problem with the 'official' GHC 9.4.5 build is discussed here: https://gitlab.haskell.org/ghc/ghc/-/issues/23043#note_506034.

Notify maintainers

I am in doubt, but I see jobs.pkgsMusl.haskell.compiler.ghc appears in nixpkgs/pkgs/top-level /release-haskell.nix and @sternenseemann and @cdepillabout have committed to that file recently.

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

I am not a Nix user.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here
@cdepillabout
Copy link
Member

cdepillabout commented Jun 23, 2023

@mpilgrem Thanks a lot for reporting this.

I haven't yet had time to look into this in depth, but let me ping the rest of the Haskell team in case someone else has a good idea @NixOS/haskell.

Also ping @nh2 since he's done some work recently in https://github.com/nh2/static-haskell-nix and may have an idea of what could be going on here.

@sternenseemann
Copy link
Member

sternenseemann commented Jun 25, 2023

Can you try narrowing this down? Currently we have a lot of moving parts and so we'll have to narrow down the interaction of what parts causes this:

  • Alpine
  • Nixpkgs
  • GHC
  • Docker
  • Stack
  • Cabal

What's more it seems to me you have changed two components at the same time in your comparison (Alpine 3.17.2 and GHC 9.2.7 to Alpine 3.18.2 and GHC 9.4.5).

Can you try doing a comparison between the GHC versions in the same Alpine version and between Alpine versions with the same version of GHC? Additionally it'd be great if you could instead of reproducing this via stack in the dependencies (i.e. clock) have a dependency-less project that uses hsc2hs and is built just using cabal, reducing the amount of parts involved in this.

Neither the musl GHC 9.4.5 from nixpkgs nor the one from Alpine's repos on their own can trigger the issue according to my testing.

@mpilgrem
Copy link
Author

@sternenseemann, will do. That may take me a little while, in part because I depend on others for the Docker images, so please bear with me.

@mpilgrem
Copy link
Author

mpilgrem commented Jun 25, 2023

As a first step, to my 'test' respository, I added package simple-hsc2hs-test which uses a simple Lib.hsc file (so simple, the *.hsc file itself uses no hsc2hs functionality). Same result (pass on GHC 9.2.7/Alpine 13.7.2; segmentation fault on GHC 9.4.5/Apline 13.8.2). I also turned on full Stack and Cabal (the library) 'normal' verbosity.

  • hsc2hs has supported response files by passing @<file_path_to_response_file> since 0.68.5. GHC 9.2.7 and GHC 9.4.5 come with hsc2hs 0.68.8; and
  • Cabal makes use of that facility, but does not output the content of the response file EDIT: unless Cabal verbosity is set to 'deafening'. 'Normal' Cabal verbosity is opaque. All you get is:
    [info] Preprocessing executable 'simple-hsc2hs-test' for simple-hsc2hs-test-0.1.0.0..
    [info] creating
    [info] .stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp
    [info] /bin/hsc2hs '@.stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/hsc2hs-response167-2.txt'
    [warn] running .stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/Lib_hsc_make failed (exit code -11)
    [warn] rsp file was: ".stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/hsc2hscall174-3.rsp"
    [warn] output file:".stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/Lib.hs"
    [warn] command was: .stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/Lib_hsc_make  >.stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/Lib.hs
    [warn] error:
    

EDIT: With Cabal verbosity at deafening, the contents of the response file are reported as:

--cflag=-D__GLASGOW_HASKELL__=904
--cflag=-Dlinux_BUILD_OS=1
--cflag=-Dx86_64_BUILD_ARCH=1
--cflag=-Dlinux_HOST_OS=1
--cflag=-Dx86_64_HOST_ARCH=1
--cflag=-I/usr/include
--cflag=-I/usr/include
--cflag=-I.stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/autogen
--cflag=-I.stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/global-autogen
--cflag=-include
--cflag=.stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/autogen/cabal_macros.h
--lflag=-L/lib
--lflag=-L/usr/lib
--lflag=-Wl,-R,/lib
--lflag=-Wl,-R,/usr/lib
--cflag=-I/nix/store/yrifsrp9qdzl37g4igfi5yamxn9k50kn-musl-iconv-1.2.3/include
--cflag=-I/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/base-4.17.1.0/include
--cflag=-I/nix/store/4rxddkc6dv61pvmqxa61n13xd79w3s3k-gmp-with-cxx-6.2.1-dev/include
--cflag=-I/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/ghc-bignum-1.3/include
--cflag=-I/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/rts/include
--cflag=-I/nix/store/nl33i58lqpid7mxk275f08bw4wpkkci2-libffi-3.4.4-dev/include
--lflag=-L/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/base-4.17.1.0
--lflag=-L/nix/store/yrifsrp9qdzl37g4igfi5yamxn9k50kn-musl-iconv-1.2.3/lib
--lflag=-Wl,-R,/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/base-4.17.1.0
--lflag=-Wl,-R,/nix/store/yrifsrp9qdzl37g4igfi5yamxn9k50kn-musl-iconv-1.2.3/lib
--lflag=-L/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/ghc-bignum-1.3
--lflag=-L/nix/store/09py17b9ba8jkfardf1dib1hpxvhdwb3-gmp-with-cxx-6.2.1/lib
--lflag=-Wl,-R,/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/ghc-bignum-1.3
--lflag=-Wl,-R,/nix/store/09py17b9ba8jkfardf1dib1hpxvhdwb3-gmp-with-cxx-6.2.1/lib
--lflag=-lgmp
--lflag=-L/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/ghc-prim-0.9.0
--lflag=-Wl,-R,/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/ghc-prim-0.9.0
--lflag=-lc
--lflag=-lm
--lflag=-L/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/rts
--lflag=-L/nix/store/pnw21w9arlyhzl5q4y9kw00jmgdi5iza-libffi-3.4.4/lib
--lflag=-Wl,-R,/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/rts
--lflag=-Wl,-R,/nix/store/pnw21w9arlyhzl5q4y9kw00jmgdi5iza-libffi-3.4.4/lib
--lflag=-lm
--lflag=-lrt
--lflag=-ldl
--lflag=-lffi
--cc=/nix/store/lb6ppdjg4wrpzdk994pnp53xhjrn53qa-gcc-wrapper-12.3.0/bin/cc
--ld=/nix/store/lb6ppdjg4wrpzdk994pnp53xhjrn53qa-gcc-wrapper-12.3.0/bin/cc
 -o
.stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/Lib.hs
app/Lib.hsc

@mpilgrem
Copy link
Author

mpilgrem commented Jun 25, 2023

As a second step, I have added hsc2hs verbosity to the output. In each case, the step that builds the executable that fails segmentation (in the case of GHC 9.4.5) looks very similar to me, with 9.4.5 substituting for 9.2.7 and different GHC boot package versions, accordingly.

The former (GHC 9.2.7) calls gcc-wrapper-12.2.0/bin/cc and the latter (GHC 9.4.5) calls gcc-wrapper-12.3.0/bin/cc.

GHC 9.2.7/Alpine 13.7.2 (passes)

Executing: (@.stack-work/dist/x86_64-linux-dk4f31dc93c12465b48238129ec7324625/Cabal-3.6.3.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/hsc2hscall160-2.rsp) 
/nix/store/hx7djyc7ll74gj0ansrs92p59n7y2578-gcc-wrapper-12.2.0/bin/cc 
.stack-work/dist/x86_64-linux-dk4f31dc93c12465b48238129ec7324625/Cabal-3.6.3.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/Lib_hsc_make.o
.stack-work/dist/x86_64-linux-dk4f31dc93c12465b48238129ec7324625/Cabal-3.6.3.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/Lib_hsc_utils.o 
-o .stack-work/dist/x86_64-linux-dk4f31dc93c12465b48238129ec7324625/Cabal-3.6.3.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/Lib_hsc_make 
-L/lib 
-L/usr/lib 
-Wl,-R,/lib 
-Wl,-R,/usr/lib 
-L/nix/store/z7z6kw76wnp86r7k9srxzkl3aaa7nn6r-ghc-musl-9.2.7/lib/ghc-9.2.7/base-4.16.4.0 
-L/nix/store/xclfsa4ag6vsbxh4kmlv771q1sndin24-musl-iconv-1.2.3/lib 
-Wl,-R,/nix/store/z7z6kw76wnp86r7k9srxzkl3aaa7nn6r-ghc-musl-9.2.7/lib/ghc-9.2.7/base-4.16.4.0 
-Wl,-R,/nix/store/xclfsa4ag6vsbxh4kmlv771q1sndin24-musl-iconv-1.2.3/lib 
-L/nix/store/z7z6kw76wnp86r7k9srxzkl3aaa7nn6r-ghc-musl-9.2.7/lib/ghc-9.2.7/ghc-bignum-1.2 
-L/nix/store/mmxzxfn2k32qdn47vpvkc67yncq6lyfn-gmp-with-cxx-6.2.1/lib 
-Wl,-R,/nix/store/z7z6kw76wnp86r7k9srxzkl3aaa7nn6r-ghc-musl-9.2.7/lib/ghc-9.2.7/ghc-bignum-1.2 
-Wl,-R,/nix/store/mmxzxfn2k32qdn47vpvkc67yncq6lyfn-gmp-with-cxx-6.2.1/lib 
-lgmp 
-L/nix/store/z7z6kw76wnp86r7k9srxzkl3aaa7nn6r-ghc-musl-9.2.7/lib/ghc-9.2.7/ghc-prim-0.8.0 
-Wl,-R,/nix/store/z7z6kw76wnp86r7k9srxzkl3aaa7nn6r-ghc-musl-9.2.7/lib/ghc-9.2.7/ghc-prim-0.8.0 
-lc 
-lm 
-L/nix/store/z7z6kw76wnp86r7k9srxzkl3aaa7nn6r-ghc-musl-9.2.7/lib/ghc-9.2.7/rts 
-L/nix/store/qzhyx755hlawwlaldgmg1cc9734nj09l-libffi-3.4.4/lib 
-Wl,-R,/nix/store/z7z6kw76wnp86r7k9srxzkl3aaa7nn6r-ghc-musl-9.2.7/lib/ghc-9.2.7/rts 
-Wl,-R,/nix/store/qzhyx755hlawwlaldgmg1cc9734nj09l-libffi-3.4.4/lib 
-lm 
-lrt 
-ldl 
-lffi

GHC 9.4.5/Alpine 3.18.2 (executable segfaults when run)

Executing: (@.stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/hsc2hscall174-2.rsp)
/nix/store/lb6ppdjg4wrpzdk994pnp53xhjrn53qa-gcc-wrapper-12.3.0/bin/cc
.stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/Lib_hsc_make.o 
.stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/Lib_hsc_utils.o
-o .stack-work/dist/x86_64-linux-dkbbc7701fbbddb5591b4899472412e28d/Cabal-3.8.1.0/build/simple-hsc2hs-test/simple-hsc2hs-test-tmp/Lib_hsc_make
-L/lib
-L/usr/lib 
-Wl,-R,/lib 
-Wl,-R,/usr/lib 
-L/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/base-4.17.1.0 
-L/nix/store/yrifsrp9qdzl37g4igfi5yamxn9k50kn-musl-iconv-1.2.3/lib 
-Wl,-R,/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/base-4.17.1.0 
-Wl,-R,/nix/store/yrifsrp9qdzl37g4igfi5yamxn9k50kn-musl-iconv-1.2.3/lib 
-L/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/ghc-bignum-1.3 
-L/nix/store/09py17b9ba8jkfardf1dib1hpxvhdwb3-gmp-with-cxx-6.2.1/lib 
-Wl,-R,/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/ghc-bignum-1.3 
-Wl,-R,/nix/store/09py17b9ba8jkfardf1dib1hpxvhdwb3-gmp-with-cxx-6.2.1/lib 
-lgmp 
-L/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/ghc-prim-0.9.0 
-Wl,-R,/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/ghc-prim-0.9.0 
-lc 
-lm 
-L/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/rts 
-L/nix/store/pnw21w9arlyhzl5q4y9kw00jmgdi5iza-libffi-3.4.4/lib 
-Wl,-R,/nix/store/wglsb50rz27mqffxikmjcvbi64rh7kk1-ghc-musl-9.4.5/lib/ghc-9.4.5/rts 
-Wl,-R,/nix/store/pnw21w9arlyhzl5q4y9kw00jmgdi5iza-libffi-3.4.4/lib 
-lm 
-lrt 
-ldl 
-lffi

I understand (if ChatGPT is reliable) that the -L options specify where to look for libraries; the -Wl,-R, options specify runtime library seach paths (-Wl passing the -R option to the linker); the -l options specify libraries to be linked against (libgmp, libc, libm (x2), librt, libdl and libffi).

@mpilgrem
Copy link
Author

As a third step, I tried applying hsc2hs directly to Lib.hsc, both using the cc on the PATH (cc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924) and the ones used by Cabal (the library):

  • GHC 9.2.7: /nix/store/hx7djyc7ll74gj0ansrs92p59n7y2578-gcc-wrapper-12.2.0/bin/cc (gcc (GCC) 12.2.0)
  • GHC 9.4.5: /nix/store/lb6ppdjg4wrpzdk994pnp53xhjrn53qa-gcc-wrapper-12.3.0/bin/cc (gcc (GCC) 12.3.0)

In all cases, there was no problem.

@mpilgrem
Copy link
Author

As a fourth step, I examined the C code produced by hsc2hs for Lib.hsc. I could not work out how to do that after the segmentation fault, but on the GHC 9.2.7 version, the code was unremarkable and I would not expect it to differ materially on the GHC 9.4.5 version:

Lib_hsc_make.c:

#include "/nix/store/z7z6kw76wnp86r7k9srxzkl3aaa7nn6r-ghc-musl-9.2.7/lib/ghc-9.2.7/template-hsc.h"

int main (void)
{
    hsc_line (1, "app/Lib.hsc");
    hsc_fputs ("", hsc_stdout());
    hsc_fputs ("-- This *.hsc files does not use any of the features of hsc2hs.\n"
           "", hsc_stdout());
    hsc_fputs ("\n"
           "module Lib\n"
           "  ( magicInteger\n"
           "  ) where\n"
           "\n"
           "magicInteger :: Int\n"
           "magicInteger = 13\n"
           "", hsc_stdout());
    return 0;
}

Lib_hsc_utils.c:

#include "/nix/store/z7z6kw76wnp86r7k9srxzkl3aaa7nn6r-ghc-musl-9.2.7/lib/ghc-9.2.7/template-hsc.h"


#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>

int hsc_printf(const char *format, ...) {
    int r;
    va_list argp;
    va_start(argp, format);
    r = vprintf(format, argp);
    va_end(argp);
    return r;
}

int hsc_toupper(int c) {
    return toupper(c);
}

int hsc_tolower(int c) {
    return tolower(c);
}

int hsc_putchar(int c) {
    return putchar(c);
}

int hsc_fputs(const char *s, void *stream) {
    return fputs(s, (FILE *)stream);
}

void *hsc_stdout(void) {
    return (void *)stdout;
}

@mpilgrem
Copy link
Author

mpilgrem commented Jun 25, 2023

As a fifth step, I tried applying hsc2hs directly to Lib.hsc - using both versions of cc - but also including Cabal's passing of --lflag -lgmp (as well as --lflag=-L/lib --lflag=-L/usr/lib --lflag=-Wl,-R,/lib --lflag=-Wl,-R,/usr/lib; these on their own have no adverse effect). For both versions of cc:

  • GHC 9.2.7 passed
  • GHC 9.4.5 failed

EDIT: I also tried with just --lflag -lc or just --lflag -lm but they did not trigger the adverse effect like just --lflag -lgmp.

@mpilgrem
Copy link
Author

mpilgrem commented Jun 25, 2023

@sternenseemann, I think I can be more specific, as follows:

  • Applying hsc2hs directly to a simple Lib.hsc works fine for both 'GHC 9.2.7' and 'GHC 9.4.5', but ...
  • if hsc2hs is instructed to pass -lgmp to the linker, it works fine for 'GHC 9.2.7' but gives rise to the segmentation fault problem for 'GHC 9.4.5'.
  • When Cabal invokes hsc2hs, it instructs hsc2hs to pass -lgmp to the linker (as well as other -l options).

The creation of the Docker image involves:

apk add --no-cache gmp-dev

@mpilgrem
Copy link
Author

I tried to move from GHC 9.2.7 to GHC 9.2.8 and experienced the same problem: packages that use hsc2hs segfault.

@mpilgrem
Copy link
Author

I was a little surprised that this was a GHC 9.2.7 to 9.2.8 problem, as well as a GHC 9.2.7 to GHC 9.4.5 problem, so I examined the difference between the ghc927 and ghc-9.2.8 branches of the repository that produces the Alpine Linux Docker container. I set it out below. I can't see anything in the 'recipe' that provides an avenue for investigation.

diff --git a/Dockerfile b/Dockerfile
index 3861c95..59d4a8f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,7 +26,7 @@ RUN apk upgrade --no-cache &&\
         lld \
         shadow # for stack --docker, provides groupadd
 
-RUN curl -sSLo /usr/local/bin/stack https://github.com/commercialhaskell/stack/releases/download/v2.9.3/stack-2.9.3-linux-x86_64-bin && \
+RUN curl -sSLo /usr/local/bin/stack https://github.com/commercialhaskell/stack/releases/download/v2.11.1/stack-2.11.1-linux-x86_64-bin && \
     chmod +x /usr/local/bin/stack
 
 # https://stackoverflow.com/a/41517423

diff --git a/ghc-musl.nix b/ghc-musl.nix
index 33055e3..543edb7 100644
--- a/ghc-musl.nix
+++ b/ghc-musl.nix
@@ -1,7 +1,7 @@
 { pkgs ? import
     (builtins.fetchTarball {
       url =
-        "https://github.com/NixOS/nixpkgs/archive/81d5cb1550ef0a58c5ee529c743065cc93a7fb64.tar.gz";
+        "https://github.com/NixOS/nixpkgs/archive/17662bfb35c25ba1788a6fedcb00dde6379da7ec.tar.gz";
     })
     { }
 }:
@@ -9,8 +9,8 @@ let
   alpineImage = pkgs.dockerTools.pullImage {
     imageName = "alpine";
     imageDigest =
-      "sha256:e2e16842c9b54d985bf1ef9242a313f36b856181f188de21313820e177002501";
-    sha256 = "sha256-YCYpUByIOig4zt/WIvDas3AwHjDYkIQJ6IEKuADJmgg=";
+      "sha256:25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70";
+    sha256 = "sha256-ymburWdn08/l5jqTAmdeXbBys0q01OmNuOVG4mnMzqk=";
   };
 in
 pkgs.dockerTools.buildImage {
@@ -20,7 +20,7 @@ pkgs.dockerTools.buildImage {
   fromImage = alpineImage;
 
   contents = [
-    pkgs.pkgsMusl.haskell.compiler.ghc927
+    pkgs.pkgsMusl.haskell.compiler.ghc928
     pkgs.pkgsMusl.zlib
     pkgs.pkgsMusl.zlib.dev
     pkgs.pkgsMusl.ncurses

diff --git a/justfile b/justfile
index ef424f0..48acd77 100644
--- a/justfile
+++ b/justfile
@@ -1,4 +1,4 @@
-GHC_VERSION := "9.2.7"
+GHC_VERSION := "9.2.8"
 
 # List all recipies
 default:
@@ -6,11 +6,11 @@ default:
 
 # Build docker image
 build-image:
-    docker image build . -f Dockerfile -t fpco/alpine-haskell-stack:{{GHC_VERSION}}
+    docker image build . -f Dockerfile -t ghcr.io/fpco/alpine-haskell-stack:{{GHC_VERSION}}
 
 # Push image
 push-image:
-    docker push fpco/alpine-haskell-stack:{{GHC_VERSION}}
+    docker push ghcr.io/fpco/alpine-haskell-stack:{{GHC_VERSION}}
 
 # Build nix image
 build-nix-image:
@@ -22,4 +22,5 @@ load-nix-image:
 
 # Test image
 test-image:
-    docker run --tty --interactive fpco/alpine-haskell-stack:{{GHC_VERSION}} sh
+    docker run --rm --tty ghcr.io/fpco/alpine-haskell-stack:{{GHC_VERSION}} ghc --version
+    docker run --rm --tty ghcr.io/fpco/alpine-haskell-stack:{{GHC_VERSION}} stack --version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants