根据文献,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应用程序链接起来有什么魔力吗?
答案 0 :(得分:1)
来自Xcode mailing list的Jim Grosbach,链接器开关-allow_sub_type_mismatches
应允许ld
继续进行链接。来自Apple的ld
man pages:
-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 entry详细说明了名为LD_ALLOW_CPU_SUBTYPE_MISMATCHES
的环境变量。
但是,我发现-allow_sub_type_mismatches
根本无法在Xcode 4.5.2上运行。浏览网页会显示-allow_sub_type_mismatches
的一些Apple RADAR。例如,参见radar:// 6134468。
希望它现在已经解决了,但是当谈到Apple及其有缺陷的软件时,没什么好惊讶的。