【问题标题】:Compiling GMP for ios 7 armv7s为 ios 7 armv7s 编译 GMP
【发布时间】:2014-04-25 13:13:29
【问题描述】:

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

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

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

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

我不知道下一步该做什么,如果有人能给我提示下一步该尝试什么,那就太好了。

编辑 1:

我下载了最新的快照,将 -no-integrated-as 添加到 cppflags 并将 clang++ 更改为 clang。配置仍然运行良好一点,我得到了错误:

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

问候

【问题讨论】:

  • 参见:Compiling x264 for iOS,带有标志-no-integrated-as。尽管您的错误消息使它看起来像是某种 C++ 命名空间问题。显示add_mssaaaa 宏的定义可能会有所帮助。
  • 你为什么使用 C++ 编译器来编译 C 代码?
  • 在将clang++ 替换为clang 之后,首先要尝试的是从gmplib.org/download/snapshot 获取最新快照,以防已经进行了一些有助于帮助的更改。

标签: ios arm gmp


【解决方案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)也是如此,并使用 lipo 来合并它们。

这里有 3 个占位符:

  • iPhoneOS7.1.sdk 可以是您当前的 SDK。
  • 7.0 您尝试为其编译库的操作系统的最低版本。
  • armv7s 也可以是 armv7arm64i386

【讨论】:

  • 那行有问题。复制粘贴时,它会将 --host=arm-apple-darwin 等传递给 clang(阻塞它们)而不是配置。我收到了 configure: error: could not find a working compiler, see config.log for details 错误,例如 clang: error: unsupported option '--host=arm-apple-darwin'
  • 将配置命令移到前面似乎可以正确传递它们,除非它在其他方面出错。来自 config.log:Unknown pseudo-op: .ios_version_min
猜你喜欢
  • 1970-01-01
  • 2013-10-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-30
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多