Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [solved] My app crashed after using macdeployqt (Qt5.2 RC 1)
Forum Updated to NodeBB v4.3 + New Features

[solved] My app crashed after using macdeployqt (Qt5.2 RC 1)

Scheduled Pinned Locked Moved Installation and Deployment
48 Posts 2 Posters 22.7k 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.
  • G Offline
    G Offline
    gaojinhsu
    wrote on last edited by
    #19

    for example, libqcorewlanbearer.dylib is in the bundle, the following is the "otool -L" information

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /Users/gint_develop/Desktop/1Checker.app/Contents/PlugIns/bearer/libqcorewlanbearer.dylib:
    libqcorewlanbearer.dylib (compatibility version 0.0.0, current version 0.0.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 945.16.0)
    /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 453.19.0)
    /System/Library/Frameworks/CoreWLAN.framework/Versions/A/CoreWLAN (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55179.11.0)
    @executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.2.0, current version 5.2.0)
    @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.2.0, current version 5.2.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.18.0)
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    but when I use "DYLD_PRINT_LIBRARIES=1", I find the app loaded a wrong libqcorewlanbearer.dylib and its dependencies.

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    dyld: loaded: /Users/gint_develop/Qt5.2.0/5.2.0/clang_64/plugins/bearer/libqcorewlanbearer.dylib
    dyld: loaded: /System/Library/Frameworks/CoreWLAN.framework/Versions/A/CoreWLAN
    dyld: loaded: /Users/gint_develop/Qt5.2.0/5.2.0/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork
    dyld: loaded: /Users/gint_develop/Qt5.2.0/5.2.0/clang_64/lib/QtCore.framework/Versions/5/QtCore
    dyld: loaded: /usr/lib/libpcap.A.dylib
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    you can get my bundle "here":https://drive.google.com/uc?id=0B0lyTclIaUOPOUI4MmpZaHZiN3c&export=download

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

      Ok… There might be something funky with qt.conf's usage, I tried to start your application setting QT_PLUGIN_PATH to point to your bundle plugin path and it's working fine.

      Have a look at the Mac Deployment Documentation, they explain how to add the path to the bundle plugin directory when starting your application, that should workaround your current problem

      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
      • G Offline
        G Offline
        gaojinhsu
        wrote on last edited by
        #21

        I have viewed the docment, and I think the content of my qt.conf file is right, it does point to my bundle plugin path. : (

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

          I think it is (or at least I don't see any reason right now that it would not be)

          That's why I suggested to use the addLibraryPath() technique in between

          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
          • G Offline
            G Offline
            gaojinhsu
            wrote on last edited by
            #23

            then I added the following code to main.cpp, didn't work at all.

            QDir dir(QApplication::applicationDirPath());

            qDebug()<<dir.absolutePath();
            
            dir.cdUp();
            
             qDebug()<<dir.absolutePath();
            
            dir.cd("PlugIns");
            
            qDebug()<<dir.absolutePath();
            
            QCoreApplication::addLibraryPath(dir.absolutePath());
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #24

              And if you use setLibraryPath ?

              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
              • G Offline
                G Offline
                gaojinhsu
                wrote on last edited by
                #25

                Like this? it doesn't work either.

                QDir dir(QApplication::applicationDirPath());
                qDebug()<<dir.absolutePath();
                dir.cdUp();
                qDebug()<<dir.absolutePath();
                dir.cd("PlugIns");
                qDebug()<<dir.absolutePath();
                QApplication::setLibraryPaths(QStringList(dir.absolutePath()));

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  gaojinhsu
                  wrote on last edited by
                  #26

                  And we shouldn't forget this, maybe it's a important clue.
                  the macdeployqt tool even didn't copy the plugins into the bundle at the first time, I did this by hand. And later the app loaded them incorrectly no matter how I modify the Path in qt.conf file or in source code.

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

                    In between, did you update to 5.2 since it's been officially released ?

                    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
                    • G Offline
                      G Offline
                      gaojinhsu
                      wrote on last edited by
                      #28

                      Actually, it is 5.2 already...

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        gaojinhsu
                        wrote on last edited by
                        #29

                        how do you set QT_PLUGIN_PATH ? show me plz.
                        [quote author="SGaist" date="1387459417"]Ok… There might be something funky with qt.conf's usage, I tried to start your application setting QT_PLUGIN_PATH to point to your bundle plugin path and it's working fine.

                        Have a look at the Mac Deployment Documentation, they explain how to add the path to the bundle plugin directory when starting your application, that should workaround your current problem[/quote]

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

                          QT_PLUGIN_PATH=/Users/username/Downloads/1Checker.app/Contents/PlugIns/ ./1Checker.app/Contents/MacOS/1Checker

                          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
                          • G Offline
                            G Offline
                            gaojinhsu
                            wrote on last edited by
                            #31

                            type it into terminal ? it still doesn't work...

                            1 Reply Last reply
                            0
                            • G Offline
                              G Offline
                              gaojinhsu
                              wrote on last edited by
                              #32

                              are you sure it is working fine after setting QT_PLUGIN_PATH to point to your bundle plugin path , I
                              This is my QT_PLUGIN_PATH, but my app is yet to be launched.
                              //////////////////////////////////////////////////////////////////
                              gint-developtekiMacBook-Pro:~ gint_develop$ echo $QT_PLUGIN_PATH
                              /Users/gint_develop/Desktop/1Checker.app/Contents/MacOS/1Checker

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

                                you can try with:
                                @ export QT_PLUGIN_PATH=/Users/username/Downloads/1Checker.app/Contents/PlugIns/
                                @
                                then
                                @
                                ./1Checker.app/Contents/MacOS/1Checker
                                @

                                I have three warnings about QEventLoop but I can see your application login screen

                                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
                                • G Offline
                                  G Offline
                                  gaojinhsu
                                  wrote on last edited by
                                  #34

                                  @gint-developtekiMacBook-Pro:~ gint_develop$ export QT_PLUGIN_PATH="/Users/gint_develop/Desktop/1Checker.app/Contents/PlugIns"
                                  gint-developtekiMacBook-Pro:~ gint_develop$ cd ~/Desktop/
                                  gint-developtekiMacBook-Pro:Desktop gint_develop$ ./1Checker.app/Contents/MacOS/1Checker
                                  QEventLoop: Cannot be used without QApplication
                                  QObject::moveToThread: Current thread (0x103e079f0) is not the object's thread (0x103e0c800).
                                  Cannot move to target thread (0x103e079f0)

                                  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.
                                  QObject::moveToThread: Current thread (0x103e079f0) is not the object's thread (0x103e0c800).
                                  Cannot move to target thread (0x103e079f0)

                                  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.
                                  QEventLoop: Cannot be used without QApplication
                                  QEventLoop: Cannot be used without QApplication
                                  objc[3729]: Class NotificationReceiver is implemented in both /Users/gint_develop/Desktop/1Checker.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets and /Users/gint_develop/Qt5.2.0/5.2.0/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets. One of the two will be used. Which one is undefined.
                                  objc[3729]: Class QCocoaPageLayoutDelegate is implemented in both /Users/gint_develop/Desktop/1Checker.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport and /Users/gint_develop/Qt5.2.0/5.2.0/clang_64/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport. One of the two will be used. Which one is undefined.
                                  objc[3729]: Class QCocoaPrintPanelDelegate is implemented in both /Users/gint_develop/Desktop/1Checker.app/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport and /Users/gint_develop/Qt5.2.0/5.2.0/clang_64/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport. One of the two will be used. Which one is undefined.
                                  QObject::moveToThread: Current thread (0x103e079f0) is not the object's thread (0x103e0c800).
                                  Cannot move to target thread (0x103e079f0)

                                  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".

                                  Available platform plugins are: cocoa, minimal, offscreen.

                                  Reinstalling the application may fix this problem.
                                  Abort trap: 6@

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

                                    If you rename your Qt folder does it also fail ?

                                    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
                                    • G Offline
                                      G Offline
                                      gaojinhsu
                                      wrote on last edited by
                                      #36

                                      I have tried these:

                                      1. set QT_PLUGIN_PATH and rename Qt folder, succeed to launch it with terminal, but failed by double clicking.

                                      2. set QT_PLUGIN_PATH and do not rename Qt folder, both failed.

                                      3. do not set QT_PLUGIN_PATH and rename Qt folder, both failed.

                                      so I think even if I set QT_PLUGIN_PATH, the reference pointing to the Qt folder is the preference.

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

                                        Are you using QDir::currentPath ?

                                        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
                                        • G Offline
                                          G Offline
                                          gaojinhsu
                                          wrote on last edited by
                                          #38

                                          no, but the following code has been added to main.cpp already,

                                          @int main(int argc, char *argv[])
                                          {

                                          QApplication a(argc, argv);
                                          
                                          QDir dir(QCoreApplication::applicationDirPath());
                                          qDebug()<<dir.absolutePath();
                                          dir.cdUp();
                                          qDebug()<<dir.absolutePath();
                                          dir.cd("PlugIns");
                                          qDebug()<<dir.absolutePath();
                                          QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
                                          qDebug()<<QCoreApplication::libraryPaths();@
                                          

                                          and the relevant application output

                                          @"/Users/gint_develop/Documents/maserati/branches/build-OneChecker-Desktop_Qt_5_2_0_clang_64bit-Release/OneChecker/1Checker.app/Contents/MacOS"
                                          "/Users/gint_develop/Documents/maserati/branches/build-OneChecker-Desktop_Qt_5_2_0_clang_64bit-Release/OneChecker/1Checker.app/Contents"
                                          "/Users/gint_develop/Documents/maserati/branches/build-OneChecker-Desktop_Qt_5_2_0_clang_64bit-Release/OneChecker/1Checker.app/Contents/PlugIns"
                                          ("/Users/gint_develop/Documents/maserati/branches/build-OneChecker-Desktop_Qt_5_2_0_clang_64bit-Release/OneChecker/1Checker.app/Contents/PlugIns") @

                                          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