dyld:未加载库:libboost_system.dylib

时间:2012-12-15 13:20:18

标签: boost xcode4 shared-libraries dylib install-name-tool

另一个dyld: Library not loaded dylib问题..

我有一个从Boost来源编译的dylib( libboost_system.dylib ),
然后使用install-name-tool准备将其包含在我的应用包的Frameworks文件夹中,如下所示:

install_name_tool -id @executable_path
    /../Frameworks/
    libboost_system.dylib libboost_system.dylib

通过otool验证:

$> otool -L libboost_system.dylib

/Users/TesterCodeSandbox/OgreSDK
    /BOOST_DYLIBS/libboost_system.dylib:
@executable_path/../Frameworks
    /libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)

现已添加到Xcode项目中,链接到应用程序并复制到Frameworks文件夹 但是当使用otool -L检查构建的应用程序时,它仍然指的是原始(即“非重定位”)dylib:

OgreTest-ekeeqmnyciddaxbzyrehtcoijcki/Build
        /Products/Debug/OgreTest.app/Contents/MacOS/OgreTest:
    @executable_path/../Plugins
            /RenderSystem_GL.dylib (compatibility version 0.0.0, current version 1.8.0)
    /System/Library/Frameworks/Cocoa.framework/
            Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0)
    @executable_path/../Frameworks/Ogre.framework/
            Versions/1.8.0/Ogre (compatibility version 0.0.0, current version 1.8.0)
    @executable_path/../Frameworks/Cg.framework
            /Cg (compatibility version 0.0.0, current version 0.0.0)
    /System/Library/Frameworks/IOKit.framework/Versions/A
            /IOKit (compatibility version 1.0.0, current version 275.0.0)
    /System/Library/Frameworks/Carbon.framework/Versions/A
            /Carbon (compatibility version 2.0.0, current version 152.0.0)
    libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libstdc++.6.dylib 
            (compatibility version 7.0.0, current version 7.9.0)
    /usr/lib/libSystem.B.dylib 
            (compatibility version 1.0.0, current version 125.2.11)
    /usr/lib/libobjc.A.dylib 
            (compatibility version 1.0.0, current version 227.0.0)
    /System/Library/Frameworks/CoreFoundation.framework
            /Versions/A/CoreFoundation 
            (compatibility version 150.0.0, current version 550.43.0)
    /System/Library/Frameworks/AppKit.framework
            /Versions/C/AppKit 
            (compatibility version 45.0.0, current version 1038.36.0)

该应用无法以' dyld:未加载库:libboost_system.dylib '错误启动。有什么想法吗?


注1

如果我还使用install_name_tool对我的应用二进制文件进行后期处理,那么它确实,即:

install_name_tool -change libboost_system.dylib @executable_path/../Frameworks/libboost_system.dylib TestApp

我是否缺少一些Xcode选项来强制编译器在构建过程中自动更改我的应用程序中的dylib位置?

当然为应用程序手动调用install_name_tool 消费 dylib(即潜在的多数)可能只是解决了我在配置(应用程序)时搞砸的事情项目......

0 个答案:

没有答案