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
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Deploying .app on mac OSX

Scheduled Pinned Locked Moved General and Desktop
23 Posts 3 Posters 9.9k 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.
  • hskoglundH Offline
    hskoglundH Offline
    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 Offline
          hskoglundH Offline
          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