0

Im trying to compile gmp 6.0.0 for armv7s and iphone simulator (i386) on my Macbook but i just cant get it to work. i read some related questions (Build GMP for iOS, Building a C library (GMP) for arm64 iOS) and configured it with:

./configure \
CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -Wno-error -Wno-implicit-function-declaration" \
CPP="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -E" \
CPPFLAGS="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/ -miphoneos-version-min=7.0" \
--host=arm-apple-darwin --disable-assembly

Configuring works fine but when i run make it fails with:

clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
div_qr_1n_pi1.c:218:3: error: expected ')'
  add_mssaaaa (u2, u1, u0, u0, up[n-2], p1, p0);
  ^
div_qr_1n_pi1.c:140:49: note: expanded from macro 'add_mssaaaa'
           : "r" (ah), "rI" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
                                                       ^
div_qr_1n_pi1.c:218:3: note: to match this '('
div_qr_1n_pi1.c:135:11: note: expanded from macro 'add_mssaaaa'
  __asm__ (  "adds      %2, %5, %6\n\t"                                 \
          ^
div_qr_1n_pi1.c:256:7: error: expected ')'
      add_mssaaaa (u2, u1, u0, u0, up[j], p1, p0);
      ^
div_qr_1n_pi1.c:140:49: note: expanded from macro 'add_mssaaaa'
           : "r" (ah), "rI" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
                                                       ^
div_qr_1n_pi1.c:256:7: note: to match this '('
div_qr_1n_pi1.c:135:11: note: expanded from macro 'add_mssaaaa'
  __asm__ (  "adds      %2, %5, %6\n\t"                                 \
          ^
2 errors generated.
make[2]: *** [div_qr_1n_pi1.lo] Error 1
make[1]: *** [all-recursive] Error 1

i dont know what to do next, would be great if someone could give me a hint what to try next.

EDIT 1:

i downloaded the latest snapshot, added -no-integrated-as to the cppflags and changed clang++ to clang. configure still runs fine bit as soon as i make, i get the error:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang `test -f 'gen-fac.c' || echo './'`gen-fac.c -o gen-fac
gen-fac.c:31:10: fatal error: 'stdio.h' file not found
#include <stdio.h>

Regards

Community
  • 1
  • 1
  • See: [Compiling x264 for iOS](http://stackoverflow.com/questions/19027157/compiling-x264-for-ios-7), with the flag `-no-integrated-as`. Although your error messages makes it look like some sort of C++ namespace issue. It would probably help to show the definition of the `add_mssaaaa` macro. – artless noise Apr 25 '14 at 18:19
  • 2
    Why are you using the C++ compiler for C code? – unixsmurf Apr 25 '14 at 18:31
  • First thing to try, after replacing `clang++` with just `clang`, is to get the latest snapshot from: https://gmplib.org/download/snapshot/ in case some changes have already been made that help. – Marc Glisse Apr 25 '14 at 19:11

1 Answers1

1

I finally got it working. i reinstalled the xcode command line tools and configured it like this:

./configure \
CC="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" \
CFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/ -Wno-error -Wno-implicit-function-declaration -miphoneos-version-min=7.0  -no-integrated-as -arch armv7s \
--host=arm-apple-darwin --disable-assembly --enable-static --disable-shared"

same for the simulator(i386) and used lipo to merge them.

There are 3 placeholders here :

  • iPhoneOS7.1.sdk which can be whatever your current SDK is.
  • 7.0 The min version of the OS you're trying to compile the library for.
  • armv7s which could be also armv7, arm64, i386.
Vaseltior
  • 1,226
  • 15
  • 27
  • There's something wrong with that line. As copy pasted it passes the --host=arm-apple-darwin etc to clang (which chokes on them) rather than to the configure. I'm getting a `configure: error: could not find a working compiler, see config.log for details` which are errors such as `clang: error: unsupported option '--host=arm-apple-darwin'` – Teo Sartori Nov 14 '15 at 13:11
  • Moving the configure commands to the front seems to pass them correctly except it errors on something else. From config.log: `Unknown pseudo-op: .ios_version_min` – Teo Sartori Nov 14 '15 at 13:19