2012-12-29 57 views
1

根據文獻資料,A6處理器將執行ARMv7代碼。我的項目在鏈接上失敗,因爲庫是爲ARMv7構建的,但該應用程序是爲ARMv7構建的。將ARMv7庫鏈接到ARMv7s app

典型的消息是(當我附上我的iPad 4(視網膜)或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)去除ARMv7s解決這個問題,但我不知道爲什麼因爲A6處理器可以執行A5目標代碼。或者我可以爲ARMv7s架構執行額外的庫構建,但這是更多的工作,並且需要不同的磁盤目錄結構。

將ARMv7庫與ARMv7s應用程序鏈接起來有什麼魔力嗎?

+1

我想你的lib是爲(armv6&armv7)和主要項目編譯(armv7&armv7s)..只是用(armv7&armv7s)替換lib ...問題解決...! – Guru

+1

處理器能夠執行向後兼容的代碼並不意味着鏈接器也可以處理生成的代碼的所有版本。重新編譯用於armv7s的「FIPS」庫,或禁用armv7s。 – 2012-12-29 08:02:14

+0

謝謝@Raj - 不,我建立了一個庫 - ARMv7(不是ARMv6和ARMv7)。它是使用iPhoneOS6.0 SDK構建的。 – jww

回答

1

從吉姆格羅斯巴赫的Xcode mailing list,鏈接器開關-allow_sub_type_mismatches應允許ld繼續進行鏈接。而從蘋果的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上使用。對網絡進行清理顯示了一些Apple RADAR的-allow_sub_type_mismatches。例如,參見雷達:// 6134468。

希望它現在已經固定下來,但是對於蘋果及其有缺陷的軟件來說,沒有什麼讓我驚訝的。