hsc2hs doesn't work when using constructors in ghc-prim
- Dominant language
- Haskell
- Stars
- 46
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
When using both `hsc2hs` and something from `ghc-prim` (in my case, I can trigger this by matching on any of the `Word*` or `Int*`) constructors, my compilation fails.
Output from stack (also occurs with cabal):
```
blademaster :: ~/git/ghc-prim-hsc-bug ‹main› » stack build
ghc-prim-hsc-bug> build (lib)
Preprocessing library for ghc-prim-hsc-bug-0.1.0.0..
linking .stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0/build/X_hsc_make.o failed (exit code 1)
rsp file was: ".stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0/build/hsc2hscall331714-2.rsp"
command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0/build/X_hsc_make.o .stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0/build/X_hsc_utils.o -o .stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0/build/X_hsc_make -fuse-ld=lld -fuse-ld=lld -L/home/googleson78/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/base-4.14.3.0 -Wl,-R,/home/googleson78/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/base-4.14.3.0 -L/home/googleson78/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/integer-gmp-1.0.3.0 -Wl,-R,/home/googleson78/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/integer-gmp-1.0.3.0 -lgmp -L/home/googleson78/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/ghc-prim-0.6.1 -Wl,-R,/home/googleson78/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/ghc-prim-0.6.1 -lc -lm -L/home/googleson78/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/rts -Wl,-R,/home/googleson78/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/rts -lm -lrt -ldl -lpthread
error: ld.lld: error: undefined symbol: hsc__
>>> referenced by X_hsc_make.c
>>> .stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0/build/X_hsc_make.o:(main)
collect2: error: ld returned 1 exit status
-- While building package ghc-prim-hsc-bug-0.1.0.0 (scroll up to its section to see the error) using:
/home/googleson78/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.7 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.2.1.0 build lib:ghc-prim-hsc-bug --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
```
Here's a reproducer:
https://github.com/googleson78/ghc-prim-hsc-bug
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.