【问题标题】:ld: b/bl/blx thumb2 branch out of range fromld: b/bl/blx thumb2 分支超出范围
【发布时间】:2014-06-30 00:29:13
【问题描述】:

我正在尝试构建一个 iOS 应用程序,但在调试模式下遇到错误。

ld: b/bl/blx thumb2 branch out of range (17330692 max is +/-16MB): from xxxx (0x0204CC28) to zzzz (0x030D4010) in 'yyyy' from libMyLib.a(MyObject.o) for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

这只发生在 iOS 调试版本中。 iOS-Simulator 在这两种模式下都很好。

我遇到了“This page”。

这表明 Apple (rdar://16186742) 已知此问题。但是解决方法对我没什么好处。即

The work around is to rearrange the source files in the project build phases and/or libraries in the Link Binary with Libraries section. With a few re-arrangements this problem should go away.

我花了太多时间重新安排图书馆链接顺序。这在不同的*.a 文件之间移动了问题,但没有解决它。

这个问题有合适的解决方案吗?

“xcode 5.0.1”已安装。

【问题讨论】:

    标签: ios xcode linker


    【解决方案1】:

    此错误已在 Xcode 5.1.1 中修复。因此,安装最新版本可能是最简单的解决方法。

    【讨论】:

    • 我在 Xcode 6.1.1 中得到了这个(还没有解决方案): ld: b/bl/blx thumb2 branch out of range (20117852 max is +/-16MB): from _setButton.island (0x0000C570) 到架构 armv7 的“_setButton.island”中的 _setButton.island.2 (0x0133BED0)
    • 我已经看到这种情况发生在 XCode 6 和 6.1 中。这仍然是一个问题。
    • 我在 XCode 6.1 中也看到过这种情况;(
    【解决方案2】:

    我也遇到过这个问题,但不同的是我的项目在 XCode 5.0 下运行良好。

    我将xcode 更新为5.1.1 后,出现thumb2 branch out of range 的问题。

    我的项目有很多 CPP 静态库要链接到。这些静态库是使用编译器选项-mthumb 构建的。默认情况下,xcode 应该使用选项-mthumb 作为设备。

    我的解决方法是在构建这些静态库的调试版本时使用编译器选项-mno-thumb

    我认为在调试模式下应用程序变得更慢和更大是可以接受的。在发布模式下,它可以正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-19
      • 2023-03-27
      • 1970-01-01
      • 1970-01-01
      • 2012-05-04
      相关资源
      最近更新 更多