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. macdeployqt does not work on Qt 5.6 + Qt 5.7 install_name_tool, otool - How to deploy for macOS ? (Including instructions)
Forum Updated to NodeBB v4.3 + New Features

macdeployqt does not work on Qt 5.6 + Qt 5.7 install_name_tool, otool - How to deploy for macOS ? (Including instructions)

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 5 Posters 4.7k 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.
  • M Offline
    M Offline
    MZM1
    wrote on last edited by MZM1
    #1

    (For the solution, scroll down to my latest post.)

    If you get this:

    macdeployqt
    

    destroys your binaries... it does not work.

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

    http://doc.qt.io/qt-5/osx-deployment.html
    (does also not work)

    I have a macOS app with:

    @__rpath__/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.6.0, current version 5.6.0)
    @__rpath__/QtGui.framework/Versions/5/QtGui (compatibility version 5.6.0, current version 5.6.0)
    @__rpath__/QtCore.framework/Versions/5/QtCore (compatibility version 5.6.0, current version 5.6.0)

    (rpath is the default)

    But how does this work for DYNAMIC distribution on a Mac not Qt installed?

    ./myapp.app/Contents/MacOS/myapp
    This application failed to start because it could not find or load the Qt platform plugin "cocoa"
    in "".
    
    Reinstalling the application may fix this problem.
    
    Abort trap: 6
    

    I also used the tool
    otool -L

    and

    install_name_tool

    Nothing worked. Misleading documents and guidelines everywhere out there. Including on official Qt documents.

    Provide a (ONE!) strait forward example with steps witch work. Everybody can adapt this.
    (For the solution, scroll down to my latest post.)

    https://www.flagsoft.com - Software for you Mac

    1 Reply Last reply
    -2
    • K Offline
      K Offline
      kegon
      wrote on last edited by
      #2

      I haven't tried Qt 5.7 yet; I am on an older subversion of Qt 5. But it seems you are still building on 5.6, NOT 5.7 because you say your app has

      @rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.6.0, current version 5.6.0)
      

      etc.

      I suggest make clean and re run qmake on your project file, then make again to get a 5.7 build.

      You ask "But how does this work for DYNAMIC distribution on a Mac not Qt installed?" - this is not clear to me: the deploy tool is to package Qt libraries (and other dependencies) so that the tool can be run on other machines that don't have them installed. There is no point deploying for a machine that already has the environment available.

      If you are still having problems I suggest you post the output of otool -L on your binary.

      1 Reply Last reply
      0
      • Joel BodenmannJ Offline
        Joel BodenmannJ Offline
        Joel Bodenmann
        wrote on last edited by
        #3

        I think that you are being a bit harsh here. When something isn't working for you it doesn't mean that it's not working in general. If you post the problem that you're facing and what you tried to do and so on people will be happy to help you. But statements like the ones you made will not motivate anybody to help you.

        If there would be a general issue with the tool or the documentation which would make it something "that just doesn't work" or that comes with "useless documentation" you would find confirmation for the existence of such an issue by using any kind of search engine. The fact that you won't find it means that it appears to be working for most people - people that in general would be happy to help you.

        I am using Qt 5.7 and following the official documentation I have no problems getting macdeploqt working.
        Please don't forget that this is an open source project. If you feel like the documentation needs improvement then you are more than welcomed to contribute that. Just randomly ranting around is not going to help at all - especially not you because then people loose motivation to help.

        Industrial process automation software: https://simulton.com
        Embedded Graphics & GUI library: https://ugfx.io

        1 Reply Last reply
        1
        • M Offline
          M Offline
          MZM1
          wrote on last edited by MZM1
          #4

          Sure, I checked any doc I could found. Nothing helped.

          Documentation, there is no button below where users can provide suggestions, solutions, etc. would be cool to have something like on php dot net. (Examples. Nobody likes to read a list of function names, but examples, not just code fragments.)

          There are many clowns who post some suggestions, and "try this" and "try that" and some code fragments which don't work... wast of time. Why not document it correctly (With version numbers + date )?

          It seems to be that I have Qt 5.6 installed... (Qt Creator 4.0 at least) but this is also another problem, if you have an old version somewhere on an other partition or ... somehow mac finds a library...

          $ otool -L ./my.app/Contents/MacOS/my
          ./my.app/Contents/MacOS/my:
          	@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.6.0, current version 5.6.0)
          	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.6.0, current version 5.6.0)
          	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.6.0, current version 5.6.0)
          	/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)
          $ 
          

          This @rpath how does this work?

          I just want the Qt lib untouched linked dynamically. The official doc says something that this should go within the bunld ./Frameworks/

          I checked:
          http://doc.qt.io/qt-5/osx-deployment.html
          http://matthew-brett.github.io/docosx/mac_runtime_link.html
          http://stackoverflow.com/questions/29858166/deployment-of-qt-application-on-mac
          etc.
          nothing worked.

          Getting "cocoa" plugin is missing etc.

          But, I just want to be able to run my binary on a mac which does not have Qt installed.
          (The method documented by Qt is to have it in ./Framework/ but what is required to the binary / libs is not clear. Do I have to do ID? -change ? etc. but with this RPATH this should not be required?
          Who knows... This let's the user to play an endless guessing game...)

          I think I will try 5.7 if this tool
          macdeploqt really works, it would be fine.

          TESTING: It seems to be that no company does any serious testing any more... even Apple does a little testing on there OS ... said to say, but it's true. I did test them... ;) Filing 50+ bugs... nothing helped.
          Answer: Can you reproduce it? Hmm... not every bug can be reproduced. So, IF they just use there OS every day for simple tasked they would noticed these bugs... but this is an other story.

          https://www.flagsoft.com - Software for you Mac

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MZM1
            wrote on last edited by MZM1
            #5

            New Qt 5.7:

            Built, can run from within Qt Designer and with double click from within Finder.

            BUT:

            $ macdeployqt MyApp.app
            WARNING:              <--- ?
            WARNING: Could not find any external Qt frameworks to deploy in "MyApp.app"   <-- ? "external Qt framework" What does this mean? Qt itself or not? or both?
            WARNING: Perhaps macdeployqt was already used on "MyApp.app" ?  <-- no...
            WARNING: If so, you will need to rebuild "MyApp.app" before trying again.  < -- no...
            $ 
            

            (I tried with -verbose=3 but this gives the same WARNINGs and results.)

            How does this work?

            "macdeployqt takes an application bundle as input and makes it
            self-contained by copying in the Qt frameworks and plugins that
            the application uses. "

            Should this copy the required Qt libs to the .app bundle? Right? But it does not.

            Do I need something like:

            /*
            	QDir dir(QApplication::applicationDirPath());
            
                qDebug() << "dir.path: " << dir.path();
            
            	dir.cdUp();
                dir.cd("PlugIns");  // plugins  Frameworks
            
                QString absPath = dir.absolutePath();
            
                qDebug() << "d: looking for Qt Frameworks in: " << absPath;
                QApplication::addLibraryPath(absPath);  //QStringList( setLibraryPaths
            */
            

            Within main ? How knows... the new 5.7 doc says something about it. But this should to the tool? Or not? What does the tool and what not? It's not clear.

            Can I just use this tool, and it should be fine? (working on a mac which does not have Qt installed)?

            https://www.flagsoft.com - Software for you Mac

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MZM1
              wrote on last edited by MZM1
              #6

              Ok, I think I did it.
              Solution:

              • It was basically a side effect of

              ANACODA - Leading Open Data Science Platform Powered by Python
              See https://www.continuum.io/why-anaconda

              $ echo $PATH
              /Users/michi/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin

              So just edit .bash_profile

              $ vi .bash_profile
              
              # added by Anaconda2 4.0.0 installer
              export PATH="/Users/michi/anaconda/bin:$PATH"
              

              This installer from Anaconda2 4.0.0 added a path.

              (Add your Qt Path there before anything else.)
              Which interfere regular Qt installations.

              Instructions, How to use macdeployqt

              (3 simple steps)

              1. Make sure you use the right tool of your Qt installation

              $ which macdeployqt
              /Users/michi/Qt/5.7/clang_64/bin/macdeployqt
              

              (It this points to somewhere else, check you PATH settings, change PATH and restart and Terminal or source .bash_profile)

              2. Run macdeployqt

              $ macdeployqt MyApp.app -dmg
              

              or just

              $ macdeployqt MyApp.app
              

              for a single .app file.

              3. Check your binary

              Just rename the Qt main installation folder (for example from Qt to Qt-DISABLED) within the Finder.
              Then try to start your binary. It should work and use the Qt frameworks within your .app bundle.
              (Don't forget to rename qt main installation folder back to it's original name, most of the time this is "Qt")

              The result binary now look like the following:

              MyApp.app:
              	Contents:
              		Frameworks:
              			QtCore.framework:
              				QtCore
              				Resources
              				Versions:
              					5:
              						QtCore
              						Resources:
              							Info.plist
              					Current
              			QtDBus.framework:
              				QtDBus
              				Resources
              				Versions:
              					5:
              						QtDBus
              						Resources:
              							Info.plist
              					Current
              			QtGui.framework:
              				QtGui
              				Resources
              				Versions:
              					5:
              						QtGui
              						Resources:
              							Info.plist
              					Current
              			QtPrintSupport.framework:
              				QtPrintSupport
              				Resources
              				Versions:
              					5:
              						QtPrintSupport
              						Resources:
              							Info.plist
              					Current
              			QtWidgets.framework:
              				QtWidgets
              				Resources
              				Versions:
              					5:
              						QtWidgets
              						Resources:
              							Info.plist
              					Current
              		Info.plist
              		MacOS:
              			
              		PkgInfo
              		PlugIns:
              			imageformats:
              				libqdds.dylib
              				libqgif.dylib
              				libqicns.dylib
              				libqico.dylib
              				libqjpeg.dylib
              				libqmacjp2.dylib
              				libqtga.dylib
              				libqtiff.dylib
              				libqwbmp.dylib
              				libqwebp.dylib
              			platforms:
              				libqcocoa.dylib
              			printsupport:
              				libcocoaprintersupport.dylib
              		Resources:
              			appicon.icns
              			empty.lproj
              			qt.conf
              
              

              PS:
              macdeployqt - works. Just use it.
              Fancy operations with *otool and install_name_tool required are NOT required at all.

              This would be helpful:
              So, switching between different Qt installations would be helpful, tool-chain, etc.
              And a hint of which tool-chain you currently use for command line tools. There are a few other libs and tools out there which uses Qt as a framework.

              Happy hacking ;)

              https://www.flagsoft.com - Software for you Mac

              1 Reply Last reply
              0
              • SolarIQS Offline
                SolarIQS Offline
                SolarIQ
                wrote on last edited by
                #7

                I can not confirm, that macdeployqt in 5.7 works fine. In my project the only LC_RPATH existing in binary is
                Load command 37
                cmd LC_RPATH
                cmdsize 48
                path /Users/xxx/Qt/5.6/clang_64/lib/ (offset 12)

                Which is definitely not correct. Perhaps this happens because of my QT env setting, but this is severe bug, since my clients won't have the QT installed by that path while everything fine on my computer if I had correct env setting. Previous (5.6) version correctly sets up:
                Load command 37
                cmd LC_RPATH
                cmdsize 48
                path @executable_path/../Frameworks (offset 12)

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

                  Macdeployqt works on my system (OS 10.10.5 Qt 5.6.0). I use it often and with previous versions of Qt.

                  If you have a look at what this program actually does you will find it is just a wrapper to do a specific set of steps on the OS. The utilities used that actually do the work are expected to exist on your computer already (like otool, hdiutil, ...). If you have a problem with this utility the most likely source is your computer setup. All this program does is automate a few steps that you need to perform to package an app for distribution. Think of it more like an elaborate shell script.

                  One thing you cannot do is run macdeployqt on the same app twice. You need an un-touched app in order for this program to extract the path names.

                  The only issue I run into with macdeployqt is the resource icons. I deal with this by not creating the DMG file when using macdeployqt. I change the app folder as needed then run the hdiutil to create the DMG package. It is not something fatal if not done this way.

                  1 Reply Last reply
                  1

                  • Login

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