[Haskell-cafe] building ghc-8.4.2 from source: undefined reference to 'mpz_powm_sec'

☂Josh Chia (謝任中) joshchia at gmail.com
Fri Apr 20 09:36:44 UTC 2018

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.


On Fri, Apr 20, 2018 at 3:31 PM, Johannes Waldmann <
johannes.waldmann at 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-
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180420/cca4f2d3/attachment.html>

More information about the Haskell-Cafe mailing list