codeworld icon indicating copy to clipboard operation
codeworld copied to clipboard

[WIP] GHC 8.10.7

Open peterbecich opened this issue 4 years ago • 4 comments

There is an issue compiling codeworld-base:

$ cabal build codeworld-base
...
dist-newstyle/build/x86_64-linux/ghc-8.10.7/codeworld-base-0.2.0.0/build/Extras/Cw.dyn_o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.10.7:
        expectJust failed to detect OverLit
CallStack (from HasCallStack):
  error, called at compiler/utils/Maybes.hs:57:27 in ghc:Maybes
  expectJust, called at compiler/GHC/HsToCore/PmCheck.hs:551:16 in ghc:GHC.HsToCore.PmCheck

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

This appears to be an instance of https://gitlab.haskell.org/ghc/ghc/-/issues/18708

Cabal 3.6.1.0 GHC 8.10.7 Debian Bullseye

peterbecich avatar Sep 14 '21 06:09 peterbecich

Hmm, that's too bad. The good news, though, is that CodeWorld already builds its own patched version of GHCJS, if someone is willing to backport this fix. It doesn't look too difficult to do (it's a small patch!) But I haven't checked whether the surrounding code has changed much since 8.10.7

cdsmith avatar Sep 14 '21 22:09 cdsmith

Here is the backport; it solves the error: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6554

peterbecich avatar Sep 19 '21 01:09 peterbecich

Cool! I'm not sure whether there will be a new GHC release in the 8.x series, but if you make a patch (test case not necessary) and drop it in https://github.com/google/codeworld/tree/master/ghc-artifacts, and then apply the patch in install.sh near https://github.com/google/codeworld/blob/master/install.sh#L226, then CodeWorld will build with the change. That should unblock you.

Speaking of patches there, I wonder whether the remaining patches in that directory are still needed. The default main patch was contributed upstream, and has probably made it into GHC 8.10, but I'll verify that. The dedup fix for the linker was a GHCJS patch, and my hope is that it's also merged in the 8.10 branch. Again, I'll try to find evidence for this and report back.

cdsmith avatar Sep 19 '21 01:09 cdsmith

I've confirmed that the default main patch does NOT need to be ported. It's already part of GHC 8.10. Unfortunately, https://github.com/ghcjs/ghcjs/pull/788 still isn't merged, so this one needs to be ported forward. There have been changes to that file, so it's not immediately obvious to me how to do so, but @3noch or @tomsmalley may know.

cdsmith avatar Sep 19 '21 01:09 cdsmith