`typecheckModule` from GHC API crashes on MacOS for files with TH
I believe this is the same issue that is causing manually built haddock and doctest to crash on MacOS when fed TH (originally reported https://github.com/haskell/haddock/issues/767 and https://github.com/sol/doctest/issues/199).
I've attached a minimal program that uses the GHC API and exhibits the same problem.
$ ghc-8.4.2 -package ghc -package containers -package ghc-paths Prog.hs
[1 of 1] Compiling Main ( Prog.hs, Prog.o )
Linking Prog ...
$ ./Prog Main-no-TH.hs -package template-haskell
$ ./Prog Main-TH.hs -package template-haskell
Prog:
lookupSymbol failed in relocateSection (RELOC_GOT)
/usr/local/lib/ghc-8.4.2/integer-gmp-1.0.2.0/HSinteger-gmp-1.0.2.0.o: unknown symbol `___gmp_rands'
Prog: Prog: unable to load package `integer-gmp-1.0.2.0'
In case it isn't clear, I do not expect Main-TH.hs to crash Prog.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.4.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | GHC API |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |