commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
3.95k stars 842 forks source link

Regression in 2.15.1: stack passes unknown flag `-no-keep-hi-files` to ghc 8.0 #6509

Closed andreasabel closed 4 months ago

andreasabel commented 4 months ago

Stack 2.15.1 passes -no-keep-hi-files to GHC 8.0, crashing it: https://github.com/debug-ito/staversion/actions/runs/8159145946/job/22302754180?pr=11#step:7:477

ghc: unrecognised flag: -no-keep-hi-files
did you mean one of:
  -keep-hc-files
unrecognised flag: -no-keep-o-files
did you mean one of:
  -keep-s-files

Usage: For basic information, try the `--help' option.

Error: [S-6374]
       While building simple Setup.hs (scroll up to its section to see the error) using:
       /usr/local/.ghcup/ghc/8.0.2/bin/ghc-8.0.2 -rtsopts -threaded 
-clear-package-db -global-package-db -hide-all-packages -package base 
-main-is StackSetupShim.mainOverride -package Cabal-1.24.2.0 
/home/runner/.stack/setup-exe-src/setup-6HauvNHV.hs 
/home/runner/.stack/setup-exe-src/setup-shim-6HauvNHV.hs 
-o /home/runner/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_6HauvNHV_1.24.2.0_ghc-8.0.2 
-no-keep-hi-files -no-keep-o-files

The flag -no-keep-hi-files has apparently only been added in GHC 8.2, according to the milestone in https://gitlab.haskell.org/ghc/ghc/-/issues/4114 .
Unfortunately, the GHC docs have no "since" info for flags, and the release notes for 8.2 do not mention this flag either.

andreasabel commented 4 months ago

Oh, this seems to be

I searched only the open issues...

Shouldn't closing this issue at least entail patch to Stack 2.15.1 so that it outright refuses to build with GHC 8.0 and lower?

Checking that it can handle the requested GHC is part of the "type checking" of a stack command so to say, and I would like a proper "type error" rather than a "crash at runtime". (After all we are strongly typed Haskellers...)

mpilgrem commented 4 months ago

Given your experience, I'll see if I can release a Stack 2.15.3 that fixes this soon.

mpilgrem commented 4 months ago

Closing as duplicate of #6498, which I have re-opened.