Build GMP for iOS

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

+6
source share
2 answers

As rob said, I will answer my question and accept the answer. I am new to this, so if there is an easier way to forgive me, I succeeded.

To create GMP for iphone, you must build three libraries from the command line three times. Build the architecture of armv6, armv7 and i386. To avoid problems with xcode, make sure you add -DO_ASM to CPPFLAGS. When you have three .a files, add them to one library.

Now you can add the library created with lipo in xcode and include the headers, now you have GMP working for iphone development.

Hope this helps. I spent a couple of days trying to figure it out.

+6
source

You can be inspired by this bash script for OpenSSL and adapt it for GMP. It uses the standard configure script and replaces CC and CFLAGS with perl.

0
source

Source: https://habr.com/ru/post/909720/


All Articles