Hi everyone !
I’ve just installed GHC and Exercism locally on Fedora 38 (Linux 6.2), and stack test
fails in hello-world and other exercises.
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.7
$ stack --version
Version 2.9.3, Git revision 6cf638947a863f49857f9cfbf72a38a48b183e7e x86_64 hpack-0.35.1
$ gcc --version
gcc (GCC) 13.0.1 20230401 (Red Hat 13.0.1-0)
...
Found a similar (closed) issue here : `stack test` fails in hello world project · Issue #845 · exercism/haskell · GitHub
I tried stack --resolver lts-14.6 test
as suggested and it didn’t work.
Any idea how to fix this ?
Thanks !
Here is the error (had to remove a few lines in the middle cause it made this post too long to be created, hence the [...]
) :
[user@fedora hello-world]$ stack test
Linking /home/user/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_SvXsv1f__3.4.1.0_ghc-9.0.2 ...
/usr/bin/ld.gold: error: cannot find -lgmp
/home/user/.ghcup/ghc/9.0.2/lib/ghc-9.0.2/ghc-bignum-1.1/libHSghc-bignum-1.1.a(BigNat.o):function ghczmbignum_GHCziNumziBigNat_bigNatMul_info: error: undefined reference to '__gmpn_mul'
[...]
/home/user/.ghcup/ghc/9.0.2/lib/ghc-9.0.2/ghc-bignum-1.1/libHSghc-bignum-1.1.a(gmp_wrappers.o):gmp_wrappers.c:function integer_gmp_mpn_tdiv_r: error: undefined reference to '__gmpn_tdiv_qr'
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
Error: [S-6374]
While building simple Setup.hs (scroll up to its section to see the
error) using:
/home/user/.ghcup/ghc/9.0.2/bin/ghc -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-3.4.1.0 /home/user/.stack/setup-exe-src/setup-SvXsv1f_.hs /home/user/.stack/setup-exe-src/setup-shim-SvXsv1f_.hs -o /home/user/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_SvXsv1f__3.4.1.0_ghc-9.0.2
Process exited with code: ExitFailure 1