benz0li / ghc-musl

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
https://gitlab.com/benz0li/ghc-musl
MIT License
18 stars 0 forks source link

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

Closed benz0li closed 5 months ago

benz0li commented 5 months ago

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?

benz0li commented 5 months ago

Even if alex is provided

diff --git a/latest.Dockerfile b/latest.Dockerfile
index 0b90abe..39185f7 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" \
@@ -51,6 +51,8 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   && cabal update \
+  && cabal install alex \
+  && export PATH=/root/.local/bin:$PATH \
   ## See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
   && hadrian/build binary-dist -j"$(($(nproc)+1))" \
     --flavour=perf+llvm+split_sections \

the build fails:

393.7 ===> Command failed with error code: 1
393.7 ghc: could not execute: clang
393.8 Command failed
393.8 Build failed.
benz0li commented 5 months ago

Providing clang14 and removing --disable-ld-override LD=ld.gold in addition

diff --git a/latest.Dockerfile b/latest.Dockerfile
index 0b90abe..c97b669 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 \
@@ -13,6 +13,7 @@ RUN apk upgrade --no-cache \
     automake \
     binutils-gold \
     build-base \
+    clang14 \
     coreutils \
     cpio \
     curl \
@@ -36,14 +37,14 @@ 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" \
   && ./boot.source \
-  && ./configure --disable-ld-override LD=ld.gold \
+  && ./configure \
   ## Use the LLVM backend
   ## Switch llvm-targets from unknown-linux-gnueabihf->alpine-linux
   ## so we can match the llvm vendor string alpine uses
@@ -51,6 +52,8 @@ RUN cd /tmp \
   && sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets \
   && sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets \
   && cabal update \
+  && cabal install alex \
+  && export PATH=/root/.local/bin:$PATH \
   ## See https://unix.stackexchange.com/questions/519092/what-is-the-logic-of-using-nproc-1-in-make-command
   && hadrian/build binary-dist -j"$(($(nproc)+1))" \
     --flavour=perf+llvm+split_sections \
@@ -88,6 +91,7 @@ RUN apk add --no-cache \
     bzip2 \
     bzip2-dev \
     bzip2-static \
+    clang14 \
     curl \
     curl-static \
     dpkg \
@@ -124,7 +128,7 @@ RUN cd /tmp \
   ## Install GHC
   && tar -xJf ghc-"$GHC_VERSION"-*-alpine-linux.tar.xz \
   && cd ghc-"$GHC_VERSION"-*-alpine-linux \
-  && ./configure --disable-ld-override \
+  && ./configure \
   && make install \
   ## Install Stack
   && cd /tmp \

configures to

----------------------------------------------------------------------
Configure completed successfully.

   Building GHC version  : 9.10.1
          Git commit id  : 6d779c0fab30c39475aef50d39064ed67ce839d7

   Build platform        : aarch64-alpine-linux
   Host platform         : aarch64-alpine-linux
   Target platform       : aarch64-alpine-linux

   Bootstrapping using   : /usr/local/bin/ghc
      which is version   : 9.8.2
      with threaded RTS? : YES

   Using (for bootstrapping) : gcc
   Using gcc                 : /usr/bin/gcc
      which is version       : 13.2.1
      linker options         : -fuse-ld=gold
   Building a cross compiler : NO
   Unregisterised            : NO
   TablesNextToCode          : YES
   Build GMP in tree         : NO
   cpp          : /usr/bin/gcc
   cpp-flags    :  -E
   hs-cpp       : /usr/bin/gcc
   hs-cpp-flags :  -E -undef -traditional
   ar           : /usr/bin/ar
   nm           : /usr/bin/nm
   objdump      : /usr/bin/objdump
   ranlib       : /usr/bin/ranlib
   otool        : otool
   install_name_tool : install_name_tool
   windres      : 
   genlib       : 
   Happy        :  ()
   Alex         :  ()
   sphinx-build : 
   xelatex      : 
   makeinfo     : 
   git          : /usr/bin/git
   cabal-install : /usr/local/bin/cabal

   Using optional dependencies:
      libnuma : NO
      libzstd : NO
         statically linked? : N/A
      libdw   : NO

   Using LLVM tools
      llc   : llc14
      opt   : opt14
      llvm-as : clang-14

   HsColour was not found; documentation will not contain source links

   Tools to build Sphinx HTML documentation available: NO
   Tools to build Sphinx PDF documentation available: NO
   Tools to build Sphinx INFO documentation available: NO
