I need to use GMP
in an iphone program I'm working on, but don't really know where to begin. I know that I have to build a version for the device and a version for the simulator, but that is as much as I know. I've tried looking around but haven't been able to find much.
Has anyone here successfully build GMP
for iphone
that would care to guide me through the process?
I saw Building GMP for iOS but it is not working for me. I thought I had built it successfully using:
./configure CC="/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2" CXX="/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-g++-4.2" CPP="/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -E" LD="$IOS/usr/bin/ld" CPPFLAGS="-arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -miphoneos-version-min=4.2" AR="$IOS/usr/bin/ar" NM="$IOS/usr/bin/nm" NMEDIT="$IOS/usr/bin/nmedit" LIBTOOL="$IOS/usr/bin/libtool" LIPO="$IOS/usr/bin/lipo" OTOOL="$IOS/usr/bin/otool" RANLIB="$IOS/usr/bin/ranlib" STRIP="$IOS/usr/bin/strip" --disable-shared --enable-static --prefix=$IOS/usr/local --host=none-apple-darwin10
Then make install.
In /usr/local/lib
I have libgmp.a
. But when I drag to to xcode
when I go to compile it tells me:
ignoring file /Users/daniel/Desktop/libgmp.a, file was built for archive which is not the architecture being linked (armv7)
(I dropped in my desktop for some reason, then dragged to into my xcode project)
This is driving me nuts. Can anyone help? Bear in mind I'm a complete noob using the these tools.
Assuming I get help and I can make this work. How do I go about turning it into a framework that will work on an armv6
, armv7
, and simulator(i386)
?
Thanks in advance.
Dan
UPDATE: Should anyone else have the problem here is how I solved it.
First cross compile GMP 3 times, setting the architectures to armv6. armv7, and i386 respectively. When building the arm versions add the flag -DNO_ASM to CPPFLAGS.
Find LIPO the three .a files together
Import .a file to XCode with gmp.g and gmpgxx.h.
Done