fix(build): route TH to ghc-iserv-dyn to bypass truncated libHSghc.a
Root cause: libHSghc-9.10.3-5702.a (287,768,576 bytes) has its last AR entry (Expr.o) claiming 517,544 bytes but only 82,258 bytes remain — the archive is truncated. GHC's internal readAr (Data.Binary.Get) panics at position 287,686,318 when it tries to read the full claimed size. The truncated .a is read lazily: IHP's TH splices queue a dependency on the ghc package, which flushes to readAr after all 477 modules compile. This explains the invariant crash at [477 of 477] WidgetVersionInclude. ghc-iserv-dyn is not exposed in ghc-with-packages/bin/ (why -fexternal-interpreter alone silently fell back to the internal linker). Use -pgmi with the absolute path in the unwrapped GHC store to force iserv-dyn, which uses dlopen on libHSghc.so (intact, 110 MB) instead of readAr on the truncated .a. No crash. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
accfec84ec
commit
11ff61c1ba
1 changed files with 12 additions and 0 deletions
12
flake.nix
12
flake.nix
|
|
@ -127,6 +127,18 @@
|
|||
"--disable-split-sections"
|
||||
"--ghc-option=-j1"
|
||||
"--disable-shared"
|
||||
# GHC 9.10.3 bug: libHSghc-9.10.3-5702.a is truncated (last AR
|
||||
# entry Expr.o claims 517544 bytes but only 82258 remain).
|
||||
# GHC's internal static linker (readAr via Data.Binary.Get) panics
|
||||
# after all 477 modules compile when it flushes deferred symbol
|
||||
# loads from IHP's TH splices that transitively need the ghc pkg.
|
||||
# Fix: delegate TH evaluation to ghc-iserv-dyn, which uses dlopen
|
||||
# on libHSghc.so (intact) instead of readAr on the truncated .a.
|
||||
# ghc-iserv-dyn is not in ghc-with-packages/bin/, so use -pgmi
|
||||
# with the absolute path in the unwrapped GHC store path.
|
||||
"--ghc-option=-fexternal-interpreter"
|
||||
"--ghc-option=-pgmi"
|
||||
"--ghc-option=${hprev.ghc}/lib/ghc-9.10.3/bin/ghc-iserv-dyn"
|
||||
];
|
||||
postUnpack = (old.postUnpack or "") + ''
|
||||
_actual="$sourceRoot/build/Generated/ActualTypes.hs"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue