Cross-compiling GMP for Android

Mike Mohr akihana at
Mon Jan 10 19:40:29 CET 2011

Good morning,

I've been attempting to get GMP built using the Android NDK's
toolchain (  I think
part of the problem is that Google has built their toolchain with a
custom system type, "androideabi".  Here's what I've done so far:

$ cd gmp-5.0.1
$ autoreconf -sfi
(patch config.sub so it recognizes armeabi)
$ ./configure --host=arm-linux-androideabi

Everything seems to go well until I get this:

checking if globals are prefixed by underscore...
arm-linux-androideabi-nm: conftest.o: File format not recognized

followed by some warnings that autoconf can't determine the global
symbol or local label prefix.  Then a similar error:

checking how to define a 32-bit word... arm-linux-androideabi-nm:
conftest.o: File format not recognized
configure: error: cannot determine how to define a 32-bit word

and configure stops.  I've had a look at the autoconf files, and it
looks like the autogenerated test file is being compiled for the host
system (in my case, AMD64 Linux).  Unfortunately this involves some
relatively complex autoconf code which I have been unable to fix thus
far.  Autoconf does appear to correctly identify the arch as ARM, and
I suspect that this bug could be trivially fixed by the autoconf
maintainer at GMP.  Can someone comment?


More information about the gmp-bugs mailing list