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. Creating .dmg for Qt app mac OSX
Forum Updated to NodeBB v4.3 + New Features

Creating .dmg for Qt app mac OSX

Scheduled Pinned Locked Moved Unsolved General and Desktop
22 Posts 4 Posters 11.6k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    Rondog
    wrote on last edited by
    #5

    I had a look at your app. It almost runs (returns an error EXC_CRASH (SIGABRT) ).

    After some investigation it looks like you are missing a library that is needed by libqcocoa.dylib. When I run the command otool -L libqcocoa.dylib I see this:

    	@rpath/../plugins/platforms/libqcocoa.dylib (compatibility version 0.0.0, current version 0.0.0)
    	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 21.0.0)
    	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
    	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    	/usr/lib/libcups.2.dylib (compatibility version 2.0.0, current version 2.11.0)
    	/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
    	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    *****
    	@rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
    *****
    	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0)
    	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1343.14.0)
    	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
    	@rpath/libQt5PrintSupport.5.dylib (compatibility version 5.6.0, current version 5.6.2)
    	@rpath/libQt5Widgets.5.dylib (compatibility version 5.6.0, current version 5.6.2)
    	@rpath/libQt5Gui.5.dylib (compatibility version 5.6.0, current version 5.6.2)
    	@rpath/libQt5Core.5.dylib (compatibility version 5.6.0, current version 5.6.2)
    	/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)
    	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1151.16.0)
    	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 62.0.0)
    	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1151.16.0)
    	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    

    I could not find libz.1.dylib in your app bundle. When libcocoa.dylib tries to load it can't find this library and this is probably where things go bad (?).

    1 Reply Last reply
    2
    • SGaistS SGaist

      Hi,

      First and foremost, what version of Qt are you using ? On what version of macOS ? And which version of Xcode ?

      Do you get any error message when you run macdeployqt ?

      A Offline
      A Offline
      Arqam
      wrote on last edited by
      #6

      @SGaist
      QT Creator : 5.10.0
      Mac OSX : OSX 10.12 Sierra
      I have uploaded my Contents folder also if its of any help in the other post here.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rondog
        wrote on last edited by
        #7

        Just to add a bit more information...

        If you set the environment variable QT_DEBUG_PLUGINS=1 and run the executable file directly you can see more of what is going on:

        export QT_DEBUG_PLUGINS=1
        ./test_app.app/Contents/MacOS/DMGCheckQT
        QFactoryLoader::QFactoryLoader() checking directory path "/Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms" ...
        QFactoryLoader::QFactoryLoader() looking at "/Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib"
        Found metadata in lib /Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib, metadata=
        {
            "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
            "MetaData": {
                "Keys": [
                    "cocoa"
                ]
            },
            "className": "QCocoaIntegrationPlugin",
            "debug": false,
            "version": 329218
        }
        
        
        Got keys from plugin meta data ("cocoa")
        QFactoryLoader::QFactoryLoader() checking directory path "/Users/ron/Downloads/test_app.app/Contents/MacOS/platforms" ...
        Cannot load library /Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib: (dlopen(/Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib, 133): Library not loaded: @rpath/libQt5PrintSupport.5.dylib
          Referenced from: /Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib
          Reason: image not found)
        QLibraryPrivate::loadPlugin failed on "/Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib" : "Cannot load library /Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib: (dlopen(/Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib, 133): Library not loaded: @rpath/libQt5PrintSupport.5.dylib\n  Referenced from: /Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib\n  Reason: image not found)"
        This application failed to start because it could not find or load the Qt platform plugin "cocoa"
        in "".
        
        Available platform plugins are: cocoa.
        
        Reinstalling the application may fix this problem.
        Abort trap: 6
        

        Note: You seem to be missing the Qt5PrintSupport framework which is why the cocoa plugin is not loading. Is this included in your project (PRO) file by chance?

        greaterThan(QT_MAJOR_VERSION, 4): {
        QT += widgets printsupport
        }
        

        I know this is a one widget test program so you probably don't have this but, for some reason, it is shown as a dependency.

        A 1 Reply Last reply
        2
        • R Rondog

          Just to add a bit more information...

          If you set the environment variable QT_DEBUG_PLUGINS=1 and run the executable file directly you can see more of what is going on:

          export QT_DEBUG_PLUGINS=1
          ./test_app.app/Contents/MacOS/DMGCheckQT
          QFactoryLoader::QFactoryLoader() checking directory path "/Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms" ...
          QFactoryLoader::QFactoryLoader() looking at "/Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib"
          Found metadata in lib /Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib, metadata=
          {
              "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
              "MetaData": {
                  "Keys": [
                      "cocoa"
                  ]
              },
              "className": "QCocoaIntegrationPlugin",
              "debug": false,
              "version": 329218
          }
          
          
          Got keys from plugin meta data ("cocoa")
          QFactoryLoader::QFactoryLoader() checking directory path "/Users/ron/Downloads/test_app.app/Contents/MacOS/platforms" ...
          Cannot load library /Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib: (dlopen(/Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib, 133): Library not loaded: @rpath/libQt5PrintSupport.5.dylib
            Referenced from: /Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib
            Reason: image not found)
          QLibraryPrivate::loadPlugin failed on "/Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib" : "Cannot load library /Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib: (dlopen(/Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib, 133): Library not loaded: @rpath/libQt5PrintSupport.5.dylib\n  Referenced from: /Users/ron/Downloads/test_app.app/Contents/PlugIns/platforms/libqcocoa.dylib\n  Reason: image not found)"
          This application failed to start because it could not find or load the Qt platform plugin "cocoa"
          in "".
          
          Available platform plugins are: cocoa.
          
          Reinstalling the application may fix this problem.
          Abort trap: 6
          

          Note: You seem to be missing the Qt5PrintSupport framework which is why the cocoa plugin is not loading. Is this included in your project (PRO) file by chance?

          greaterThan(QT_MAJOR_VERSION, 4): {
          QT += widgets printsupport
          }
          

          I know this is a one widget test program so you probably don't have this but, for some reason, it is shown as a dependency.

          A Offline
          A Offline
          Arqam
          wrote on last edited by Arqam
          #8

          @Rondog Hi,
          I did run otool -L libz.1.dylib and found the following output :

          libz.1.dylib:
          	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
          	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
          

          Regarding the libz.1.dylib how can I get it right as its there in my /usr/lib folder. In this whole process I didn't do anything special from my side and followed QT guidelines to create a new project.
          While starting a new project I select the following :
          0_1504069565145_Screen Shot 2017-08-30 at 10.15.07 AM.png
          By default Qt 5.9.1 clang 64bit2 is also selected, I uncheck that and go with only first option.

          I added QT += widgets printsupport in my .pro file, but I can't find any way to get the compatible version for libz.1.dylib, so still the same problem I get.

          I have uploaded the whole project(which is not running now because macdeployqt DMGTestFinal.app is executed) over here : https://github.com/torrtuga/DMGCheckQTApp

          I really hope if this libz.1.dylib problem is solved then I am able to create a working dmg file, as this is really becoming painful since so many days.
          Also, my QT is a free trial version : Available under GPL & LGPLv3 licenses

          J.HilkJ 1 Reply Last reply
          0
          • A Arqam

            @Rondog Hi,
            I did run otool -L libz.1.dylib and found the following output :

            libz.1.dylib:
            	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
            	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
            

            Regarding the libz.1.dylib how can I get it right as its there in my /usr/lib folder. In this whole process I didn't do anything special from my side and followed QT guidelines to create a new project.
            While starting a new project I select the following :
            0_1504069565145_Screen Shot 2017-08-30 at 10.15.07 AM.png
            By default Qt 5.9.1 clang 64bit2 is also selected, I uncheck that and go with only first option.

            I added QT += widgets printsupport in my .pro file, but I can't find any way to get the compatible version for libz.1.dylib, so still the same problem I get.

            I have uploaded the whole project(which is not running now because macdeployqt DMGTestFinal.app is executed) over here : https://github.com/torrtuga/DMGCheckQTApp

            I really hope if this libz.1.dylib problem is solved then I am able to create a working dmg file, as this is really becoming painful since so many days.
            Also, my QT is a free trial version : Available under GPL & LGPLv3 licenses

            J.HilkJ Online
            J.HilkJ Online
            J.Hilk
            Moderators
            wrote on last edited by J.Hilk
            #9

            @Arqam Qt 5.10 is still in its experimental alpha version! It is highly likely, that the macdeployment tool is not jet up to date.

            Build your app for 5.9, run the macdeploy tool of the 5.9 folder and see if that doesn't fix your problems.


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            A 1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @Arqam Qt 5.10 is still in its experimental alpha version! It is highly likely, that the macdeployment tool is not jet up to date.

              Build your app for 5.9, run the macdeploy tool of the 5.9 folder and see if that doesn't fix your problems.

              A Offline
              A Offline
              Arqam
              wrote on last edited by
              #10

              @J.Hilk No, its the same result in both cases.

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

                Run otool -L on all plugins involved to see what might be going on.

                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
                • R Offline
                  R Offline
                  Rondog
                  wrote on last edited by Rondog
                  #12

                  I think I know how to fix your problem (or pretty sure at least).

                  What is happening is macdeployqt is looking at the path and thinks it is a system file so it is not added to your application (app). I believe the libz.1.dylib is part of zlib and you happen to have it installed in /usr/lib/. I am not sure how it was linked to your plugins but this is less important (but could be the other solution - remove this dependency from your plugins).

                  You will need to modify the source of macdeployqt to fix your problem. From the Qt sources you will find the macdeployqt program and file of interest here: qt-everywhere-opensource-src-5.x.x/qttools/src/macdeployqt/shared/shared.cpp You need to add an exception to allow /usr/lib/libz.1.dylib

                  The function 'parseOtoolLibraryLine(...)' checks the path and (very correctly) doesn't include anything that is likely a system file. In your case /usr/lib/libz.1.dylib is thought to be a system library so it is not included. I am using Qt 5.6.0 and I know you have 5.10.x so there may be some differences in what I posted for source but i suspect they are small.

                  I actually ran into this problem as well. I compiled Qt from sources and installed it in /usr/lib/qt5 using the -prefix option. I know this is not the right place on OSX but it is a location I have used on GNU/Linux and simply stuck with it. I added an exception to the above mentioned file (and function) so that anything starting with /usr/lib/qt5 was not rejected.

                  FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundlePath, const QSet<QString> &rpaths, bool useDebugLibs)
                  {
                      FrameworkInfo info;
                      QString trimmed = line.trimmed();
                  
                      if (trimmed.isEmpty())
                          return info;
                  
                      // Don't deploy system libraries.
                      if (trimmed.startsWith("/System/Library/") ||
                          (trimmed.startsWith("/usr/lib/") && trimmed.contains("libQt") == false) // exception for libQtuitools and libQtlucene
                          || trimmed.startsWith("@executable_path") || trimmed.startsWith("@loader_path"))
                          return info;
                  ...
                  
                  
                  A 2 Replies Last reply
                  0
                  • R Rondog

                    I think I know how to fix your problem (or pretty sure at least).

                    What is happening is macdeployqt is looking at the path and thinks it is a system file so it is not added to your application (app). I believe the libz.1.dylib is part of zlib and you happen to have it installed in /usr/lib/. I am not sure how it was linked to your plugins but this is less important (but could be the other solution - remove this dependency from your plugins).

                    You will need to modify the source of macdeployqt to fix your problem. From the Qt sources you will find the macdeployqt program and file of interest here: qt-everywhere-opensource-src-5.x.x/qttools/src/macdeployqt/shared/shared.cpp You need to add an exception to allow /usr/lib/libz.1.dylib

                    The function 'parseOtoolLibraryLine(...)' checks the path and (very correctly) doesn't include anything that is likely a system file. In your case /usr/lib/libz.1.dylib is thought to be a system library so it is not included. I am using Qt 5.6.0 and I know you have 5.10.x so there may be some differences in what I posted for source but i suspect they are small.

                    I actually ran into this problem as well. I compiled Qt from sources and installed it in /usr/lib/qt5 using the -prefix option. I know this is not the right place on OSX but it is a location I have used on GNU/Linux and simply stuck with it. I added an exception to the above mentioned file (and function) so that anything starting with /usr/lib/qt5 was not rejected.

                    FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundlePath, const QSet<QString> &rpaths, bool useDebugLibs)
                    {
                        FrameworkInfo info;
                        QString trimmed = line.trimmed();
                    
                        if (trimmed.isEmpty())
                            return info;
                    
                        // Don't deploy system libraries.
                        if (trimmed.startsWith("/System/Library/") ||
                            (trimmed.startsWith("/usr/lib/") && trimmed.contains("libQt") == false) // exception for libQtuitools and libQtlucene
                            || trimmed.startsWith("@executable_path") || trimmed.startsWith("@loader_path"))
                            return info;
                    ...
                    
                    
                    A Offline
                    A Offline
                    Arqam
                    wrote on last edited by
                    #13
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • R Rondog

                      I think I know how to fix your problem (or pretty sure at least).

                      What is happening is macdeployqt is looking at the path and thinks it is a system file so it is not added to your application (app). I believe the libz.1.dylib is part of zlib and you happen to have it installed in /usr/lib/. I am not sure how it was linked to your plugins but this is less important (but could be the other solution - remove this dependency from your plugins).

                      You will need to modify the source of macdeployqt to fix your problem. From the Qt sources you will find the macdeployqt program and file of interest here: qt-everywhere-opensource-src-5.x.x/qttools/src/macdeployqt/shared/shared.cpp You need to add an exception to allow /usr/lib/libz.1.dylib

                      The function 'parseOtoolLibraryLine(...)' checks the path and (very correctly) doesn't include anything that is likely a system file. In your case /usr/lib/libz.1.dylib is thought to be a system library so it is not included. I am using Qt 5.6.0 and I know you have 5.10.x so there may be some differences in what I posted for source but i suspect they are small.

                      I actually ran into this problem as well. I compiled Qt from sources and installed it in /usr/lib/qt5 using the -prefix option. I know this is not the right place on OSX but it is a location I have used on GNU/Linux and simply stuck with it. I added an exception to the above mentioned file (and function) so that anything starting with /usr/lib/qt5 was not rejected.

                      FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundlePath, const QSet<QString> &rpaths, bool useDebugLibs)
                      {
                          FrameworkInfo info;
                          QString trimmed = line.trimmed();
                      
                          if (trimmed.isEmpty())
                              return info;
                      
                          // Don't deploy system libraries.
                          if (trimmed.startsWith("/System/Library/") ||
                              (trimmed.startsWith("/usr/lib/") && trimmed.contains("libQt") == false) // exception for libQtuitools and libQtlucene
                              || trimmed.startsWith("@executable_path") || trimmed.startsWith("@loader_path"))
                              return info;
                      ...
                      
                      
                      A Offline
                      A Offline
                      Arqam
                      wrote on last edited by Arqam
                      #14

                      @Rondog said in Creating .dmg for Qt app mac OSX:

                      5.10.x

                      I edited the shared.cpp file.

                      The error that I get now is the following:

                      QFactoryLoader::QFactoryLoader() checking directory path "/Users/arqam/Desktop/Junk/build-QTDMGProj-Desktop_Qt_5_10_0_clang_64bit-Release/QTDMGProj.app/Contents/PlugIns/platforms" ...
                      QFactoryLoader::QFactoryLoader() looking at "/Users/arqam/Desktop/Junk/build-QTDMGProj-Desktop_Qt_5_10_0_clang_64bit-Release/QTDMGProj.app/Contents/PlugIns/platforms/libqcocoa.dylib"
                      Found metadata in lib /Users/arqam/Desktop/Junk/build-QTDMGProj-Desktop_Qt_5_10_0_clang_64bit-Release/QTDMGProj.app/Contents/PlugIns/platforms/libqcocoa.dylib, metadata=
                      {
                          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                          "MetaData": {
                              "Keys": [
                                  "cocoa"
                              ]
                          },
                          "className": "QCocoaIntegrationPlugin",
                          "debug": false,
                          "version": 329218
                      }
                      
                      
                      Got keys from plugin meta data ("cocoa")
                      QFactoryLoader::QFactoryLoader() checking directory path "/Users/arqam/Desktop/Junk/build-QTDMGProj-Desktop_Qt_5_10_0_clang_64bit-Release/QTDMGProj.app/Contents/MacOS/platforms" ...
                      Cannot load library /Users/arqam/Desktop/Junk/build-QTDMGProj-Desktop_Qt_5_10_0_clang_64bit-Release/QTDMGProj.app/Contents/PlugIns/platforms/libqcocoa.dylib: (dlopen(/Users/arqam/Desktop/Junk/build-QTDMGProj-Desktop_Qt_5_10_0_clang_64bit-Release/QTDMGProj.app/Contents/PlugIns/platforms/libqcocoa.dylib, 133): Library not loaded: @rpath/libQt5PrintSupport.5.dylib
                        Referenced from: /Users/arqam/Desktop/Junk/build-QTDMGProj-Desktop_Qt_5_10_0_clang_64bit-Release/QTDMGProj.app/Contents/PlugIns/platforms/libqcocoa.dylib
                        Reason: image not found)
                      QLibraryPrivate::loadPlugin failed on "/Users/arqam/Desktop/Junk/build-QTDMGProj-Desktop_Qt_5_10_0_clang_64bit-Release/QTDMGProj.app/Contents/PlugIns/platforms/libqcocoa.dylib" : "Cannot load library /Users/arqam/Desktop/Junk/build-QTDMGProj-Desktop_Qt_5_10_0_clang_64bit-Release/QTDMGProj.app/Contents/PlugIns/platforms/libqcocoa.dylib: (dlopen(/Users/arqam/Desktop/Junk/build-QTDMGProj-Desktop_Qt_5_10_0_clang_64bit-Release/QTDMGProj.app/Contents/PlugIns/platforms/libqcocoa.dylib, 133): Library not loaded: @rpath/libQt5PrintSupport.5.dylib\n  Referenced from: /Users/arqam/Desktop/Junk/build-QTDMGProj-Desktop_Qt_5_10_0_clang_64bit-Release/QTDMGProj.app/Contents/PlugIns/platforms/libqcocoa.dylib\n  Reason: image not found)"
                      This application failed to start because it could not find or load the Qt platform plugin "cocoa"
                      in "".
                      
                      Available platform plugins are: cocoa.
                      
                      Reinstalling the application may fix this problem.
                      Abort trap: 6
                      

                      I tried with both the lines in my .pro file :

                      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
                      

                      as well as without printsupport but it gives the same error of Library not loaded: @rpath/libQt5PrintSupport.5.dylib

                      Is it because of anything that I did? When I run otool -L libcocoa.dylib I get the following :

                      libqcocoa.dylib:
                      	@rpath/../plugins/platforms/libqcocoa.dylib (compatibility version 0.0.0, current version 0.0.0)
                      	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 21.0.0)
                      	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
                      	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
                      	/usr/lib/libcups.2.dylib (compatibility version 2.0.0, current version 2.11.0)
                      	/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
                      	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
                      	@rpath/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
                      	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0)
                      	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1343.14.0)
                      	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
                      	@rpath/libQt5PrintSupport.5.dylib (compatibility version 5.6.0, current version 5.6.2)
                      	@rpath/libQt5Widgets.5.dylib (compatibility version 5.6.0, current version 5.6.2)
                      	@rpath/libQt5Gui.5.dylib (compatibility version 5.6.0, current version 5.6.2)
                      	@rpath/libQt5Core.5.dylib (compatibility version 5.6.0, current version 5.6.2)
                      	/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)
                      	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1151.16.0)
                      	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 62.0.0)
                      	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1151.16.0)
                      	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
                      

                      In the Framework folder I have these three only :
                      QtCore.framework QtGui.framework QtWidgets.framework
                      And what it is searching for is @rpath/libQt5PrintSupport.5.dylib and the library that I have in path : /Contents/PlugIns/printsupport is libcocoaprintersupport.dylib

                      @Rondog Please mail me : So that I can reply as soon as you post. Email : arq.ahmad.arqam@gmail.com

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        Rondog
                        wrote on last edited by Rondog
                        #15

                        I am not sure if I was clear about modifying the utility macdeployqt. After you change this program you need to compile it and make sure you are actually using the new version when it is used.

                        To add an exception for the libz.1.dylib the function parseOtoolLibraryLine(...) might end up looking like this:

                        FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundlePath, const QSet<QString> &rpaths, bool useDebugLibs)
                        {
                            FrameworkInfo info;
                            QString trimmed = line.trimmed();
                        
                            if (trimmed.isEmpty())
                                return info;
                        
                            if(trimmed.startsWith("/usr/lib/libz.1.dylib") == false) // specifically allow this file.
                            {
                        		// Don't deploy system libraries.
                        		if (trimmed.startsWith("/System/Library/") ||
                        			(trimmed.startsWith("/usr/lib/") && trimmed.contains("libQt") == false) // exception for libQtuitools and libQtlucene
                        			|| trimmed.startsWith("@executable_path") || trimmed.startsWith("@loader_path"))
                        			return info;
                            }
                        ...
                        

                        After changing this file you need to compile it. From the directory of macdeployqt (i.e. qt-everywhere-opensource-src-5.x.x/qttools/src/macdeployqt) you need to compile from the terminal:

                        cd ~/<wherever you have the qt sources>/qttools/src/macdeployqt
                        make
                        

                        If you only have the sources and a precompiled version of Qt you probably need to do something like this to create the make files:

                        cd ~/<wherever you have the qt sources>/qttools/src/macdeployqt
                        qmake
                        make
                        

                        You need to make sure that you are actually using the new compiled version when you run this program. You need to copy the new version to the location where you currently have the binary macdeployqt application or specify the full path to the executable when running it.

                        The end result of all this is that you should see the libz.1.dylib library somewhere in your app bundle.

                        The other item (libQt5PrintSupport.5.dylib) is something I did notice previously. One thing you could try is to copy the missing framework into the app (same layout as the other frameworks) and see if it makes a difference. I am not sure if the framework is adjusted like all the other executables (i.e. using @rpath/...) but it should be suitable as a test regardless if it is modified. It will tell you if you need to get this packaged with the rest of your app.

                        Note: When you run macdeployqt you can ask it for more details about what it is doing by adding the switch -verbose

                        -verbose=<0-3>     : 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug
                        
                        A 1 Reply Last reply
                        3
                        • R Rondog

                          I am not sure if I was clear about modifying the utility macdeployqt. After you change this program you need to compile it and make sure you are actually using the new version when it is used.

                          To add an exception for the libz.1.dylib the function parseOtoolLibraryLine(...) might end up looking like this:

                          FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundlePath, const QSet<QString> &rpaths, bool useDebugLibs)
                          {
                              FrameworkInfo info;
                              QString trimmed = line.trimmed();
                          
                              if (trimmed.isEmpty())
                                  return info;
                          
                              if(trimmed.startsWith("/usr/lib/libz.1.dylib") == false) // specifically allow this file.
                              {
                          		// Don't deploy system libraries.
                          		if (trimmed.startsWith("/System/Library/") ||
                          			(trimmed.startsWith("/usr/lib/") && trimmed.contains("libQt") == false) // exception for libQtuitools and libQtlucene
                          			|| trimmed.startsWith("@executable_path") || trimmed.startsWith("@loader_path"))
                          			return info;
                              }
                          ...
                          

                          After changing this file you need to compile it. From the directory of macdeployqt (i.e. qt-everywhere-opensource-src-5.x.x/qttools/src/macdeployqt) you need to compile from the terminal:

                          cd ~/<wherever you have the qt sources>/qttools/src/macdeployqt
                          make
                          

                          If you only have the sources and a precompiled version of Qt you probably need to do something like this to create the make files:

                          cd ~/<wherever you have the qt sources>/qttools/src/macdeployqt
                          qmake
                          make
                          

                          You need to make sure that you are actually using the new compiled version when you run this program. You need to copy the new version to the location where you currently have the binary macdeployqt application or specify the full path to the executable when running it.

                          The end result of all this is that you should see the libz.1.dylib library somewhere in your app bundle.

                          The other item (libQt5PrintSupport.5.dylib) is something I did notice previously. One thing you could try is to copy the missing framework into the app (same layout as the other frameworks) and see if it makes a difference. I am not sure if the framework is adjusted like all the other executables (i.e. using @rpath/...) but it should be suitable as a test regardless if it is modified. It will tell you if you need to get this packaged with the rest of your app.

                          Note: When you run macdeployqt you can ask it for more details about what it is doing by adding the switch -verbose

                          -verbose=<0-3>     : 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug
                          
                          A Offline
                          A Offline
                          Arqam
                          wrote on last edited by Arqam
                          #16

                          @Rondog Right now I am using the QT installed using the installer. I have generated the Src using Maintenance tool.
                          So when I make the QT src, will the QTCreator use the new library or the one that I got using QT installer already?

                          1 Reply Last reply
                          0
                          • R Offline
                            R Offline
                            Rondog
                            wrote on last edited by
                            #17

                            @Arqam Somewhere on your computer you will have the binary version of macdeployqt that QtCreator is using (likely in the bin folder from wherever Qt is installed). After you compile the new version you need to make sure it ends up in the proper location. Just rename the old one and copy the new one in its place. You can do a search to find all copies of this binary just to be sure.

                            I assume QtCreator is not using its own version of macdeployqt. I am also assuming that you are only compiling macdeployqt. If you are thinking of compiling all of Qt this is a bit more work. I don't think you need to compile all of Qt (at least I would hope not).

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

                              Qt Creator uses the tools from the Qt version assigned to the Kit used to build the application.

                              And no, there's no need to re-build all of Qt to build only one module.

                              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
                              • R Rondog

                                @Arqam Somewhere on your computer you will have the binary version of macdeployqt that QtCreator is using (likely in the bin folder from wherever Qt is installed). After you compile the new version you need to make sure it ends up in the proper location. Just rename the old one and copy the new one in its place. You can do a search to find all copies of this binary just to be sure.

                                I assume QtCreator is not using its own version of macdeployqt. I am also assuming that you are only compiling macdeployqt. If you are thinking of compiling all of Qt this is a bit more work. I don't think you need to compile all of Qt (at least I would hope not).

                                A Offline
                                A Offline
                                Arqam
                                wrote on last edited by
                                #19

                                @Rondog
                                When I run qmake I get the following : /Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/Src/qttools/.qmake.conf:1: Cannot find feature qt_build_config Could not find qmake configuration file macx-clang. Error processing project file: /Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/Src/qttools/src/macdeployqt/macdeployqt.pro

                                And when I run make I get the following :
                                make: *** No targets specified and no makefile found. Stop.

                                Am I doing something wrong?

                                1 Reply Last reply
                                0
                                • R Offline
                                  R Offline
                                  Rondog
                                  wrote on last edited by
                                  #20

                                  I am not sure how this should be done. I always download the sources and compile Qt for each OS that I plan to run on. For me it is as simple as opening a terminal window and entering the command 'make'.

                                  If you open the macdeployqt program in QtCreator can you compile it from there?

                                  Maybe try running the configure command from the folder qtbase of the source tree (this configures everything and creates all the make files) then run 'make' from the qttools folder.

                                  There must be some notes somewhere about working with the sources from a pre-compiled version of Qt.

                                  A 1 Reply Last reply
                                  0
                                  • R Rondog

                                    I am not sure how this should be done. I always download the sources and compile Qt for each OS that I plan to run on. For me it is as simple as opening a terminal window and entering the command 'make'.

                                    If you open the macdeployqt program in QtCreator can you compile it from there?

                                    Maybe try running the configure command from the folder qtbase of the source tree (this configures everything and creates all the make files) then run 'make' from the qttools folder.

                                    There must be some notes somewhere about working with the sources from a pre-compiled version of Qt.

                                    A Offline
                                    A Offline
                                    Arqam
                                    wrote on last edited by
                                    #21

                                    @Rondog I was getting the errors because I was using macdeployqt but when I used the full path /Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/bin/macdeployqt then it worked properly.

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

                                      You have several versions of Qt installed ?

                                      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

                                      • Login

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