Template haskell compilation fails on JS backend
Summary
ghc-9.8.2 with JS backend fails to compile some packages (specifically, patch), in TH code generation. It either fails or hangs.
Steps to reproduce
nix shell 'github:nixOS/nixpkgs/655a58a72a6601292512670343087c2d75d859c1#pkgsCross.ghcjs.haskell.packages.ghc98.patch'
It either hangs (the nodejs process stays running without cpu consumption), or fails with the following errors:
[ 4 of 12] Compiling Data.Patch.IntMap ( src/Data/Patch/IntMap.hs, dist/build/Data/Patch/IntMap.o )
src/Data/Patch/IntMap.hs:1:1: error: [GHC-87897]
Exception when trying to run compile-time code:
External interpreter terminated (-15)
Code: makeWrapped ''PatchIntMap
|
1 | {-# LANGUAGE CPP #-}
| ^
[ 5 of 12] Compiling Data.Patch.Map ( src/Data/Patch/Map.hs, dist/build/Data/Patch/Map.o )
src/Data/Patch/Map.hs:1:1: error: [GHC-87897]
Exception when trying to run compile-time code:
External interpreter terminated (-15)
Code: makeWrapped ''PatchMap
|
1 | {-# LANGUAGE CPP #-}
| ^
[ 7 of 12] Compiling Data.Patch.MapWithPatchingMove ( src/Data/Patch/MapWithPatchingMove.hs, dist/build/Data/Patch/MapWithPatchingMove.o )
src/Data/Patch/MapWithPatchingMove.hs:1:1: error: [GHC-87897]
Exception when trying to run compile-time code:
getTHMessage: unknown message 40
CallStack (from HasCallStack):
error, called at libraries/ghci/GHCi/Message.hs:316:10 in ghci-9.8.2-inplace:GHCi.Message
Code: makeWrapped ''PatchMapWithPatchingMove
|
1 | {-# LANGUAGE CPP #-}
| ^
[10 of 12] Compiling Data.Semigroup.Additive ( src/Data/Semigroup/Additive.hs, dist/build/Data/Semigroup/Additive.o )
Expected behavior
The code should compile
Environment
- GHC version used: 9.8.2
Optional:
- Operating System: Linux, NixOS
- System Architecture: x86_64, JS backend
Edited by Slava Gorbunov