Building gmp library for the iPhone-Update

Torbjorn Granlund tg at
Thu Jul 16 11:06:37 CEST 2009

Pierre-Henri Jondot <mpkju at> writes:

  Following some of the advice in
  I managed to get a bit further in the building of gmp. (At least I got
  past the configure step...)
And surely, you read the GMP manual's section on cross compiling?

  I tried two configurations, one for iPhoneOS 2.2 (gcc 4.0.1)
  and one targetting iPhone OS 3.0. (gcc 4.2.1)
  In both cases, build fails with at the same spot (here for OS 3.0)
  with :
  darwin9-gcc-4.2.1 -c -DHAVE_CONFIG_H -I. -I. -I.. -D__GMP_WITHIN_GMP - 
  I.. -DOPERATION_invert_limb -I/Developer/Platforms/iPhoneOS.platform/
  include/ -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
  iPhoneOS3.0.sdk/usr/include/ -I/Developer/Platforms/iPhoneOS.platform/
  include/ -I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
  iPhoneOS3.0.sdk/usr/include/ -pipe -no-cpp-precomp -isysroot /
  tmp-invert_limb.s -o invert_limb.o
  tmp-invert_limb.s:56:unsupported relocation on symbol invtab
  tmp-invert_limb.s:56:FATAL:Internal error: incorrect fx_r_type (17)
  for fx_subsy != 0 in fix_to_relocation_info()
  make[2]: *** [invert_limb.lo] Error 1
  make[1]: *** [all-recursive] Error 1
  make: *** [all] Error 2
If you now point GMP's build system to the right set of tools (as told
in the GMP manual, or from some independent web page) and presumably
have gotten the right assembly code chosen, then all that remains is to
port GMP to the Iphone.

Apple has its own ideas--inspired by the 1980'ies object file formats
and relocations--on how to handle assembly code.  The result is that one
cannot rely on current features for assembly-time constant folding
or efficient handling of shared library relocs.

I don't know if things are documented somewhere, but even if they are,
it is usually easier to explore a compiler's output for the type of
things we're trying to do, rather than wading through documentation.

I neither have time nor hardware access to do this port.  But since you
are an Iphone developer, why don't you port GMP to the Iphone?


More information about the gmp-discuss mailing list