Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[QtCreator] Application cannot find Qt shared libraries on macOS



  • Hello! I'm trying to run my app in QtCreator 4.14.0, with Qt 5.15.2, on macOS BigSur (x64), but I have a @rpath problem:

    13:32:19: Starting /Users/theo/Projects/build-prt-Desktop_Qt_5_15_2_clang_64bit-Debug/prt ...
    dyld: Library not loaded: @rpath/QtQuick.framework/Versions/5/QtQuick
      Referenced from: /Users/theo/Projects/build-prt-Desktop_Qt_5_15_2_clang_64bit-Debug/prt
      Reason: image not found
    13:32:19: The program has unexpectedly finished.
    13:32:19: The process was ended forcefully.
    13:32:20: /Users/theo/Projects/build-prt-Desktop_Qt_5_15_2_clang_64bit-Debug/prt crashed.
    

    I did try to remove RPATH handling in the CMakeLists.txt by setting set(CMAKE_SKIP_RPATH TRUE), with no success...

    I've installed Qt and QtCreator with the online open-source installer, the root installation dir is at $HOME/Qt/5.15.2/, and all the frameworks are in $HOME/Qt/5.15.2/clang_64/lib.

    I found some SO posts saying I needed to uncheck the Add build library search path to DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH, which did not help.

    I also tried to manually set up DYLD_LIBRARY_PATH in the Projects -> Environment section, did not work either.

    The app runs in the terminal when I set DYLD_LIBRARY_PATH by hand, so there must be an option I'm missing in QtCreator.

    Here's the result of otool -L:

    @rpath/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.15.0, current version 5.15.2)
    	@rpath/QtQmlModels.framework/Versions/5/QtQmlModels (compatibility version 5.15.0, current version 5.15.2)
    	@rpath/QtQml.framework/Versions/5/QtQml (compatibility version 5.15.0, current version 5.15.2)
    	@rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.15.0, current version 5.15.2)
    	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.15.0, current version 5.15.2)
    	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.15.0, current version 5.15.2)
    	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
    

    Note that I do have install_name_tool and other Xcode command line tools installed.

    Looking forward to your help!

    Theo