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

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

Closed
benz0li opened this issue May 16, 2024 · 13 comments
Closed

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

benz0li opened this issue May 16, 2024 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@benz0li
Copy link
Owner

benz0li commented May 16, 2024

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 benz0li added the bug Something isn't working label May 16, 2024
@benz0li benz0li self-assigned this May 16, 2024
@benz0li
Copy link
Owner Author

benz0li commented May 16, 2024

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
Copy link
Owner Author

benz0li commented May 16, 2024

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
Copy link
Owner Author

benz0li commented May 16, 2024

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

Cross-references:

@benz0li benz0li changed the title GHC 9.10.1: Does not build with latest.Dockerfile GHC 9.10.1: Waiting for cabal-install v3.12.0.0 to be released May 16, 2024
@benz0li benz0li pinned this issue May 16, 2024
@benz0li benz0li changed the title GHC 9.10.1: Waiting for cabal-install v3.12.0.0 to be released GHC 9.10.1: Waiting for cabal-install v3.12.[0|1].0 to be released May 19, 2024
@ulysses4ever
Copy link

@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
Copy link
Owner Author

benz0li commented May 28, 2024

@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 musl1 docker images.

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

Footnotes

  1. Based on Alpine Linux (that is musl libc and BusyBox)

@benz0li
Copy link
Owner Author

benz0li commented May 28, 2024

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

Seems like resolving haskell/cabal#9885 will take some more time.

@ulysses4ever
Copy link

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
Copy link
Owner Author

benz0li commented May 28, 2024

@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:

ghc-musl/latest.Dockerfile

Lines 148 to 161 in b0c19b9

FROM ghc-stage1 as ghc-stage2
## Install Cabal (the tool) built with the GHC bootstrap version
COPY --from=bootstrap-cabal /root/.local/bin/cabal /usr/local/bin/cabal
## Rebuild Cabal (the tool) with the GHC target version
RUN cd /tmp \
&& curl -sSLO https://github.com/haskell/cabal/archive/refs/tags/cabal-install-v"$CABAL_VERSION".tar.gz \
&& tar -xzf cabal-install-v"$CABAL_VERSION".tar.gz \
&& cd cabal-cabal-install-v"$CABAL_VERSION" \
&& sed -i 's/2024-03-20T08:02:24Z/2024-04-02T17:52:00Z/g' cabal.project.release \
&& sed -i 's/hashable >= 1.0 /hashable >= 1.4.4.0 /g' cabal-install/cabal-install.cabal \
&& cabal update \
&& cabal install --project-file=cabal.project.release --allow-newer cabal-install

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

@benz0li
Copy link
Owner Author

benz0li commented May 28, 2024

@ulysses4ever
Copy link

I'm glad you found a solution!

@ulysses4ever
Copy link

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
Copy link
Owner Author

benz0li commented May 28, 2024

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants