I'm currently trying to compile GCC 4.9.2 using GCC 4.2. The problem I have run into is that I have a working GMP installation (6.0.0a) but GCC fails to link to it after a while. The error I get is:

Undefined reference to __gmpn_invert_limb

and then it shows some methods that use that function, although make check (on gmp) determined that this function is working fine.

Commands used:

./configure --prefix=/usr/local/lib/gcc --with-gmp=/prefix/path/of/gmp/configure

Any ideas?

PS: I also tried downloading the gmp source and putting it in gcc/gmp like I did with mpfr. Same result.


Typically in gmp's configure file if an os isn't provided it uses none by default, this, at least for ARM, caused the host_os and target_os alias' to be incorrect and led to the undefined references you refer to.

The way I fixed this for arm-linux-androideabi was changing both instances of

 - linux*android*)

 + linux-android*)

in gmp/configure. I'm not sure what your os or cpu is, but defining them in your configure command might help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.