----------------------------------------------------------------------

and builds successfully.

benz0li commented 5 months ago

Waiting for cabal-install v3.12.[0|1].0 to be released before updating the latest image to GHC v9.10.1.

Cross-references:

ulysses4ever commented 5 months ago

@benz0li a Cabal dev here. We hate blocking people. Have you considered using the pre-release in the meantime? https://discourse.haskell.org/t/ann-cabal-3-12-0-0-released/9504#how-to-get-the-cabal-install-pre-release-3

benz0li commented 5 months ago

@benz0li a Cabal dev here. We hate blocking people.

No worries.

Have you considered using the pre-release in the meantime? https://discourse.haskell.org/t/ann-cabal-3-12-0-0-released/9504#how-to-get-the-cabal-install-pre-release-3

No.

GHCup is deliberately avoided when creating these GHC musl[^1] docker images.

[^1]: Based on Alpine Linux (that is musl libc and BusyBox)

The same applies to its Dev Containers – which include the full Haskell Toolchain.

benz0li commented 5 months ago

I might install cabal-install-v3.12.0.0-prerelease from source, though.

Seems like resolving https://github.com/haskell/cabal/issues/9885 will take some more time.

ulysses4ever commented 5 months ago

Ghcup in that post is completely accidental: it's just a fancy way to

wget https://gitlab.haskell.org/haskell/cabal/-/jobs/1848320/artifacts/raw/out/cabal-install-3.11.0.0-x86_64-linux-alpine3_12.tar.xz

It's an alpine build, so should work well in your environment.

benz0li commented 5 months ago

@ulysses4ever I build cabal-install-v3.12.0.0-prerelease from source with GHC v9.10.1 on alpine:3:20 in a separate build stage now:

https://github.com/benz0li/ghc-musl/blob/b0c19b92fa4dc7ae5bf744fa80e03ef8ff63ae9e/latest.Dockerfile#L148-L161

ℹ️ Building with GHC v9.10.1 requires hashable v1.4.4.0 which was uploaded at 2024-04-02T17:52:00Z.

benz0li commented 5 months ago

Build pipeline: https://gitlab.b-data.ch/ghc/ghc-musl/-/pipelines/28693

ulysses4ever commented 5 months ago

I'm glad you found a solution!

ulysses4ever commented 5 months ago

We haven't got around to updating to GHC 9.10, indeed but there's work in progress. The hashable version is an known issue, indeed.

The --allow-newer cabal-install bit in your Dockerfile looks unnecessary, but I haven't tested

benz0li commented 5 months ago

The --allow-newer cabal-install bit in your Dockerfile looks unnecessary, but I haven't tested

It is not, because of

Could not resolve dependencies:
[__0] trying: Cabal-3.12.0.0 (user goal)
[__1] trying: base-4.20.0.0/installed-inplace (dependency of Cabal)
[__2] next goal: cabal-install (user goal)
[__2] rejecting: cabal-install-3.11.0.0 (conflict: base==4.20.0.0/installed-inplace, cabal-install => base>=4.10 && <4.20

and others.

ℹ️ --allow-newer maximises use of required [but newer] packages already in place.

ulysses4ever commented 5 months ago

ah, I see. We tend to be more precise (e.g. --allow-newer=":base") but maybe for your purposes, it's okay.