I need to use GMP
in the iphone program I'm working on, but don't know where to start. I know that I need to create a version for the device and a version for the simulator, but as far as I know. I tried to look back, but could not find much.
Can anyone here successfully create GMP
for iphone
that will help me in this process?
I have seen Building GMP for iOS , but it does not work for me. I thought I 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 complete the installation.
In /usr/local/lib
I have libgmp.a
. But when I drag it to xcode
, when I am going 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)
(for some reason, I lost my desktop and then dragged it into the xcode project)
It drives me crazy. Can anyone help? Keep in mind that I'm a complete noob using these tools.
Assuming I get help, and I can do the job. How can I turn it into a structure that will work with armv6
, armv7
and simulator(i386)
?
Thanks in advance.
Dan
UPDATE: If anyone else has a problem, here's how I solved it.
The first cross-compilation of GMP 3 times, installing architectures in armv6. armv7 and i386 respectively. When creating weapon versions, add the -DNO_ASM flag to CPPFLAGS.
Locate the lipo three .a files together
Import the .a file into Xcode with gmp.g and gmpgxx.h.
Done
source share