经过大量的黑客攻击后,我已经成功地编译了 iPhone 的 boost 库,包括设备和模拟器,但是当我尝试使用它们时,我在 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文件)
最佳答案
我可能是错的,但我认为您需要将您的应用程序静态链接到 boost - 来自 dyld 的错误消息表明您当前正在链接到动态 boost 库(请注意 .so
后缀在错误消息中 - 您想要链接静态的 - libboost.a
您可能希望将您的应用程序与以下内容链接:
-iboost_graph -static
(假设 .a 文件名为 libboost_graph.a
)
关于iphone - 在 iPhone 上使用 boost 功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1113879/