Deploy QT app on Mac OSX



  • I have a QT project which uses openCV as an external library.
    I build openCV in Qt project using the following guidelines : https://www.learnopencv.com/configuring-qt-for-opencv-on-osx/

    Now, I have to create .dmg for my Qt app, and have to release the app. I went through the documentation for deployment but could not understand properly how to build for the release mode.

    Especially when the documentation is for Qt 4.8 and the example project that is being talked about is not there in my new version of Qt.

    I am new to Qt, and thus facing some newbie problems. Basically, I want to understand :

    • How to actually build the app to get the .dmg file in release mode.

    Link for my .pro file : https://justpaste.it/1ae3b

    I tried looking on Internet but could not find anything recent for Mac OSX Qt deployment.

    Running otool -L XMLGenerator.app/Contents/MacOS/XMLGenerator gives :

    XMLGenerator.app/Contents/MacOS/XMLGenerator:
    	@rpath/libopencv_shape.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_stitching.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_objdetect.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_superres.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_videostab.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_calib3d.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_features2d.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_highgui.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_videoio.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_imgcodecs.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_video.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_photo.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_ml.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_imgproc.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_flann.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@rpath/libopencv_core.3.2.dylib (compatibility version 3.2.0, current version 3.2.0)
    	@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/QtXml.framework/Versions/5/QtXml (compatibility version 5.9.0, current version 5.9.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 307.5.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.50.2)
    

    After this I did : macdeployqt yourappname.app -dmg
    And I got the dmg file but the app is crashing.
    Also, all this is in the debug folder and not release folder.

    Now my local project is also not running and am getting the message that :
    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. The program has unexpectedly finished.


  • Lifetime Qt Champion

    Hi,

    What do you mean the documentation is for Qt 4.8 ?

    • You link to the release version of the dependencies
    • You build it in release mode

    The documentation for releasing for macOS is here and more precisely the part about macdepoyqt.



  • @SGaist said in Deploy QT app on Mac OSX:

    here

    So the way I linked openCV do I need to change anything to get it in the release version?
    OpenCV to QT ->https://www.learnopencv.com/configuring-qt-for-opencv-on-osx/


  • Lifetime Qt Champion

    If you used homebrew to install OpenCV they are likely already built in release mode.



  • @SGaist No I didn't use homebrew and I completed my project and am at this stage where I cannot remove opencv.

    I followed the process as said. So what special should I do to build for release mode, if possible.


  • Lifetime Qt Champion

    Who talked about removing anything ?

    I just asked whether you installed OpenCV through homebrew, nothing more. If you followed that tutorial, that's what I expected you did. If not then please explain how you did install/build OpenCV.



  • This post is deleted!


  • @SGaist I have modified the question, please have a look.


  • Lifetime Qt Champion

    Did you check the other folders of your app bundle ? What do you get if you run otool on what you find there ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.