Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Deploy library with Qt Creator plugin on Mac
QtWS25 Last Chance

Deploy library with Qt Creator plugin on Mac

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
macqtcreatorpluginqmakebundle
10 Posts 2 Posters 3.5k 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.
  • Aleksey_KA Offline
    Aleksey_KA Offline
    Aleksey_K
    wrote on last edited by Aleksey_K
    #1

    Have custom library which should be deployed with my Qt Creator plugin:

    myproject.pro

    TEMPLATE = subdirs
    
    # sub-project names
    SUBDIRS += \
            MyLibrary \
            MyPlugin
    
    # where to find the sub projects - give the folders
    MyLibrary.file = lib/MyLibrary/MyLibrary.pro
    MyPlugin.file = src/MyPlugin.pro
    
    # what subproject depends on others
    MyPlugin.depends = MyLibrary
    
    CONFIG += ordered
    

    MyLibrary project file contains line to deploy it

    mylibrary.pro

    ...
    isEmpty(DESTDIR): DESTDIR = $${IDE_BUILD_TREE}/lib/qtcreator/plugins
    ...
    

    Plugin created according Qt guidelines and above works fine in Linux and should work fine in Windows. Linking to the library works as follows:

    MyPlugin.pro

    ...
    mac|unix|win32: LIBS += -L$${IDE_BUILD_TREE}/lib/qtcreator/plugins/ -lMyLibrary
    ...
    

    However on Mac plugin deployed differently to bundle: $${IDE_BUILD_TREE}/bin//Qt Creator.app/Contents/PlugIns/ and the plugin appeared in different directory with library. However even if I put the built library to the bundle manually I get an error on QTC start:

    .../qt-creator-debug/bin/Qt
    Creator.app/Contents/PlugIns/libMyPlugin_debug.dylib: Can't load
    library .../qt-creator-debug/bin/Qt
    Creator.app/Contents/PlugIns/libMyPlugin_debug.dylib:
    (dlopen(.../qt-creator-debug/bin/Qt
    Creator.app/Contents/PlugIns/libMyPlugin_debug.dylib, 133): Library
    not loaded: libMyLibrary.1.dylib Referenced from:
    .../qt-creator-debug/bin/Qt
    Creator.app/Contents/PlugIns/libMyPlugin_debug.dylib Reason: image
    not found)

    How to deploy library with QtC plugin correctly on Mac? Documentation says nothing about.

    SGaistS 1 Reply Last reply
    0
    • Aleksey_KA Aleksey_K

      Have custom library which should be deployed with my Qt Creator plugin:

      myproject.pro

      TEMPLATE = subdirs
      
      # sub-project names
      SUBDIRS += \
              MyLibrary \
              MyPlugin
      
      # where to find the sub projects - give the folders
      MyLibrary.file = lib/MyLibrary/MyLibrary.pro
      MyPlugin.file = src/MyPlugin.pro
      
      # what subproject depends on others
      MyPlugin.depends = MyLibrary
      
      CONFIG += ordered
      

      MyLibrary project file contains line to deploy it

      mylibrary.pro

      ...
      isEmpty(DESTDIR): DESTDIR = $${IDE_BUILD_TREE}/lib/qtcreator/plugins
      ...
      

      Plugin created according Qt guidelines and above works fine in Linux and should work fine in Windows. Linking to the library works as follows:

      MyPlugin.pro

      ...
      mac|unix|win32: LIBS += -L$${IDE_BUILD_TREE}/lib/qtcreator/plugins/ -lMyLibrary
      ...
      

      However on Mac plugin deployed differently to bundle: $${IDE_BUILD_TREE}/bin//Qt Creator.app/Contents/PlugIns/ and the plugin appeared in different directory with library. However even if I put the built library to the bundle manually I get an error on QTC start:

      .../qt-creator-debug/bin/Qt
      Creator.app/Contents/PlugIns/libMyPlugin_debug.dylib: Can't load
      library .../qt-creator-debug/bin/Qt
      Creator.app/Contents/PlugIns/libMyPlugin_debug.dylib:
      (dlopen(.../qt-creator-debug/bin/Qt
      Creator.app/Contents/PlugIns/libMyPlugin_debug.dylib, 133): Library
      not loaded: libMyLibrary.1.dylib Referenced from:
      .../qt-creator-debug/bin/Qt
      Creator.app/Contents/PlugIns/libMyPlugin_debug.dylib Reason: image
      not found)

      How to deploy library with QtC plugin correctly on Mac? Documentation says nothing about.

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

      @Aleksey_K said in Deploy library with Qt Creator plugin on Mac:

      Creator.app/Contents/PlugIns/libMyPlugin_debug.dylib Reason: image
      not found)

      Hi

      What do you get if your run otool -L on libMyPlugin_debug.dylib ?

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

      Aleksey_KA 1 Reply Last reply
      0
      • SGaistS SGaist

        @Aleksey_K said in Deploy library with Qt Creator plugin on Mac:

        Creator.app/Contents/PlugIns/libMyPlugin_debug.dylib Reason: image
        not found)

        Hi

        What do you get if your run otool -L on libMyPlugin_debug.dylib ?

        Aleksey_KA Offline
        Aleksey_KA Offline
        Aleksey_K
        wrote on last edited by
        #3

        @SGaist

        otool -L libMyPlugin_debug.dylib 
        libMyPlugin_debug.dylib:
        	@rpath/PlugIns/libMyPlugin_debug.dylib (compatibility version 4.6.0, current version 0.0.0)
        	libMyLibrary.1.dylib (compatibility version 1.0.0, current version 1.0.0)
        	@rpath/PlugIns/libCore_debug.dylib (compatibility version 4.6.0, current version 0.0.0)
        	@rpath/Frameworks/libAggregation_debug.4.dylib (compatibility version 4.6.0, current version 4.6.1)
        	@rpath/Frameworks/libExtensionSystem_debug.4.dylib (compatibility version 4.6.0, current version 4.6.1)
        	@rpath/Frameworks/libUtils_debug.4.dylib (compatibility version 4.6.0, current version 4.6.1)
        	@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.10.0, current version 5.10.1)
        	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.10.0, current version 5.10.1)
        	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.10.0, current version 5.10.1)
        	/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
        	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
        	@rpath/QtTest.framework/Versions/5/QtTest (compatibility version 5.10.0, current version 5.10.1)
        	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 58286.31.2)
        	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1450.15.0)
        	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 50.0.0)
        	@rpath/QtConcurrent.framework/Versions/5/QtConcurrent (compatibility version 5.10.0, current version 5.10.1)
        	/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/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
        	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          The libMyLibrary.1.dylib entry is too short, it's missing where it should be getting found.

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

          Aleksey_KA 2 Replies Last reply
          0
          • SGaistS SGaist

            The libMyLibrary.1.dylib entry is too short, it's missing where it should be getting found.

            Aleksey_KA Offline
            Aleksey_KA Offline
            Aleksey_K
            wrote on last edited by Aleksey_K
            #5

            @SGaist said in Deploy library with Qt Creator plugin on Mac:

            The libMyLibrary.1.dylib entry is too short, it's missing where it should be getting found.

            What do You mean? Could You elaborate please? Content of qt-creator-debug/lib/qtcreator/plugins/ is:

            • libMyLibrary.1.0.0.dylib
            • libMyLibrary.1.0.dylib
            • libMyLibrary.1.dylib - which is symbolic link to libMyLibrary.1.0.0.dylib
            • libMyLibrary.dylib
            1 Reply Last reply
            0
            • SGaistS SGaist

              The libMyLibrary.1.dylib entry is too short, it's missing where it should be getting found.

              Aleksey_KA Offline
              Aleksey_KA Offline
              Aleksey_K
              wrote on last edited by
              #6

              @SGaist said in Deploy library with Qt Creator plugin on Mac:

              The libMyLibrary.1.dylib entry is too short, it's missing where it should be getting found.

              1. What should be added to .pro file to add path to the library? Why it works in Linux/Windows and fails on Mac?
              2. How to deploy libMyLibrary.*.dylib to the bundle correctly? I tried to get some lines from qtcreatorplugin.pri with no luck.
              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                IIRC it's QMAKE_RPATHDIR.

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

                Aleksey_KA 1 Reply Last reply
                0
                • SGaistS SGaist

                  IIRC it's QMAKE_RPATHDIR.

                  Aleksey_KA Offline
                  Aleksey_KA Offline
                  Aleksey_K
                  wrote on last edited by
                  #8

                  @SGaist said in Deploy library with Qt Creator plugin on Mac:

                  IIRC it's QMAKE_RPATHDIR.

                  Thanks, need to try. Here is an example how to use it: https://stackoverflow.com/a/25538188/630169. The only question remains: how to deploy the library to the bundle or correct path (good if it works on all platforms) if it is built first before the plugin?

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

                    The library should go in the Frameworks folder of the application. Then rpath of the plugin should point to @rpath/Frameworks so it can find the library there.

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

                    Aleksey_KA 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      The library should go in the Frameworks folder of the application. Then rpath of the plugin should point to @rpath/Frameworks so it can find the library there.

                      Aleksey_KA Offline
                      Aleksey_KA Offline
                      Aleksey_K
                      wrote on last edited by
                      #10

                      @SGaist, could You provide an example please - fixed mylibrary.pro? Thanks!

                      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