Dyld:未加载库错误Mac OS

时间:2010-06-04 14:27:15

标签: objective-c macos frameworks dyld

Hoookay,

所以我知道我要打十几个“加载lib dummy”的答案,但这里有......

junk.framework正在导出另一个项目的某些对象(junk.app),因此我可以在群集上的remote.app节点上使用它。我可以编译junk.framework(我意识到它不再用动态加载)并编译并链接remote.app到junk.framework。

然而,当我运行remote.app时,我得到了一个错误的可爱宝石:

dyld: Library not loaded: @executable_path/../Frameworks/libtiff.dylib
  Referenced from: /Users/slate/Documents/junk/build/Development/junk.framework/Versions/A/junk
  Reason: image not found

我认为发生的事情是junk.framework正在从某个位置加载libtiff.dylib并且无法找到它。 junk.framework是我正在研究的另一个项目,我刚刚建立(最后)。

当我在我的垃圾目标中的libtiff.dylib上get info时,它会将/Users/slate/Documents/osirix/osirix/Binaries/LibTiff/libtiff.dylib作为路径...并且我已选择absolute path。那么为什么不寻找呢?

呃......为什么要看@executable_path /../ ????那个地方到底是什么让我可以改变它?

编辑---

otool -L给了我这个:

/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 677.26.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 949.54.0)
/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 12.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
@executable_path/../Frameworks/libtiff.dylib (compatibility version 11.0.0, current version 11.4.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/System/Library/Frameworks/QTKit.framework/Versions/A/QTKit (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime (compatibility version 1.0.0, current version 1327.73.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 32.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 476.19.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 34.0.0)
/System/Library/Frameworks/vecLib.framework/Versions/A/vecLib (compatibility version 1.0.0, current version 242.0.0)

1 个答案:

答案 0 :(得分:9)

构建libtiff.dylib时指定了@executable_path设置。 (如果您构建自己的dylib或框架,则它是安装目录(INSTALL_PATH)构建设置。)可以使用install_name_tool命令更改它。