1

根据文献,A6 处理器将执行 ARMv7 代码。我的项目链接失败,因为为 ARMv7 构建了一个库,但该应用程序是为 ARMv7s 构建的。

一条典型的消息是(当我连接 iPad 4 (Retina) 或 iPhone 5 时):

ld: warning: ignoring file /usr/local/ssl/iphoneos/lib//fipscanister.o, file was built for armv7 which is not the architecture being linked (armv7s): /usr/local/ssl/iphoneos/lib//fipscanister.o
ld: warning: ignoring file /usr/local/ssl/iphoneos/lib//libcrypto.a, file was built for archive which is not the architecture being linked (armv7s): /usr/local/ssl/iphoneos/lib//libcrypto.a

Undefined symbols for architecture armv7s:
  "_FIPS_incore_fingerprint", referenced from:
      _FINGERPRINT_premain in fips_premain.o
  "_FIPS_signature", referenced from:
      _FINGERPRINT_premain in fips_premain.o
  "_FIPS_text_start", referenced from:
      _FINGERPRINT_premain in fips_premain.o
ld: symbol(s) not found for architecture armv7s

我知道我可以通过从有效架构 (VALID_ARCHS) 中删除 ARMv7 来解决这个问题,但我不确定为什么,因为 A6 处理器可以执行 A5 目标代码。或者我可以为 ARMv7s 架构执行额外的库构建,但这需要更多的工作并且需要不同的磁盘目录结构。

将 ARMv7 库与 ARMv7s 应用程序链接起来有什么魔力吗?

4

1 回答 1

1

来自Xcode 邮件列表上的 Jim Grosbach的链接器开关-allow_sub_type_mismatches应该允许ld继续进行链接。并且来自 Apple 的ld手册页

 -allow_sub_type_mismatches
             Normally the linker considers different cpu-subtype for ARM
             (e.g. armv4t and armv6) to be different different architec-
             tures that cannot be mixed at build time.  This option
             relaxes that requirement, allowing you to mix object files
             compiled for different ARM subtypes.

还有一个Changelog 条目详细说明了名为LD_ALLOW_CPU_SUBTYPE_MISMATCHES.

但是,我发现-allow_sub_type_mismatches根本不适用于 Xcode 4.5.2。Grepping web 揭示了一些 Apple RADAR 的-allow_sub_type_mismatches. 例如,参见radar://6134468。

希望它现在已修复,但对于 Apple 及其有缺陷的软件,没有什么让我感到惊讶的。

于 2013-01-25T00:36:54.813 回答