Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MacOS dylib plugin loading path changes from Qt 5.15 to Qt 6.2

MacOS dylib plugin loading path changes from Qt 5.15 to Qt 6.2

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 516 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    QKelteseth
    wrote on last edited by QKelteseth
    #1

    Hi,

    I'm no longer able to load my Steam plugin with the way it worked in 5.15 on macOS. It does still work on Windows. I created a qml plugin that gets loaded on runtime that needs the libsteam_api.dylib. Previously placing the libsteam_api.dylib beside the plugin worked fine.

    // This fixed the plugin loading in 5.15
     m_mainWindowEngine->addPluginPath(QGuiApplication::instance()->applicationDirPath());
    // Does also not work when adding: 
    m_mainWindowEngine->addPluginPath(QGuiApplication::instance()->applicationDirPath() + "/Workshop");
    
    

    Now it ony works on macOS when placing the libsteam_api.dylib besides the .app file.

    "qrc:/ScreenPlay/qml/Workshop/SteamWorkshop.qml:6:1: 
    Die Bibliothek /Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/ScreenPlay.app/Contents/MacOS/Workshop/libScreenPlayWorkshopplugin.dylib kann nicht geladen werden: 
    (dlopen(/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/ScreenPlay.app/Contents/MacOS/Workshop/libScreenPlayWorkshopplugin.dylib,
     0x0085): Library not loaded: @rpath/libScreenPlayWorkshop.dylib\n  Referenced from: /Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/ScreenPlay.app/Contents/MacOS/Workshop/libScreenPlayWorkshopplugin.dylib\n  
    Reason: tried: '/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtQuick.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtQmlModels.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtQml.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtOpenGL.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtGui.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtNetwork.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtCore.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Documents/ScreenPlay-vcpkg/installed/x64-osx/lib/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtWebSockets.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtSvg.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtWidgets.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtWebEngineQuick.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtWebEngineCore.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtWebChannel.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtPositioning.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/QtCore.framework/Versions/A/../../../libScreenPlayWorkshop.dylib' (no such file),
     '/Users/eli/Qt/6.2.1/macos/lib/libScreenPlayWorkshop.dylib' (no such file),
     '/usr/local/lib/libScreenPlayWorkshop.dylib' (no such file),
     '/usr/lib/libScreenPlayWorkshop.dylib' (no such file))"
    

    Repo: https://gitlab.com/kelteseth/ScreenPlay
    CMake file: https://gitlab.com/kelteseth/ScreenPlay/-/blob/master/ScreenPlayWorkshop/CMakeLists.txt#L53

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Shouldn't that library be stored in the Frameworks sub folder and then its search path be set to @rpath/../Frameworks ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • Q Offline
        Q Offline
        QKelteseth
        wrote on last edited by QKelteseth
        #3

        @SGaist thanks for the anweser, but none of that worked.

            m_mainWindowEngine->addPluginPath(QGuiApplication::instance()->applicationDirPath());
            m_mainWindowEngine->addPluginPath(QGuiApplication::instance()->applicationDirPath()+"/../Frameworks");
            m_mainWindowEngine->addPluginPath("@rpath/../Frameworks");
            m_mainWindowEngine->addImportPath("@rpath/../Frameworks");
            m_mainWindowEngine->addImportPath(QGuiApplication::instance()->applicationDirPath());
            m_mainWindowEngine->addImportPath(QGuiApplication::instance()->applicationDirPath()+"/../Frameworks");
        
            qInfo() << m_mainWindowEngine->pluginPathList();
            qInfo() << m_mainWindowEngine->importPathList();
            qInfo() <<  QGuiApplication::instance()->libraryPaths();
        

        printing:

        "QList(\"\", \"/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/ScreenPlay.app/Contents/Frameworks\", \"/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/ScreenPlay.app/Contents/MacOS\", \".\")"
        "QList(\"/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/ScreenPlay.app/Contents/Frameworks\", \"/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/ScreenPlay.app/Contents/MacOS\", \"qrc:/qt-project.org/imports\", \"/Users/eli/Qt/6.2.1/macos/qml\")"
        "QList(\"/Users/eli/Qt/6.2.1/macos/plugins\", \"/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/ScreenPlay.app/Contents/MacOS\")"
        

        I now copied the files in every folder like:

        • /ScreenPlay.app/Contents/MacOS\
        • /ScreenPlay.app/Contents/MacOS\Workshop
        • /ScreenPlay.app/Contents/Framworks\Workshop

        It only works if I place the third party dylib besides ScreenPlay.app location. This is only since my upgrade to Qt 6.2

        Content of the Workshop folder:

        ScreenPlayWorkshop.qmltypes
        libScreenPlayWorkshop.dylib
        libScreenPlayWorkshopplugin.dylib
        libsteam_api.dylib # <- Only works if this file is in the same folder as ScreenPlay.app
        libScreenPlayWorkshopplugin.a
        libSteamSDK.a
        qmldir
        

        When loading the qml plugin:

        "qrc:/ScreenPlay/qml/Workshop/SteamWorkshop.qml:6:1: Die Bibliothek /Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/ScreenPlay.app/Contents/MacOS/Workshop/libScreenPlayWorkshopplugin.dylib kann nicht geladen werden: (dlopen(/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/ScreenPlay.app/Contents/MacOS/Workshop/libScreenPlayWorkshopplugin.dylib, 0x0085): Library not loaded: @rpath/libScreenPlayWorkshop.dylib\n  Referenced from: /Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/ScreenPlay.app/Contents/MacOS/Workshop/libScreenPlayWorkshopplugin.dylib\n  Reason: tried: '/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtQuick.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtQmlModels.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtQml.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtOpenGL.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtGui.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtNetwork.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtCore.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Documents/ScreenPlay-vcpkg/installed/x64-osx/lib/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtWebSockets.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtSvg.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtWidgets.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtWebEngineQuick.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtWebEngineCore.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtWebChannel.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtPositioning.framework/Versions/A/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Documents/build-ScreenPlay-ScreenPlay_Qt_6_2_1_clang_64bit-Release/bin/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/QtCore.framework/Versions/A/../../../libScreenPlayWorkshop.dylib' (no such file),
         '/Users/eli/Qt/6.2.1/macos/lib/libScreenPlayWorkshop.dylib' (no such file),
         '/usr/local/lib/libScreenPlayWorkshop.dylib' (no such file),
         '/usr/lib/libScreenPlayWorkshop.dylib' (no such file))"
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Did you use macdeployqt on your app bundle ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Q 1 Reply Last reply
          0
          • SGaistS SGaist

            Did you use macdeployqt on your app bundle ?

            Q Offline
            Q Offline
            QKelteseth
            wrote on last edited by
            #5

            @SGaist isn't macdeployqt only for qt libraries?

            artwawA SGaistS 2 Replies Last reply
            0
            • Q QKelteseth

              @SGaist isn't macdeployqt only for qt libraries?

              artwawA Offline
              artwawA Offline
              artwaw
              wrote on last edited by
              #6

              @QKelteseth in the terminal, please navigate inside your bundle where the main executable resides (ScreenPlay.app/Contents/MacOS) and run otool -L <your_exe_name> - this will print you what shared libraries are linked to that executable and where do they are expected.

              You should run macdeployqt also when using qml (if in doubt run macdeployqt --help).

              if you need to adjust linked paths in your executable in the macOS folder of your bundle then the tool install_name_tool is your friend.

              For more information please re-read.

              Kind Regards,
              Artur

              1 Reply Last reply
              0
              • Q QKelteseth

                @SGaist isn't macdeployqt only for qt libraries?

                SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @QKelteseth said in MacOS dylib plugin loading path changes from Qt 5.15 to Qt 6.2:

                @SGaist isn't macdeployqt only for qt libraries?

                It is to be used when you want to prepare your app bundle for deployment.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • Q Offline
                  Q Offline
                  QKelteseth
                  wrote on last edited by
                  #8

                  @artwaw @SGaist I think it works now if I place it in the root Frameworks folder. Using ottol on the lib printed:

                  Load command 12
                            cmd LC_LOAD_DYLIB
                        cmdsize 56
                           name @loader_path/libsteam_api.dylib (offset 24)
                     time stamp 2 Thu Jan  1 01:00:02 1970
                        current version 1.0.0
                  compatibility version 1.0.0
                  Load command 13
                            cmd LC_LOAD_DYLIB
                        cmdsize 72
                           name @rpath/QtQuick.framework/Versions/A/QtQuick (offset 24)
                     time stamp 2 Thu Jan  1 01:00:02 1970
                        current version 6.2.1
                  compatibility version 6.0.0
                  Load command 14
                  

                  Thanks for your help! Have a great weekend <3

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved