building ghc-8.4.2 from source: undefined reference to 'mpz_powm_sec'

Dear Cafe, I am getting this when building ghc-8.4.2 from source, with ghc-8.2.2: ghc-8.4.2/libraries/integer-gmp/dist-install/build/libHSinteger-gmp-1.0.2.0_p.a(wrappers.p_o):wrappers.c:function integer_gmp_powm_sec: error: undefined reference to 'mpz_powm_sec' collect2: error: ld returned 1 exit status `gcc' failed in phase `Linker'. (Exit code: 1) make[1]: *** [iserv/ghc.mk:104: iserv/stage2_p/build/tmp/ghc-iserv-prof] Error 1 This may be due to some mis-config on my part, because I'm getting this on one machine only, and it works on others. Still, perhaps you have seen this before, and could help me with an educated guess on what may have caused this. It is especially puzzling because this install of ghc-8.2.2 seems to work perfectly fine for all of my projects. Thanks - J.W.

You can start by checking whether you have libgmp and whether it has the referenced symbol, e.g. on my machine, there's a /usr/lib64/libgmp.a, and I get this: $ nm /usr/lib64/libgmp.a | grep mpz_powm_sec 0000000000000000 T __gmpz_powm_sec I'm not sure what the relationship is between __gmpz_powm_sec and mpz_powm_sec, though it may be just some naming convention. Without knowing much about various versions of GHC or libgmp, I think it's possible that newer GHC requires newer libgmp that has this symbol and you have an older libgmp. Josh On Fri, Apr 20, 2018 at 3:31 PM, Johannes Waldmann < johannes.waldmann@htwk-leipzig.de> wrote:
Dear Cafe,
I am getting this when building ghc-8.4.2 from source, with ghc-8.2.2:
ghc-8.4.2/libraries/integer-gmp/dist-install/build/ libHSinteger-gmp-1.0.2.0_p.a(wrappers.p_o):wrappers.c:function integer_gmp_powm_sec: error: undefined reference to 'mpz_powm_sec' collect2: error: ld returned 1 exit status `gcc' failed in phase `Linker'. (Exit code: 1) make[1]: *** [iserv/ghc.mk:104: iserv/stage2_p/build/tmp/ghc-iserv-prof] Error 1
This may be due to some mis-config on my part, because I'm getting this on one machine only, and it works on others.
Still, perhaps you have seen this before, and could help me with an educated guess on what may have caused this.
It is especially puzzling because this install of ghc-8.2.2 seems to work perfectly fine for all of my projects.
Thanks - J.W. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

Hi
You can start by checking whether you have libgmp
ah yes, I was missing the "gmp-static" package (on Fedora) so the compilation picked up some other gmp version installed someplace else. (Worse, since I had "gmp-devel", I think it picked the .so from one place, and .a from another.) Thanks, and sorry for the noise. - J.W.
participants (2)
-
Johannes Waldmann
-
☂Josh Chia (謝任中)