Search code examples
macossoftware-distributionbuilding

resolving linking dependencies mac os x


I compiled some source code to build and app, everything compiles fine but now I am getting linking/ dependency errors so the app crashes on load.

Here is an the error

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

using otool -L on this file in question i get

/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)

anyone have any tips on solving this issue?

[EDIT] using find on my system it shows

/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

doing export DYLD_LIBRARY_PATH=/opt/krita/lib:$DYLD_LIBRARY_PATH like vsoftco suggested and the app still crashes with the exact same error.


Solution

  • The OS cannot find the dynamic library. Apple's OS X is a bit different from linux, and even if you link the library successfully, you may still get in trouble when running the program.

    The solution is to set the environment variable

    DYLD_LIBRARY_PATH
    

    to the path where your library libstreamanalyzer is located. From the OS X console, type

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

    then try running the program.

    If you run the program from an IDE like XCode or Eclipse, there is an option of specifying environment variables.