"unknown symbol" arising from hs-boot file
Summary
When building my fir library, I sometimes run into issues with unknown symbol
which seem to arise from hs-boot
files.
Description
Here's one instance of the problem. The library includes the following:
FIR.ProgramState.hs-boot
module FIR.ProgramState where
data ProgramState
FIR.AST.Type
module FIR.AST.Type where
[...]
import {-# SOURCE #-} FIR.ProgramState
( ProgramState )
[...]
This seems to occasionally cause problems of the following sort:
ghc.exe: | dist-newstyle\build\x86_64-windows\ghc-8.10.3\fir-0.0.1.0\build\FIR\AST\Type.o: unknown symbol `firzm0zi0zi1zi0zminplace_FIRziProgramState_zdtcProgramState_closure'
ghc.exe: Could not load Object Code dist-newstyle\build\x86_64-windows\ghc-8.10.3\fir-0.0.1.0\build\FIR\AST\Type.o.
Here GHC is complaining that the module FIR.AST.Type
can't find FIR.ProgramState_$tcProgramState_closure
, which I assume refers to the type constructor ProgramState
.
Steps to reproduce
Unfortunately I don't have a reliable reproducer, but compiling the library from scratch
git clone https://gitlab.com/sheaf/fir
cd fir
cabal build fir
seems to run into the issue more frequently than when re-building.
I think this might be caused by the fact that the components in the module dependency graph containing these hs-boot
files end up being rather large, of the order of ~ 40 modules (I don't know how to measure it precisely), which somehow trips up the Windows linker code? But this is a complete stab in the dark on my part.
Does anyone have advice about how to go about reproducing this issue? I'm thinking I could write code to generate some large modules, with recursive imports that create large components, to deliberately cause this issue to occur. Any ideas?
Environment
The above error arose from GHC 8.10.3, although I've been seeing this error on GHC 8.8 and previous 8.10 release too. This is on Windows 10 x64.