【问题标题】:Using boost on the iPhone在 iPhone 上使用 boost
【发布时间】:2009-07-11 14:54:07
【问题描述】:

经过大量黑客攻击后,我设法为 iphone 编译了设备和模拟器的 boost-libraries,但是当我尝试使用它们时,我在 xcode 调试器中收到错误消息:

dyld: Library not loaded: libboost_graph.so.1.40.0

我猜这是 iphone 上不允许的动态库加载器。我将应用程序与-Lboost_graph 链接为编译器标志。

这是我用于构建 boost 的脚本:

./bjam $1 $2 $3 \
        toolset=darwin \
        architecture=arm \
        target-os=iphone \
        macosx-version=iphone-3.0 \
        define=_LITTLE_ENDIAN \
        --layout=system \
        --libdir=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib \
        --includedir=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include \
        link=static \
        runtime-link=static

./bjam $1 $2 $3 \
        toolset=darwin \
        architecture=x86 \
        target-os=iphone \
        macosx-version=iphonesim-3.0 \
        --layout=system \
        --libdir=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib \
        --includedir=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/include \
        link=static \
        runtime-link=static

我猜我在这里遗漏了一些非常基本的东西,但是什么?

是为动态加载而编译的库(平台/usr/lib中既有.a文件也有.so文件)

【问题讨论】:

标签: iphone boost linker


【解决方案1】:

我可能是错的,但我认为您需要将您的应用程序与 boost 静态链接 - 来自 dyld 的错误消息表明您当前正在链接到动态 boost 库(注意 @987654321错误消息中的 @ 后缀 - 你想链接静态的 - libboost.a

您可能希望将您的应用与以下内容相关联:

-iboost_graph -static

(假设 .a 文件名为 libboost_graph.a

【讨论】:

  • 似乎与 -static 链接会使编译器回退到不同的链接器,从而产生另一个错误:“ld_classic: can't locate file for: -lcrt0.o” 至少我得到了另一个编译器标志谷歌:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-19
  • 1970-01-01
  • 1970-01-01
  • 2010-12-12
  • 1970-01-01
相关资源
最近更新 更多