【问题标题】:Complie Boost c++ library for iOS devices running on armv7s为在 armv7s 上运行的 iOS 设备编译 Boost c++ 库
【发布时间】:2013-05-24 16:46:52
【问题描述】:

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

在 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:

【问题讨论】:

  • 您为 armv7 构建时使用了哪些编译器标志?尝试不设置任何 -arch - IIRC,它对我有用。
  • 错误提示找不到架构

标签: iphone ios xcode ipad boost


【解决方案1】:

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

otool -h libraryFile.a

输出:

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

cputype 和 cpusubtype 是要查找的值:

对于 armv7:

cpu 类型:12 cpusubtype:9

对于 armv7s:

cpu 类型:12 cpusubtype:11

现在我处于一种情况,我不可能以第三方的身份更新架构。所以我最终改变了我的 Xcode 构建项目:

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

还有一个替代解决方案是使用本教程Hacking an armv7s library。在我的情况下不起作用

【讨论】:

    猜你喜欢
    • 2014-10-30
    • 1970-01-01
    • 1970-01-01
    • 2018-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多