macos Dyld:库未加载错误 Mac OS

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2975008/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 06:59:03  来源:igfitidea点击:

Dyld: Library not Loaded Error Mac OS

objective-cmacosframeworksdyld

提问by Stephen Furlani

Hoookay,

胡说八道,

So I know I'm about to get a dozen "load the lib dummy" answers to this, but here goes...

所以我知道我将得到一打“加载 lib 虚拟”的答案,但这里是......

junk.framework is exporting some objects of another project (junk.app) so I can use it on a remote.app node on a cluster. I can compile junk.framework (which I realize means nothing anymore with dynamic loading) and compile and link remote.app to junk.framework.

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

However, when I run remote.app I get this lovely jewel of an error:

但是,当我运行 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

I think what is going on is that junk.framework is loading libtiff.dylib from a certain location and it can't find it. junk.framework is another project I'm working on that I just got to build (finally).

我认为正在发生的事情是垃圾框架正在从某个位置加载 libtiff.dylib 并且找不到它。junk.framework 是我正在做的另一个项目,我刚要构建(最终)。

When I get infoon libtiff.dylib in my junk target it gives me /Users/slate/Documents/osirix/osirix/Binaries/LibTiff/libtiff.dylibas a path... and I've got absolute pathselected. So why is it not looking there for it?

当我get info在我的垃圾目标中使用 libtiff.dylib 时,它给了我/Users/slate/Documents/osirix/osirix/Binaries/LibTiff/libtiff.dylib一条路径……我被absolute path选中了。那么为什么它不寻找它呢?

Uh... why is it looking at @executable_path/../???? Where on earth is that setting so I can change it?

呃......为什么它在看@executable_path/../???? 那个设置到底在哪里,所以我可以改变它?

Edit ---

编辑 - -

otool -L gives me this:

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)

回答by JWWalker

The @executable_path setting was specified when libtiff.dylib was built. (If you build your own dylib or framework, it's the installation directory (INSTALL_PATH) build setting.) It can be changed with the install_name_tool command.

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