MacOS共享库路径

时间:2012-11-19 10:54:03

标签: macos shared-libraries ld

我有一个C ++应用程序,它取决于几个.dylib;其中包括libprojPythonQt

我在不同的目录中预先构建了这些库。

2(相关)问题:

  • 可执行文件找到libproj.dylib的完整路径,虽然它不在路径中,不在DYLD_LIBRARY_PATH中,而不在QtCreator的配置中。怎么样?
  • 可执行文件找不到PythonQt,尽管它的链接方式完全相同。我必须在DYLD_LIBRARY_PATH中手动添加正确的路径。为什么?

这可能与libproj有.la.dylib这一事实有关,但对于PythonQt只有.dylib;但我不确定,我不明白这种关系。

otool的示例输出:

/Users/arnaud/Projects/myprojectname/external/proj-4.8.0/bin_mac64_gcc421_release/lib/libproj.0.dylib (compatibility version 8.0.0, current version 8.0.0)
    ( so it finds libproj correctly, even in another directory )

libPythonQt.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    (... but not libPythonQt, which is in a similar directory )

/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
QtOpenGL.framework/Versions/4/QtOpenGL (compatibility version 4.8.0, current version 4.8.3)
QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.3)
QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.3)
QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.3)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 697.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)

0 个答案:

没有答案