2014-04-25 75 views
0

我试图在我的Macbook上为armv7s和iphone模拟器(i386)编译gmp 6.0.0,但是我不能让它工作。我读了一些相关的问题(Build GMP for iOSBuilding a C library (GMP) for arm64 iOS),并配置它:为ios 7 armv7s编译GMP

./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 

配置工作正常,但是当我运行使它失败:

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 

我不知道下一步该怎么做,会如果有人能够给我一个提示接下来要做什么的话,那就太好了。

EDIT 1:

我下载最新的快照,加入-no集成-作为对CPPFLAGS和改变铛++到铛。配置还是只要我让运行正常位,我得到的错误:

/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> 

问候

+0

请参见:[编译x264 for iOS](http://stackoverflow.com/questions/19027157/compiling-x264-for-ios-7),标记为'-no-integrated-as'。尽管你的错误信息使得它看起来像某种C++命名空间问题。这可能有助于显示'add_mssaaaa'宏的定义。 –

+2

为什么使用C++编译器来编写C代码? – unixsmurf

+0

首先要尝试的是,在用'clang'替换'clang ++'后,要从https://gmplib.org/download/snapshot/获取​​最新的快照,以防已经做出某些更改。 –

回答

1

我终于得到了它的工作。我重新安装xcode的命令行工具和其配置是这样的:

./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" 

相同的模拟器(I386),并用于脂合并它们。

有3个占位符的位置:

  • iPhoneOS7.1.sdk它可以是任何你当前的SDK。
  • 7.0您尝试编译库的最小版本的操作系统。
  • armv7s这也可以是armv7arm64,i386
+0

该行有问题。当复制粘贴时,它将--host = arm-apple-darwin等传递给clang(对它们进行扼流)而不是配置。我得到一个'configure:error:找不到工作的编译器,请参阅config.log的详细信息,这些错误是'clang:error:unsupported option'--host = arm-apple-darwin''错误 –

+0

正在移动前面的配置命令似乎正确地传递了它们,除了它在其他方面的错误。从config.log:'未知的伪操作:.ios_version_min' –