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

Re #6160 Move Stack on to GHC 9.2.8 #6204

Merged
merged 4 commits into from
Aug 18, 2023
Merged

Re #6160 Move Stack on to GHC 9.2.8 #6204

merged 4 commits into from
Aug 18, 2023

Conversation

mpilgrem
Copy link
Member

@mpilgrem mpilgrem commented Aug 8, 2023

The motivation for this is that while the Alpine Linux versions of GHC 9.4.x are broken (see #6161), it is not possible to move Stack on from the GHC 9.2.x series, because the statically-linked bindists for Stack for Linux/x86_64 are built on Alpine Linux.

@mpilgrem
Copy link
Member Author

mpilgrem commented Aug 9, 2023

@psibi, would it be possible for you to create a GHC 9.2.8 version of:

docker:
  enable: false
  repo: fpco/alpine-haskell-stack:9.2.7

@psibi
Copy link
Member

psibi commented Aug 10, 2023

@mpilgrem mpilgrem force-pushed the ghc-9.2.8 branch 2 times, most recently from 7785fce to 4e5f03c Compare August 11, 2023 22:08
@mpilgrem
Copy link
Member Author

@psibi, many thanks. Unfortunately, it looks like the Nix-supplied GHC 9.2.8 is infected with the same bug as the Nix-supplied GHC 9.4.5 - the packages that make use of hsc2hs segfault (NixOS/nixpkgs#239357).

@benz0li
Copy link
Contributor

benz0li commented Aug 14, 2023

@mpilgrem You could try the multi-arch (linux/amd64, linux/arm64/v8) glcr.b-data.ch/ghc/ghc-musl:9.2.8 image.

Cross reference: #6142 (comment)

@psibi
Copy link
Member

psibi commented Aug 14, 2023

@mpilgrem I have created an image using ghc supplied bindists for musl:

ghcr.io/fpco/alpine-haskell-stack:ghc-9.2.8v2

@benz0li Thanks, your project looks interesting.

@mpilgrem
Copy link
Member Author

mpilgrem commented Aug 14, 2023

@psibi, @benz0li, given the CI results, that Docker image seems to suffer from the same problem as the 'Nix-supplied GHC' one: packages that use hsc2hs segfault.

@benz0li
Copy link
Contributor

benz0li commented Aug 14, 2023

@psibi, @benz0li, given the CI results, that Docker image seems to suffer from the same problem as the 'Nix-supplied GHC' one: packages that use hsc2hs segfault.

@mpilgrem Please try glcr.b-data.ch/ghc/ghc-musl:9.2.8.

I am pretty sure it works with that.

@benz0li
Copy link
Contributor

benz0li commented Aug 15, 2023

The one that currently segfaults is ghcr.io/fpco/alpine-haskell-stack:ghc-9.2.8v2, which uses the official bindists for Alpine Linux (x86-64).

The reason it segfaults could be that the bindist is for Alpine 3.12 and @psibi uses Alpine 3.18 as the base image.

I ask you again to consider glcr.b-data.ch/ghc/ghc-musl for building Stack.
👉 https://github.com/benz0li/ghc-musl

(If the image is missing a package – e.g. shadow – I will be happy to add it.)
ℹ️ I am currently adding package shadow to the image:

  • glcr.b-data.ch/ghc/ghc-musl:9.2.8: done
  • glcr.b-data.ch/ghc/ghc-musl:9.4.6: done
  • glcr.b-data.ch/ghc/ghc-musl:9.6.2: done

@psibi
Copy link
Member

psibi commented Aug 15, 2023

@benz0li It's possible, but the 9.4.5 image was also built using alpine 3.18 (https://hub.docker.com/layers/library/alpine/3.18.2/images/sha256-25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70?context=explore) and it didn't have similar issues (but that used the Nix machinery).

Historically, I never had any success using the musl build released by GHC team as it used to segfault with the stack code.

@benz0li
Copy link
Contributor

benz0li commented Aug 15, 2023

I was able to build Stack (statically linked) on Debian 11 (AArch64) using glcr.b-data.ch/ghc/ghc-musl:9.6.2:

Infos

Host

# uname -a
Linux debian 5.10.0-24-arm64 #1 SMP Debian 5.10.179-5 (2023-08-08) aarch64 GNU/Linux
# lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye

Stack

# which stack
/usr/local/bin/stack
# "$(which stack)" --version
Version 2.11.1, Git revision c1167a6abc3f4978ccded5ba0246a57387da0e2f aarch64 hpack-0.35.2
# file "$(which stack)"
/usr/local/bin/stack: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[xxHash]=3d8f9d614342c40f, stripped

Docker

# docker version
Client: Docker Engine - Community
 Version:           24.0.5
 API version:       1.43
 Go version:        go1.20.6
 Git commit:        ced0996
 Built:             Fri Jul 21 20:35:38 2023
 OS/Arch:           linux/arm64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.5
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.6
  Git commit:       a61e2b4
  Built:            Fri Jul 21 20:35:38 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Build

Modification

# git diff
diff --git a/stack-ghc-9.6.2.yaml b/stack-ghc-9.6.2.yaml
index 29fdf085c..a4d88c012 100644
--- a/stack-ghc-9.6.2.yaml
+++ b/stack-ghc-9.6.2.yaml
@@ -12,8 +12,9 @@ drop-packages:
 - cabal-install
 
 docker:
-  enable: false
-  repo: fpco/alpine-haskell-stack:8.10.4
+  enable: true
+  repo: glcr.b-data.ch/ghc/ghc-musl:9.6.2
+  stack-exe: image
 
 nix:
   # --nix on the command-line to enable.

Command

# stack install stack --flag=stack:static --no-install-ghc --system-ghc --stack-yaml stack-ghc-9.6.2.yaml

Log

build_log.txt


# ./.stack-work/docker/_home/.local/bin/stack --version
Version 2.12.0, Git revision 59e285e50508c12bf31b918f136c62cca1ceda45 (dirty) (9781 commits) PRE-RELEASE aarch64
Compiled with:
- Cabal-3.10.1.0
- Cabal-syntax-3.10.1.0
- Glob-0.10.2
- OneTuple-0.4.1.1
- QuickCheck-2.14.3
- StateVar-1.2.2
- aeson-2.1.2.1
- aeson-warning-parser-0.1.0
- annotated-wl-pprint-0.7.0
- ansi-terminal-1.0
- ansi-terminal-types-0.11.5
- appar-0.1.8
- array-0.5.5.0
- asn1-encoding-0.9.6
- asn1-parse-0.9.5
- asn1-types-0.3.4
- assoc-1.1
- async-2.2.4
- attoparsec-0.14.4
- attoparsec-0.14.4
- attoparsec-aeson-2.1.0.0
- attoparsec-iso8601-1.1.0.0
- auto-update-0.1.6
- base-4.18.0.0
- base-compat-0.13.0
- base-compat-batteries-0.13.0
- base-orphans-0.9.0
- base16-bytestring-1.0.2.0
- base64-bytestring-1.2.1.0
- basement-0.0.16
- bifunctors-5.6.1
- binary-0.8.9.1
- bitvec-1.1.4.0
- blaze-builder-0.4.2.2
- blaze-html-0.9.1.2
- blaze-markup-0.8.2.8
- byteorder-1.0.4
- bytestring-0.11.4.0
- casa-client-0.0.1
- casa-types-0.0.2
- case-insensitive-1.2.1.0
- cereal-0.5.8.3
- clock-0.8.4
- colour-2.3.6
- comonad-5.0.8
- companion-0.1.0
- conduit-1.3.5
- conduit-combinators-1.3.0
- conduit-extra-1.3.6
- containers-0.6.7
- contravariant-1.5.5
- cookie-0.4.6
- cryptohash-sha256-0.11.102.1
- crypton-0.33
- crypton-connection-0.3.1
- crypton-x509-1.7.6
- crypton-x509-store-1.6.9
- crypton-x509-system-1.6.7
- crypton-x509-validation-1.6.12
- cryptonite-0.30
- cryptonite-conduit-0.2.2
- data-default-class-0.1.2.0
- data-fix-0.3.2
- deepseq-1.4.8.1
- digest-0.0.1.7
- directory-1.3.8.1
- distributive-0.6.2.1
- dlist-1.0
- easy-file-0.2.5
- echo-0.1.4
- ed25519-0.0.5.0
- exceptions-0.10.7
- extra-1.7.14
- fast-logger-3.2.2
- file-embed-0.0.15.0
- filelock-0.1.1.7
- filepath-1.4.100.1
- fsnotify-0.4.1.0
- generic-deriving-1.14.4
- generically-0.1.1
- ghc-bignum-1.3
- ghc-boot-th-9.6.2
- ghc-prim-0.10.0
- githash-0.1.7.0
- hackage-security-0.6.2.3
- hashable-1.4.3.0
- hi-file-parser-0.1.4.0
- hinotify-0.4.1
- hourglass-0.2.12
- hpack-0.35.3
- hpc-0.6.2.0
- http-api-data-0.5.1
- http-client-0.7.13.1
- http-client-tls-0.3.6.2
- http-conduit-2.3.8.3
- http-download-0.2.0.0
- http-types-0.12.3
- indexed-traversable-0.1.2.1
- indexed-traversable-instances-0.1.1.2
- infer-license-0.2.0
- integer-gmp-1.1
- integer-logarithms-1.0.3.1
- iproute-1.7.12
- libyaml-0.1.2
- lift-type-0.1.1.1
- lifted-base-0.2.3.12
- lukko-0.1.1.3
- megaparsec-9.4.1
- memory-0.18.0
- microlens-0.4.13.1
- microlens-mtl-0.2.0.3
- microlens-th-0.4.3.13
- mime-types-0.1.1.0
- monad-control-1.0.3.1
- monad-logger-0.3.40
- monad-loops-0.4.3
- mono-traversable-1.0.15.3
- mtl-2.3.1
- mtl-compat-0.2.2
- mustache-2.4.2
- neat-interpolation-0.5.1.3
- network-3.1.4.0
- network-uri-2.6.4.2
- old-locale-1.0.0.7
- old-time-1.1.0.3
- open-browser-0.2.1.0
- optparse-applicative-0.18.1.0
- optparse-simple-0.1.1.4
- pantry-0.9.1
- pantry-0.9.1
- parsec-3.1.16.1
- parser-combinators-1.3.0
- path-0.9.2
- path-io-1.8.1
- path-pieces-0.2.1
- pem-0.2.4
- persistent-2.14.5.1
- persistent-sqlite-2.13.1.1
- persistent-template-2.12.0.0
- pretty-1.1.3.6
- prettyprinter-1.7.1
- prettyprinter-ansi-terminal-1.1.3
- primitive-0.8.0.0
- process-1.6.17.0
- project-template-0.2.1.0
- random-1.2.1.1
- resource-pool-0.4.0.0
- resourcet-1.3.0
- retry-0.9.3.1
- rio-0.1.22.0
- rio-orphans-0.1.2.0
- rio-prettyprint-0.1.4.0
- rts-1.0.2
- safe-exceptions-0.1.7.4
- scientific-0.3.7.0
- semialign-1.3
- semigroupoids-6.0.0.1
- silently-1.2.5.3
- socks-0.6.1
- split-0.2.3.5
- splitmix-0.1.0.4
- static-bytes-0.1.0
- stm-2.5.1.0
- stm-chans-3.0.0.9
- streaming-commons-0.2.2.6
- strict-0.5
- tagged-0.8.7
- tar-0.5.1.1
- tar-conduit-0.3.2.1
- template-haskell-2.20.0.0
- temporary-1.3
- text-2.0.2
- text-metrics-0.3.2
- text-short-0.1.5
- th-abstraction-0.5.0.0
- th-compat-0.1.4
- th-lift-0.8.4
- th-lift-instances-0.1.20
- these-1.2
- time-1.12.2
- time-compat-1.9.6.1
- tls-1.7.1
- transformers-0.6.1.0
- transformers-base-0.4.6
- transformers-compat-0.7.2
- typed-process-0.2.11.0
- unix-2.8.1.0
- unix-compat-0.7
- unix-time-0.4.10
- unliftio-0.2.25.0
- unliftio-core-0.2.1.0
- unordered-containers-0.2.19.1
- uuid-types-1.0.5
- vault-0.3.1.5
- vector-0.13.0.0
- vector-algorithms-0.9.0.1
- vector-stream-0.1.0.0
- witherable-0.4.2
- yaml-0.11.11.2
- zip-archive-0.4.3
- zlib-0.6.3.0

Warning: this is an unsupported build that may use different versions of
dependencies and GHC than the officially released binaries, and therefore may
not behave identically.  If you encounter problems, please try the latest
official build by running 'stack upgrade --force-download'.
# file ./.stack-work/docker/_home/.local/bin/stack
./.stack-work/docker/_home/.local/bin/stack: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, stripped
# ldd ./.stack-work/docker/_home/.local/bin/stack
	not a dynamic executable

QED

@benz0li
Copy link
Contributor

benz0li commented Aug 15, 2023

Historically, I never had any success using the musl build released by GHC team as it used to segfault with the stack code.

That is why glcr.b-data.ch/ghc/ghc-musl exists.

Stack should build just fine with glcr.b-data.ch/ghc/ghc-musl:9.4.6 and glcr.b-data.ch/ghc/ghc-musl:9.2.8, too.

@psibi
Copy link
Member

psibi commented Aug 15, 2023

Nice work!

@benz0li
Copy link
Contributor

benz0li commented Aug 18, 2023

The motivation for this is that while the Alpine Linux versions of GHC 9.4.x are broken (see #6161), it is not possible to move Stack on from the GHC 9.2.x series,

P.S.: The glcr.b-data.ch/ghc/ghc-musl:9.4.x images are fine. But only glcr.b-data.ch/ghc/ghc-musl:9.4.6 includes an unofficial, statically linked binary at /usr/local/bin/stack (v2.11.1).

because the statically-linked bindists for Stack for Linux/x86_64 are built on Alpine Linux.

@mpilgrem Because they are multi-arch (linux/amd64, linux/arm64/v8), the glcr.b-data.ch/ghc/ghc-musl images (tags 9.6.2, 9.4.6 and 9.2.8) can be used to build the statically linked bindists of Stack for both Linux/x86_64 and Linux/AArch64.

Cross references:

@mpilgrem
Copy link
Member Author

@benz0li, many thanks. I am going to address 'official' statically-linked Linux/Aarch64 Stack as a separate step.

@mpilgrem mpilgrem merged commit 459dd7e into master Aug 18, 2023
@mpilgrem mpilgrem deleted the ghc-9.2.8 branch August 18, 2023 21:17
@benz0li benz0li mentioned this pull request Aug 21, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants