为armv7上运行的iOS设备编译Boost c ++库

时间:2013-05-24 16:46:52

标签: iphone ios xcode ipad boost

我已经在armv6和armv7上为iPhone / iPad成功构建了boost c ++ 1_44_0库,但我似乎无法为armv7上运行的新设备创建构建。

在Github上使用BoostOnIphone和A-coding来创建构建,我需要的是Boost:armv7s架构上的线程,文件系统和系统库。

错误输出:

ld: warning: ignoring file /Users/shams/Documents/Sources/Hawk.framework/Release-iphonesimulator/libhawk-engine.a, file was built for archive which is not the architecture being linked (armv7s): /Users/shams/Documents/Sources/Hawk.framework/Release-iphonesimulator/libhawk-engine.ald: warning: 
ld: warning: ignoring file /Users/shams/Documents/Sources/Hawk.framework/Release-iphoneos/libhawk-engine.a, file was built for archive which is not the architecture being linked (armv7s): /Users/shams/Documents/Sources/Hawk.framework/Release-iphoneos/libhawk-engine.ald: warning: ignoring file /Users/shams/Documents/Sources/boost.framework/Release-iphonesimulator/libboost_filesystem.a, file was built for archive which is not the architecture being linked (armv7s): /Users/shams/Documents/Sources/boost.framework/Release-iphonesimulator/libboost_filesystem.a
ignoring file /Users/shams/Documents/Sources/boost.framework/Release-iphonesimulator/libboost_system.a, file was built for archive which is not the architecture being linked (armv7s): /Users/shams/Documents/Sources/boost.framework/Release-iphonesimulator/libboost_system.a

ld: warning: 
ld: warning: ignoring file /Users/shams/Documents/Sources/boost.framework/Release-iphonesimulator/libboost_thread.a, file was built for archive which is not the architecture being linked (armv7s): /Users/shams/Documents/Sources/boost.framework/Release-iphonesimulator/libboost_thread.ald: warning: ignoring file /Users/shams/Downloads/boostoniphone-master/build/armv7/libboost_filesystem.a, file was built for archive which is not the architecture being linked (armv7s): /Users/shams/Downloads/boostoniphone-master/build/armv7/libboost_filesystem.a

ignoring file /Users/shams/Downloads/boostoniphone-master/build/armv7/libboost_system.a, file was built for archive which is not the architecture being linked (armv7s): /Users/shams/Downloads/boostoniphone-master/build/armv7/libboost_system.a
ld: warning: 

ignoring file /Users/shams/Downloads/boostoniphone-master/build/armv7/libboost_thread.a, file was built for archive which is not the architecture being linked (armv7s): /Users/shams/Downloads/boostoniphone-master/build/armv7/libboost_thread.a
Undefined symbols for architecture armv7s:

1 个答案:

答案 0 :(得分:0)

我的解决方案是使用终端验证库架构:

otool -h libraryFile.a

输出:

Mach header
      magic cputype cpusubtype  caps    filetype ncmds sizeofcmds      flags
 0xfeedface      12          9  0x00          1     3       1588 0x00002000

cputype和cpusubtype是要查找的值:

for armv7:

cpu类型:12 cpusubtype:9

for armv7s:

cpu类型:12 cpusubtype:11

现在我遇到的情况是我不可能将架构更新为第三方。所以我最终改变了我的Xcode构建项目:

  • Xcode设置(蓝色标签)
  • 项目和目标架构:
  • 有效架构仅添加了armv7
  • 清理构建并再次运行

另一种解决方案是Hacking an armv7s library使用本教程。在我的情况下不起作用