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. Error deploying Qt application on OS X
Forum Updated to NodeBB v4.3 + New Features

Error deploying Qt application on OS X

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 3 Posters 6.2k 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.
  • P patrik08

    This is a sample output fromm otool

    cd OasisEdit.app/Contents/MacOS
    OasisEdit
    MacBook-Pro-di-dev:MacOS dev$ 
    MacBook-Pro-di-dev:MacOS dev$ otool -L ./OasisEdit
    ./OasisEdit:
    	@rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.9.0, current version 5.9.1)
    	@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.9.0, current version 5.9.1)
    	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.9.0, current version 5.9.1)
    	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.9.0, current version 5.9.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/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.9.0, current version 5.9.1)
    	@rpath/QtPdfium.framework/Versions/5/QtPdfium (compatibility version 5.5.0, current version 5.5.0)
    	@rpath/QtXml.framework/Versions/5/QtXml (compatibility version 5.9.0, current version 5.9.1)
    	@rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.9.0, current version 5.9.1)
    	@rpath/QtTextToSpeech.framework/Versions/5/QtTextToSpeech (compatibility version 5.9.0, current version 5.9.2)
    	/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 120.1.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
    
    

    after you chance install_name_tool -change
    from local framework to bundle dir.. & copy the framework to bundle ...

    K Offline
    K Offline
    KelvinSP
    wrote on last edited by KelvinSP
    #6

    @patrik08 thanks for the help, but I'm not finding the path I must change.

    There is no qwt.framework in my Qt path: /Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/.

    When I run otool in MyApplication.app I get this:

    cd MyApplication.app/Contents/MacOS
    otool -L ./MyApplication
    ./MyApplication:
    	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1349.64.0)
    	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    	qwt.framework/Versions/6/qwt (compatibility version 6.1.0, current version 6.1.0)
    	/opt/local/lib/libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    	/opt/local/lib/libboost_filesystem-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    	/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.3.0, current version 5.3.2)
    	/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.0, current version 5.3.2)
    	/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.0, current version 5.3.2)
    	/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2)
    	/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.3.0, current version 5.3.2)
    	/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtSql.framework/Versions/5/QtSql (compatibility version 5.3.0, current version 5.3.2)
    	/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 307.5.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2)
    `
    
    1 Reply Last reply
    0
    • P Offline
      P Offline
      patrik08
      wrote on last edited by
      #7

      @KelvinSP said in Error deploying Qt application on OS X:

      qwt.framework/Versions/6/qwt

      Ok...
      waht is this?
      qwt.framework/Versions/6/qwt

      #!/bin/bash
      dir=$(pwd)
      echo "$dir"
      echo RUNNING Clean .... hight voltage...rm!!
      rm -rf MyApplication.app  .moc .obj .rcc mkspecs Makefile .qmake.stash .qmake.cache
      find . -name '.DS_Store' -type f -delete
      find . -name 'Makefile' -type f -delete
      find . -name 'Makefile.Release' -type f -delete
      find . -name 'Makefile.Debug' -type f -delete
      qmake && make && macdeployqt MyApplication.app 
      

      run this…
      at end rename for 5 min. dir /Users/kelvinsp/Qt5.3.2/ to /Users/kelvinsp/____Qt5.3.2/
      test your bundle if run and if not run must link more shared elements…

      #only at end … if sure lib are inside -dmg

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

        Hi,

        Because it's locate in /usr/local/qwt-6.1.0 as you show in your post.

        The most simple thing to do is to use install_name_tool and change the -id property so it contains the full path to the lib. Then it should be locatable by macdeployqt. One other possibility is to use @rpath rather than the full path like shown in @patrik08 example otool call.

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

        K 1 Reply Last reply
        0
        • P patrik08

          @KelvinSP said in Error deploying Qt application on OS X:

          qwt.framework/Versions/6/qwt

          Ok...
          waht is this?
          qwt.framework/Versions/6/qwt

          #!/bin/bash
          dir=$(pwd)
          echo "$dir"
          echo RUNNING Clean .... hight voltage...rm!!
          rm -rf MyApplication.app  .moc .obj .rcc mkspecs Makefile .qmake.stash .qmake.cache
          find . -name '.DS_Store' -type f -delete
          find . -name 'Makefile' -type f -delete
          find . -name 'Makefile.Release' -type f -delete
          find . -name 'Makefile.Debug' -type f -delete
          qmake && make && macdeployqt MyApplication.app 
          

          run this…
          at end rename for 5 min. dir /Users/kelvinsp/Qt5.3.2/ to /Users/kelvinsp/____Qt5.3.2/
          test your bundle if run and if not run must link more shared elements…

          #only at end … if sure lib are inside -dmg

          K Offline
          K Offline
          KelvinSP
          wrote on last edited by
          #9

          @patrik08 Ok... When I run the qmake && make && macdeployqt MyApplication.app command I get the following result:

          Usage: qmake [mode] [options] [files]
          
          QMake has two modes, one mode for generating project files based on
          some heuristics, and the other for generating makefiles. Normally you
          shouldn't need to specify a mode, as makefile generation is the default
          mode for qmake, but you may use this to test qmake on an existing project
          
          Mode:
            -project       Put qmake into project file generation mode
                           In this mode qmake interprets files as files to
                           be built,
                           defaults to *; *; *; *.ts; *.xlf; *.qrc
                           Note: The created .pro file probably will
                           need to be edited. For example add the QT variable to
                           specify what modules are required.
            -makefile      Put qmake into makefile generation mode (default)
                           In this mode qmake interprets files as project files to
                           be processed, if skipped qmake will try to find a project
                           file in your current working directory
          
          Warnings Options:
            -Wnone         Turn off all warnings; specific ones may be re-enabled by
                           later -W options
            -Wall          Turn on all warnings
            -Wparser       Turn on parser warnings
            -Wlogic        Turn on logic warnings (on by default)
            -Wdeprecated   Turn on deprecation warnings (on by default)
          
          Options:
             * You can place any variable assignment in options and it will be *
             * processed as if it was in [files]. These assignments will be    *
             * processed before [files] by default.                            *
            -o file        Write output to file
            -d             Increase debug level
            -t templ       Overrides TEMPLATE as templ
            -tp prefix     Overrides TEMPLATE so that prefix is prefixed into the value
            -help          This help
            -v             Version information
            -early         All subsequent variable assignments will be
                           parsed right before default_pre.prf
            -before        All subsequent variable assignments will be
                           parsed right before [files] (the default)
            -after         All subsequent variable assignments will be
                           parsed after [files]
            -late          All subsequent variable assignments will be
                           parsed right after default_post.prf
            -norecursive   Don't do a recursive search
            -recursive     Do a recursive search
            -set <prop> <value> Set persistent property
            -unset <prop>  Unset persistent property
            -query <prop>  Query persistent property. Show all if <prop> is empty.
            -qtconf file   Use file instead of looking for qt.conf
            -cache file    Use file as cache           [makefile mode only]
            -spec spec     Use spec as QMAKESPEC       [makefile mode only]
            -nocache       Don't use a cache file      [makefile mode only]
            -nodepend      Don't generate dependencies [makefile mode only]
            -nomoc         Don't generate moc targets  [makefile mode only]
            -nopwd         Don't look for files in pwd [project mode only]
          
          1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Because it's locate in /usr/local/qwt-6.1.0 as you show in your post.

            The most simple thing to do is to use install_name_tool and change the -id property so it contains the full path to the lib. Then it should be locatable by macdeployqt. One other possibility is to use @rpath rather than the full path like shown in @patrik08 example otool call.

            K Offline
            K Offline
            KelvinSP
            wrote on last edited by
            #10

            @SGaist thanks for the help. It makes sense, but I have never used the install_name_tool command, so I don't know how can I do that. I will search about it.

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

              man insall_name_tool explains all options.

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

                Here config target from qwt ...
                You can also chance the qmake from qwt and build a static lib..

                unix {
                    QWT_INSTALL_PREFIX    = /usr/local/qwt-$$QWT_VERSION
                    # QWT_INSTALL_PREFIX = /usr/local/qwt-$$QWT_VERSION-qt-$$QT_VERSION
                }
                /usr/local/qwt-6.1.3
                

                or adapt th script from https://raw.githubusercontent.com/pehohlva/xhtml_edit_qedit_base/master/mac_bundle/grep.sh

                1 Reply Last reply
                1
                • P Offline
                  P Offline
                  patrik08
                  wrote on last edited by
                  #13

                  Also my best simply solution is:

                  /// on qwt macdeployqt say:
                  macdeployqt radio.app
                  ERROR: no file at "/Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt"
                  

                  Also i tested:

                  console:
                  sudo mkdir -p /Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/
                  
                  after you make a symply bridge as virtual link.
                  
                  ln -s /usr/local/qwt-6.1.3/lib/qwt.framework/Versions/Current/qwt \
                                     /Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt
                  

                  at end :
                  macdeployqt radio.app
                  make a super job and link & copy all in the bundle :-)
                  by by ...

                  K 1 Reply Last reply
                  1
                  • P patrik08

                    Also my best simply solution is:

                    /// on qwt macdeployqt say:
                    macdeployqt radio.app
                    ERROR: no file at "/Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt"
                    

                    Also i tested:

                    console:
                    sudo mkdir -p /Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/
                    
                    after you make a symply bridge as virtual link.
                    
                    ln -s /usr/local/qwt-6.1.3/lib/qwt.framework/Versions/Current/qwt \
                                       /Library/Frameworks/qwt.framework/Versions/6/qwt.framework/Versions/6/qwt
                    

                    at end :
                    macdeployqt radio.app
                    make a super job and link & copy all in the bundle :-)
                    by by ...

                    K Offline
                    K Offline
                    KelvinSP
                    wrote on last edited by KelvinSP
                    #14

                    @patrik08 I have tried it and it worked (at least the message it's gone). As I understand it doesn't fix the problem directly but it's a great workaround.

                    The only problem is that now I'm getting the following errors when trying to run macdeployqt MyApplication.app -dmg:

                    ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtSvg.framework/Contents/Info.plist"
                    ERROR:  to "MyApplication.app/Contents/Frameworks/QtSvg.framework/Resources/Info.plist"
                    QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtSvg.framework/Resources/Info.plist"): device not open
                    QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtSvg.framework/Resources/Info.plist"): device not open
                    ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtWidgets.framework/Contents/Info.plist"
                    ERROR:  to "MyApplication.app/Contents/Frameworks/QtWidgets.framework/Resources/Info.plist"
                    QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtWidgets.framework/Resources/Info.plist"): device not open
                    QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtWidgets.framework/Resources/Info.plist"): device not open
                    ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtGui.framework/Contents/Info.plist"
                    ERROR:  to "MyApplication.app/Contents/Frameworks/QtGui.framework/Resources/Info.plist"
                    QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtGui.framework/Resources/Info.plist"): device not open
                    QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtGui.framework/Resources/Info.plist"): device not open
                    ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtCore.framework/Contents/Info.plist"
                    ERROR:  to "MyApplication.app/Contents/Frameworks/QtCore.framework/Resources/Info.plist"
                    QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtCore.framework/Resources/Info.plist"): device not open
                    QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtCore.framework/Resources/Info.plist"): device not open
                    ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtPrintSupport.framework/Contents/Info.plist"
                    ERROR:  to "MyApplication.app/Contents/Frameworks/QtPrintSupport.framework/Resources/Info.plist"
                    QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtPrintSupport.framework/Resources/Info.plist"): device not open
                    QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtPrintSupport.framework/Resources/Info.plist"): device not open
                    ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtSql.framework/Contents/Info.plist"
                    ERROR:  to "MyApplication.app/Contents/Frameworks/QtSql.framework/Resources/Info.plist"
                    QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtSql.framework/Resources/Info.plist"): device not open
                    QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtSql.framework/Resources/Info.plist"): device not open
                    ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtOpenGL.framework/Contents/Info.plist"
                    ERROR:  to "MyApplication.app/Contents/Frameworks/QtOpenGL.framework/Resources/Info.plist"
                    QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtOpenGL.framework/Resources/Info.plist"): device not open
                    QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtOpenGL.framework/Resources/Info.plist"): device not open
                    ERROR: file copy failed from "/Users/kelvinsp/Qt5.3.2/5.3/clang_64/lib/QtConcurrent.framework/Contents/Info.plist"
                    ERROR:  to "MyApplication.app/Contents/Frameworks/QtConcurrent.framework/Resources/Info.plist"
                    QIODevice::read (QFile, "MyApplication.app/Contents/Frameworks/QtConcurrent.framework/Resources/Info.plist"): device not open
                    QIODevice::write (QFile, "MyApplication.app/Contents/Frameworks/QtConcurrent.framework/Resources/Info.plist"): device not open
                    
                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      patrik08
                      wrote on last edited by
                      #15

                      The app run without -dmg?
                      can you open app & work it?
                      I like to look this app like this...
                      https://www.youtube.com/watch?v=hJDvKud8RWs
                      search Mac Screen Recorder ...

                      K 1 Reply Last reply
                      0
                      • P patrik08

                        The app run without -dmg?
                        can you open app & work it?
                        I like to look this app like this...
                        https://www.youtube.com/watch?v=hJDvKud8RWs
                        search Mac Screen Recorder ...

                        K Offline
                        K Offline
                        KelvinSP
                        wrote on last edited by KelvinSP
                        #16

                        @patrik08 the application runs directly from the Qt and when I double click on it, but only before running the macdeployqt command.

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          patrik08
                          wrote on last edited by patrik08
                          #17

                          @KelvinSP said in Error deploying Qt application on OS X:

                          macdeployqt

                          The job from macdeployqt is only take all file and relink lib or framework .. if file an all exist its not give problem..
                          to build a dir/bundle & at end hdiutil create a bzip2 compressed dmg image like a iso file...

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

                            Did you re-run macdeployqt several times on the same app bundle ? If so, you'll get a message telling you that it already has run.

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

                            K 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Did you re-run macdeployqt several times on the same app bundle ? If so, you'll get a message telling you that it already has run.

                              K Offline
                              K Offline
                              KelvinSP
                              wrote on last edited by KelvinSP
                              #19

                              @SGaist Yes, I did. I received the following message:

                              WARNING: Could not find any external Qt frameworks to deploy in "MyApplication.app"
                              WARNING: Perhaps macdeployqt was already used on "MyApplication.app" ?
                              WARNING: If so, you will need to rebuild "MyApplication.app" before trying again.
                              

                              The DMG file was created but the application still not working (when double clicking).

                              Note: every time I test a new macdelpoyqt command, I rebuild the project first.

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                KelvinSP
                                wrote on last edited by KelvinSP
                                #20

                                I have uninstalled other qt versions using brew list, brew remove qt and brew remove qt5. I also noted that I had pyqt installed (and I was not using it), so I also remove it using brew remove pyqt.

                                Then, I have reinstalled Qt 5.3.2 and had other issues:

                                Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.

                                Which was solved changing the isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))) command from the Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf file to isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))), as explained here: https://stackoverflow.com/questions/33728905/qt-creator-project-error-xcode-not-set-up-properly-you-may-need-to-confirm-t

                                and

                                Could not resolve SDK path for 'macosx10.8'

                                That was solved by changing the QtPath/5.3/clang_64/mkspecs/qdevice.pri from !host_build:QMAKE_MAC_SDK = macosx10.8 to !host_build:QMAKE_MAC_SDK = macosx10.12, as explained here: https://stackoverflow.com/questions/26320677/error-could-not-resolve-sdk-path-for-macosx10-8

                                So, I run the command from my Qt directory:

                                /Users/kuser/Qt5.3.2/5.3/clang_64/bin/macdeployqt MyApplication.app -dmg
                                

                                and it worked.

                                I found these solutions in comments from the following question:

                                https://stackoverflow.com/questions/19988129/qt5-cannot-find-platform-plugins-mac-os-x

                                Thanks a lot @SGaist and @patrik08 for all the help.

                                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