[英]How do I properly distribute dylib dependencies in a .app bundle on OSX?
Specifically, I'm trying to install glew and freetype. 具体来说,我正在尝试安装glew和freetype。 I've copied the .dylibs into the .app directory and set their paths with install_name_tool.
我已经将.dylibs复制到.app目录中,并使用install_name_tool设置了它们的路径。 When I try to run them on other machines I get the following error:
当我尝试在其他计算机上运行它们时,出现以下错误:
Library not loaded: @executable_path/../Resources/libGLEW.2.0.0.dylib
Referenced from: /Volumes/*/Tetris.app/Contents/MacOS/Tetris
Reason: no suitable image found. Did find:
/Volumes/SharedFolders/build/Tetris.app/Contents/MacOS/../Resources/libGLEW.2.0.0.dylib: stat() failed with errno=22
/Volumes/SharedFolders/build/Tetris.app/Contents/MacOS/../Resources/libGLEW.2.0.0.dylib: stat() failed with errno=22
I've fixed the issue. 我已经解决了这个问题。 The problem was that I ran install_name_tool on only the executable when I needed to run it on both the executable, with the
-change
switch, and the dylib, with the -id
switch. 问题是,当我需要在带有
-change
开关的可执行文件和带有-id
开关的dylib上运行它时,仅在可执行文件上运行install_name_tool。
I've also discovered through doing this that the dylibs have other dylibs they depend on, which must, in turn, be copied into the bundle and reconfigured with install_name_tool. 通过这样做,我还发现dylib依赖于其他dylib,这些dylib必须依次复制到捆绑包中并使用install_name_tool进行重新配置。
If anyone knows of a tool which does all of this automatically, please leave a comment. 如果有人知道自动执行所有操作的工具,请发表评论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.