qt mac osx 10.8 dyld: library not loaded...image not found

David Burson picture David Burson · Nov 28, 2012 · Viewed 22.7k times · Source

I have an app I was building and running fine under osx snow leopard with Qt 4.7.4, but that macbook died. I now am setting up a new macbook running mountain lion (10.8.2) and Qt 4.8.3. I can build my app, but when I try to run it from within Qt Creator 2.6.0, I get this run time error:

dyld: Library not loaded: ../lib/libicudata.46.1.dylib
  Referenced from: /Users/david/dev/svn/map_creator/karte-build-Desktop-Debug/debug/MapCreator.app/Contents/MacOS/MapCreator
  Reason: image not found
The program has unexpectedly finished.

I get a similar error running it from Finder.

otool gives me:

Davids-MacBook-Pro:map_creator david$ otool -L karte-build-Desktop-Debug/debug/MapCreator.app/Contents/MacOS/MapCreator 
karte-build-Desktop-Debug/debug/MapCreator.app/Contents/MacOS/MapCreator:
    ../lib/libicudata.46.1.dylib (compatibility version 46.0.0, current version 46.1.0)
    libicui18n.46.dylib (compatibility version 46.0.0, current version 46.1.0)
    libicuuc.46.dylib (compatibility version 46.0.0, current version 46.1.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 945.11.0)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55179.1.0)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1187.34.0)
    /Users/david/dev/qt483/lib/QtSvg_fmosoft.framework/Versions/4/QtSvg_fmosoft (compatibility version 4.8.0, current version 4.8.3)
    /Users/david/dev/qt483/lib/QtGui_fmosoft.framework/Versions/4/QtGui_fmosoft (compatibility version 4.8.0, current version 4.8.3)
    /Users/david/dev/qt483/lib/QtCore_fmosoft.framework/Versions/4/QtCore_fmosoft (compatibility version 4.8.0, current version 4.8.3)
    /Users/david/dev/qt483/lib/QtXmlPatterns_fmosoft.framework/Versions/4/QtXmlPatterns_fmosoft (compatibility version 4.8.0, current version 4.8.3)
    /Users/david/dev/qt483/lib/QtNetwork_fmosoft.framework/Versions/4/QtNetwork_fmosoft (compatibility version 4.8.0, current version 4.8.3)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1669.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.12.0)

Did something change from snow leopard to mountain lion, or from Qt 4.7.4 to 4.8.3, that is causing this issue? Or maybe I missed a step getting everything set up on my new macbook? I'm still learning - really just a novice on both Qt and Mac, trying to maintain this project after the primary developer has left.

Thanks, David

Answer

Dave Mateer picture Dave Mateer · Nov 28, 2012

In your Qt project settings, under runtime settings, you will have to add the path to the ICU libraries that you compiled. There is a grid where you set environment variables, etc. The one you want is DYLD_LIBRARY_PATH, and set (or append) the path to the ICU libraries.

That will enable Qt to resolve ../lib/libicudata.46.1.dylib to the actual library file.