Building gmp library for the iPhone-Update

Pierre-Henri Jondot mpkju at
Thu Jul 16 12:21:35 CEST 2009

Le 16 juil. 09 à 11:45, Torbjorn Granlund a écrit :

> Pierre-Henri Jondot <mpkju at> writes:
>  Trying to build a gmp library for arm without asm, I replaced arm-
>  apple-darwin host with none-apple-darwin (but keeping the arm cross-
>  compiler with CC flag) I could  build an arm library.
>  That said, I have been unable to build a simple test case, the link
>  stage failing with :
>  Undefined symbols:
>    "___gmpn_invert_limb", referenced from:
>        _mpn_mod_1_unnorm in libgmp.a(mod_1.o)
>        _mpn_mod_1_norm in libgmp.a(mod_1.o)
> Usually, a host cpu of "none" should pass -DNO_ASM.  If you look at  
> the
> compiler invokations, didn't that happen?  (The logic for -DNO_ASM  
> is in
> the configure script, you can locate it easily.)
> (Possibly, the cross-compilation motivated overriding of various
> parameters might have inhibited -DNO_ASM.)
> -- 
> Torbjörn


For some reason indeed, the -DNO_ASM was not there...

So I've added it to the configure invocation, which is now :
./configure CC="/Developer/Platforms/iPhoneOS.platform/Developer/usr/ 
bin/gcc-4.2" CPP="/Developer/Platforms/iPhoneOS.platform/Developer/usr/ 
bin/gcc-4.2 -E" LD="/Developer/Platforms/iPhoneOS.platform/Developer/ 
usr/bin/ld" CPPFLAGS="-arch armv6 -isysroot /Developer/Platforms/ 
iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk -miphoneos-version- 
min=3.0 -DNO_ASM" --disable-shared --enable-static --prefix=/Developer/ 
Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/local -- 

The library I obtained this way allowed me this time to build a simple  
test case and run it on an iphone.

I'll try to investigate a bit about the asm file that fails to build,  
but I know no arm asm (or no asm at all I should say) and so far I  
have not been able to find much documentation, or at all, about  
apple's compiler, so most probably "porting GMP to the iPhone" will be  
out of my league...



More information about the gmp-discuss mailing list