我目前使用 macdeployqt 创建了一个“dmg”文件并遇到了以下错误。
Dyld Error Message:
Library not loaded: @executable_path/../Frameworks/libosg.141.dylib
Referenced from: /Users/USER/*/myApp2.app/Contents/MacOS/MyApp2
Reason: image not found
然后我遇到了@cristopher bruns 的这篇文章,它解释了这种情况。本质上,我需要添加libosg.141.dylib
到应用程序中,然后添加所有依赖的库libosg.141.dylib
。例如,libosg.141.dylib
依赖于以下 13 个文件。
> otool -L /usr/local/lib/libosgDB.dylib
/usr/local/lib/libosgDB.dylib:
libosgDB.141.dylib (compatibility version 141.0.0, current version 3.5.1)
libosgUtil.141.dylib (compatibility version 141.0.0, current version 3.5.1)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 22.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
libosg.141.dylib (compatibility version 141.0.0, current version 3.5.1)
libOpenThreads.20.dylib (compatibility version 20.0.0, current version 3.3.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1256.14.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1256.1.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
我的问题是我需要将所有这 13 个文件添加到应用程序吗?我需要走多深?我怎么知道什么时候停下来。由于这些文件中的每一个都可能有自己的依赖项?