解决链接依赖关系mac os x

时间:2015-02-09 06:13:46

标签: macos software-distribution building

我编译了一些源代码来构建和应用程序,所有内容编译都很好但现在我收到链接/依赖性错误,因此应用程序在加载时崩溃。

这是错误

Dyld Error Message:
  Library not loaded: libstreamanalyzer.0.dylib
  Referenced from: /usr/local/lib/libkio.5.dylib
  Reason: image not found

在这个问题上使用otool -L我得到

/opt/krita/lib/libkio.5.dylib (compatibility version 5.0.0, current version 5.14.3)
/opt/krita/lib/libkdeui.5.dylib (compatibility version 5.0.0, current version 5.14.3)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/local/Trolltech/Qt-4.8.6/lib/QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.6)
/usr/local/Trolltech/Qt-4.8.6/lib/QtXml.framework/Versions/4/QtXml (compatibility version 4.8.0, current version 4.8.6)
/usr/local/Trolltech/Qt-4.8.6/lib/QtSvg.framework/Versions/4/QtSvg (compatibility version 4.8.0, current version 4.8.6)
libstreamanalyzer.0.dylib (compatibility version 0.0.0, current version 0.7.8)
libstreams.0.dylib (compatibility version 0.0.0, current version 0.7.8)
/opt/krita/lib/libsolid.4.dylib (compatibility version 4.0.0, current version 4.14.3)
/opt/krita/lib/libkdecore.5.dylib (compatibility version 5.0.0, current version 5.14.3)
/usr/local/Trolltech/Qt-4.8.6/lib/QtDBus.framework/Versions/4/QtDBus (compatibility version 4.8.0, current version 4.8.6)
/usr/local/Trolltech/Qt-4.8.6/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.6)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
/usr/local/Trolltech/Qt-4.8.6/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.6)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

任何人都有解决此问题的任何提示吗?

[编辑] 在我的系统上使用find显示

/opt/krita/lib/cmake/LibStreamAnalyzer/LibStreamAnalyzerConfig.cmake
/opt/krita/lib/pkgconfig/libstreamanalyzer.pc
/opt/krita/lib/libstreamanalyzer.0.7.8.dylib
/opt/krita/lib/libstreamanalyzer.0.dylib
/opt/krita/lib/libstreamanalyzer.dylib

做 export DYLD_LIBRARY_PATH = / opt / krita / lib:$ DYLD_LIBRARY_PATH 像vsoftco建议的那样,应用程序仍然会因完全相同的错误而崩溃。

1 个答案:

答案 0 :(得分:1)

操作系统无法找到动态库。 Apple的OS X与linux有点不同,即使您成功链接了库,在运行程序时仍可能遇到麻烦。

解决方案是设置环境变量

DYLD_LIBRARY_PATH

到您的资料库libstreamanalyzer所在的路径。在OS X控制台中,键入

export DYLD_LIBRARY_PATH=/path/to/library:$DYLD_LIBRARY_PATH

然后尝试运行该程序。

如果从像XCo​​de或Eclipse这样的IDE运行程序,则可以选择指定环境变量。