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. [SOLVED] Deploying .app on mac OSX

[SOLVED] Deploying .app on mac OSX

Scheduled Pinned Locked Moved General and Desktop
23 Posts 3 Posters 9.4k 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
    maximus
    wrote on last edited by
    #6

    Update:

    I noted app crash at this place :
    Seems it doesn't like this spot:

    @void Main_WorkoutPage::retrieveWorkoutList() {

    qDebug() << "OK SLOT FINISHED! retrieve workout list!";
    labelLoading->setVisible(false);
    
    QList<Workout> lstWorkout = xmlUtil->getLstWorkout();
    tableModel->setListWorkout(lstWorkout);
    ui->tableView_workout->resizeColumnsToContents();
    

    }

    ////////////////////////////////////////////////////////////
    QList<Workout> XmlUtil::getLstWorkout() {

    return this->lstWorkout;
    

    }
    @

    [Edit
    Code doesn't seem to be the problem, crash is happening at a new place now

    Logs:
    @OK SLOT FINISHED! retrieve workout list!
    Done retrieve workout list!
    GOT HERE READ READY PLAN LIST

    "<?xml version="1.0" encoding="UTF-8"?>
    <root><element><planID>0</planID><plan_name>Aucun</plan_name><plan_description/></element><element><planID>4</planID><plan_name>Rouge et Or - Plan general</plan_name><plan_description/></element></root>
    "
    QWidget: Must construct a QApplication before a QWidget
    Abort trap: 6@

    "update #2 --
    I'll try recompiling Qwt and make sure it's the same version release than my Qt version, will post result!
    http://www.qtcentre.org/threads/10959-QWidget-Must-construct-a-QApplication-before-a-QPaintDevice


    Free Indoor Cycling Software - https://maximumtrainer.com

    1 Reply Last reply
    0
    • hskoglundH Online
      hskoglundH Online
      hskoglund
      wrote on last edited by
      #7

      Just a guess: those messages at start point to a ghost/copy build of the same app inside your Dropbox directory. When you copy the Qwt framework into your app, make sure you don't run macdeployqt before copying.

      Also those messages "... Which one is undefined." means you suffer from the "double-runtime" syndrome, i.e. you mix frameworks from two different build flavors, like two different Qt versions, or one build without macdeployqt and one build with macdeployqt done on it. And that's probably why the app crashes...

      1 Reply Last reply
      0
      • M Offline
        M Offline
        maximus
        wrote on last edited by
        #8

        I copied qwt.framework to /Contents/Frameworks and then ran macdeployqt, "still got this message though":https://www.dropbox.com/s/ntjfxyqisedl88z/macDeployqt.png
        It wants me to put it in the /Library folder? What is up with that? It is in /Frameworks...

        About the 2 implementations, not sure I can fix it, one is my Qt installation(#1) and the other is the copied version that was done with macdeployqt(#2)

        1-
        /Users/tourlou2/Qt5.2.1/5.2.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets
        2-
        /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_2_1_clang_64bit-Release/PowerVelo2.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets. One of the two will be used. Which one is undefined.


        Free Indoor Cycling Software - https://maximumtrainer.com

        1 Reply Last reply
        0
        • hskoglundH Online
          hskoglundH Online
          hskoglund
          wrote on last edited by
          #9

          Once you've run macdeployqt on a build, consider it "infected" :-) I mean zip it or move it to another machine, don't copy parts out of it otherwise this double-runtime syndrome can strike...

          Yeah, that problem of qwt.framework which otool thinks lives in /Library/Framework. Maybe it's time anyway to look at the .pro files of your projects, could you post them?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            maximus
            wrote on last edited by
            #10

            haha I get it that macdeployqt is the last thing you should do, but I did as told and only added qwt.framework before running it :)

            Oh mister you asked for it, theses .pro files are monsters!

            Here is the main project .pro :

            @QT += core widgets gui multimedia

            TARGET = PowerVelo2
            TEMPLATE = app

            CONFIG += qwt
            CONFIG += release
            CONFIG += qt thread
            CONFIG += c++11
            CONFIG += x86_64
            CONFIG -= i386

            fix a compile bug on windows

            DEFINES += NOMINMAX

            #src files for qwt
            INCLUDEPATH += /Users/tourlou2/Dropbox/qwt-6.1.0/src

            #src vlc
            INCLUDEPATH += /Users/tourlou2/Dropbox/vlc/include
            INCLUDEPATH += /Users/tourlou2/Dropbox/vlc/include/vlc

            #src vlc-qt
            INCLUDEPATH += /Users/tourlou2/Dropbox/vlc-qt-0.9.0/src/core
            INCLUDEPATH += /Users/tourlou2/Dropbox/vlc-qt-0.9.0/src/widgets

            include ( /Users/tourlou2/Dropbox/qwt-6.1.0/qwt.prf )
            include (_subclassQT/_subclassQT.pri)
            include (_subclassQWT/_subclassQWT.pri)
            include (main/main.pri)
            include (model/model.pri)
            include (gui/gui.pri)
            include (m_xml/m_xml.pri)

            include (ANT/heart_rate/ANT_HeartRate.pri)
            include (ANT/cadence/ANT_Cadence.pri)
            include (ANT/speed/ANT_Speed.pri)
            include (ANT/speed_cadence/ANT_SpeedCadence.pri)
            include (ANT/power/ANT_Power.pri)
            include (ANT/ANT.pri)

            include (videoPlayer_pri/videoPlayer_pri.pri)

            RESOURCES +=
            MyResources.qrc

            TRANSLATIONS = powervelo_en.ts
            powervelo_fr.ts
            #powervelo_de.ts
            @

            Here is Ant.pri

            @INCLUDEPATH += $$PWD
            DEPENDPATH += $$PWD

            SOURCES +=
            ANT/hub.cpp
            ANT/utilpowercurve.cpp \

            HEADERS +=
            ANT/hub.h
            ANT/utilpowercurve.h
            ANT/common_pages.h
            ANT/antplus.h

            #FOR ANT+
            #////////////////////////////////////////////////////////////////////////////////////////////////////////
            INCLUDEPATH += /Users/tourlou2/Dropbox/ANT_LIB_mac/inc
            INCLUDEPATH += /Users/tourlou2/Dropbox/ANT_LIB_mac/software/serial
            INCLUDEPATH += /Users/tourlou2/Dropbox/ANT_LIB_mac/software/system
            INCLUDEPATH += /Users/tourlou2/Dropbox/ANT_LIB_mac/software/USB/devices
            INCLUDEPATH += /Users/tourlou2/Dropbox/ANT_LIB_mac/software/USB/device_handles
            INCLUDEPATH += /Users/tourlou2/Dropbox/ANT_LIB_mac/software/USB

            #static ANT_LIB builded with ANT_LIB project (Compile it with ANT_LIB PROJECT)
            LIBS += /Users/tourlou2/Dropbox/libANT_LIB.a
            LIBS += -framework IOKit
            LIBS += -framework CoreFoundation@

            Here is video_player.pri

            @INCLUDEPATH += $$PWD
            DEPENDPATH += $$PWD

            SOURCES +=
            videoPlayer_pri/playerwidget.cpp

            HEADERS +=
            videoPlayer_pri/playerwidget.h

            FORMS +=
            videoPlayer_pri/PlayerWidget.ui

            RESOURCES +=
            videoPlayer_pri/ResourceVideoPlayer.qrc

            LIBS += /Users/tourlou2/Dropbox/vlc_lib/libvlc.5.dylib
            LIBS += /Users/tourlou2/Dropbox/vlc_lib/libvlc.dylib
            LIBS += /Users/tourlou2/Dropbox/vlc_lib/libvlccore.7.dylib
            LIBS += /Users/tourlou2/Dropbox/vlc_lib/libvlccore.dylib@

            Rest of the .pri are just header/source code.
            I'll pay you both wiskey soon..


            Free Indoor Cycling Software - https://maximumtrainer.com

            1 Reply Last reply
            0
            • hskoglundH Online
              hskoglundH Online
              hskoglund
              wrote on last edited by
              #11

              Big yes, not your grandpa's .pro files that's for sure.

              Hmmm, SGaist I'll give you some of my whiskey if you can help...

              1 Reply Last reply
              0
              • M Offline
                M Offline
                maximus
                wrote on last edited by
                #12

                Meanwhile I'm reinstalling XCode5 and trying everything from scratch (rebuild qwt, ant_lib.a, ..) will see if the same error appears

                • 10 000 Dogecoins for the help └(°ᴥ°)┘

                [Edit:
                I think one major concept I didn't understand is linking library
                ie: tell the linker to link against the library by adding this line:
                LIBS += -l[...]
                So I probably build using some other libs, but since they are not required at runtime, this crash the app? will investigate..


                Free Indoor Cycling Software - https://maximumtrainer.com

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  maximus
                  wrote on last edited by
                  #13

                  Okay I reinstalled Xcode5 and Qt from scratch
                  and now when I try to use "macdeployqt" I get command not found.. sigh -_-

                  Update: After fresh reinstall and build of my application, I copied qwt.framework to MyApp.app/Contents/MacOs and run app from QtCreator, app works 100% fine.
                  As you said im almost sure it's crashing because of the "“double-runtime” syndrome" but I can't test this again because "macdeployqt" is gone for some reason.

                  so problem with the crash is only when I start app from outside QtCreator, i'm taking a break and will test again when my sanily level drop back to normal :)


                  Free Indoor Cycling Software - https://maximumtrainer.com

                  1 Reply Last reply
                  0
                  • hskoglundH Online
                    hskoglundH Online
                    hskoglund
                    wrote on last edited by
                    #14

                    Don't worry, "macdeployqt" is probably where it should be.
                    This is how I start it on my Mac:!http://www.tripleboot.org/wp-content/uploads/2014/03/InvokingMacDeployQt.png(launching macdeployqt)!

                    (picture is from "my blog post":http://www.tripleboot.org/?p=138 )

                    [Update: ] Checked your .pro files a bit, this line sure look suspicious:
                    LIBS += /Users/tourlou2/Dropbox/libANT_LIB.a

                    What happens if you comment it out?
                    (Because linking to libANT_LIB.a is possible way for you to get the "double runtime" into your app)

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

                      Double Qt Syndrome

                      The double Qt syndrome comes from a dependency that has not yet been update to load the Qt bundled with your application. That can be one of your custom lib (but generally macdeployqt handles that) That can be one of your external library that has been copied but not updated. Have a look at libvlc, they also use Qt for their GUI.

                      Once macdeployqt has run, check the error message, it might get lost trying to copy all dependencies. Then have a look at the Frameworks and PlugIns folder content and run otool -L on them to see if they indeed refer only to the Qt libraries/other non system libraries in your bundle. You should also check all non system libraries to see it their paths are correctly pointing inside your bundle.

                      LIBS

                      When doing LIBS += -Lsome_path you tell the linker to look in some_path to find additional libraries, on OS X you also have -F for folder containing frameworks.

                      LIBS += -lmylibname tells the linker that you want to link to a given library. Depending on what library file it finds, it will link to the dynamic or static version.
                      Giving the full path to the static library tells the linker to link against that specific static library file, it can't be used for dynamic library.

                      On a side note, you should only need to do QT += qwt if the installation went correctly.

                      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
                      • M Offline
                        M Offline
                        maximus
                        wrote on last edited by
                        #16

                        Solved
                        Thank you both for your kind help!
                        Since macdeployqt was complaining all the time about qwt.framework not in /Library/Frameworks, I added it to it. Then when running macdeployqt after a fresh build, qwt.frameworks get copied automatically and that seem to have fixed the problem. I suspect macdeployqt fixed bad dependencies on the qwt.frameworks that were not pointing at the good Qt libs (double qt syndrome)

                        SGaist,
                        I get the LIBS+= [some_path] but not sure about the -L meaning before it.
                        In my .pro, I added the all the libs with LIBS+= [pathlib/libname] "
                        When I run otool -L on my app I get "this as result":https://www.dropbox.com/s/t1dnnftcdb4ochc/otoolaftermacDeploy.png
                        Does this mean all the other libs I added in the .pro are only used for building the app and not actually running it? how does Qt knows which one is needed at runtime vs not needed? For example I added a static library "LIBS += /Users/tourlou2/Dropbox/libANT_LIB.a"
                        and this one is not listed when I run otool. I'm happy it's working but i'd like to understand why so not to bother you guys again :)

                        Have a great day, i'll certainly have one!


                        Free Indoor Cycling Software - https://maximumtrainer.com

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

                          -L is a switch that tells the linker that what follows is a path that it must look in to find libraries.

                          A static library won't be listed as dependency since all the code used from it is copied inside the application or library that links against it.

                          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
                          • M Offline
                            M Offline
                            maximus
                            wrote on last edited by
                            #18

                            Ohh I get it now, that is why the licensing difference with static lib

                            One last thing, i've been reading "this guide":http://qt-project.org/doc/qt-4.8/deployment-mac.html but it doesn't mention where to put the translation file ".qm" on macOSX, on windows I just added them in the folder with the executable but it doesn't seem to work here.

                            last update :
                            the double dependency problem comes again when I run the app from inside QtCreator after running macdeployqt, once I ran it in qtCreator just one time, the package is spoiled and I have to rebuild/package again

                            So the solution I found for now is to debug/test the application in QtCreator, and when everything is ready I can use macdeployqt as as* last step* but to get back to developpement later I'll have to rebuild again and delete what macdeployqt as done

                            @Starting /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_2_1_clang_64bit-Release/PowerVelo2.app/Contents/MacOS/PowerVelo2...
                            objc[2737]: Class NotificationReceiver is implemented in both /Users/tourlou2/Qt/5.2.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets and /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_2_1_clang_64bit-Release/PowerVelo2.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets. One of the two will be used. Which one is undefined.
                            objc[2737]: Class QCocoaPageLayoutDelegate is implemented in both /Users/tourlou2/Qt/5.2.1/clang_64/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport and /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_2_1_clang_64bit-Release/PowerVelo2.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport. One of the two will be used. Which one is undefined.
                            objc[2737]: Class QCocoaPrintPanelDelegate is implemented in both /Users/tourlou2/Qt/5.2.1/clang_64/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport and /Users/tourlou2/Dropbox/build-PowerVelo2-Desktop_Qt_5_2_1_clang_64bit-Release/PowerVelo2.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport. One of the two will be used. Which one is undefined.
                            QObject::moveToThread: Current thread (0x7f95cbc09940) is not the object's thread (0x7f95cbc25050).
                            Cannot move to target thread (0x7f95cbc09940)

                            On Mac OS X, you might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
                            This application failed to start because it could not find or load the Qt platform plugin "cocoa".@


                            Free Indoor Cycling Software - https://maximumtrainer.com

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

                              Indeed, macdeployqt is only to be used once you are ready to distribute your application.

                              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
                              • M Offline
                                M Offline
                                maximus
                                wrote on last edited by
                                #20

                                Yeah I learn this the hard way
                                Could be good if macdeployqt just created another folder in the build folder instead of touching the real executable, but i'm always asking too much :)

                                as for the translation file for MacOSX, is there a preferred place to put them?


                                Free Indoor Cycling Software - https://maximumtrainer.com

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

                                  Since it's an OS X program, put them in the Resources folder

                                  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
                                  • M Offline
                                    M Offline
                                    maximus
                                    wrote on last edited by
                                    #22

                                    Thanks SGaist,

                                    The best solution I found is to add the translation file ".qm" files into my Ressource file, then it is loaded the same way on Windows and Mac OSX, save me the headaches of pathing..


                                    Free Indoor Cycling Software - https://maximumtrainer.com

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

                                      You're welcome !

                                      That's also a good solution

                                      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