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. QT 5.1 Deployment on mac OS X, macdeployqt does not change a links to qt libs inside application

QT 5.1 Deployment on mac OS X, macdeployqt does not change a links to qt libs inside application

Scheduled Pinned Locked Moved Installation and Deployment
35 Posts 9 Posters 27.9k 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
    miks131
    wrote on last edited by
    #1

    Hi guys,

    I'm having troubles with deployment of QtQuick app on Mac os X. I'm using latest QT 5.1 and also QML Desktop Components.

    After I build my Application in QtCreator, I checked on what libraries it depends:
    @
    otool -L TestDeployment.app/Contents/MacOS/TestDeployment
    TestDeployment.app/Contents/MacOS/TestDeployment:
    /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.1.0, current version 5.1.0)
    /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtQml.framework/Versions/5/QtQml (compatibility version 5.1.0, current version 5.1.0)
    /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.1.0, current version 5.1.0)
    /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.1.0, current version 5.1.0)
    /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.1.0, current version 5.1.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/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)@

    Then I run macdeployqt utility:

    @~/Qt5.1.0/5.1.0/clang_64/bin/macdeployqt TestDeployment.app/@

    So QT Framework was copied inside app bundle, but the thing is that links to QT libraries was not changed to relative ones. When I run otool, i see:

    @otool -L TestDeployment.app/Contents/MacOS/TestDeployment
    TestDeployment.app/Contents/MacOS/TestDeployment:
    /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.1.0, current version 5.1.0)
    /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtQml.framework/Versions/5/QtQml (compatibility version 5.1.0, current version 5.1.0)
    /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.1.0, current version 5.1.0)
    /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.1.0, current version 5.1.0)
    /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.1.0, current version 5.1.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/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)@

    So dynamik linker will not find qt libs inside app bundle.

    I tried to run macdeploy qt utility with verbose=3 flag, but I don't see any errors, moreover I see that it uses intall_name_tool to change links for dynamic linker, but somehow links in executable application were not changed.

    Does any one faced the same issue? Is there any way to fix that?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sfilippidis
      wrote on last edited by
      #2

      Similar issue here, and additionally without the verbose=3 flag I get an error about not able to find a "libmysqlclient.18.dylib" file!

      https://www.filippidis.name/

      1 Reply Last reply
      0
      • M Offline
        M Offline
        miks131
        wrote on last edited by
        #3

        About error -

        if you dont use plugins then you can run macdeployqt utility with

        -no-plugins

        key. Or you need to install MySql and create a symlink to libmysqlclient.18.dylib in /usr/lib/

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sfilippidis
          wrote on last edited by
          #4

          Actually I use SQLite, not MySQL.

          The exact message of the error is:

          ERROR: no file at "/usr/lib/libmysqlclient.18.dylib"

          https://www.filippidis.name/

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

            Take a look here

            http://qt-project.org/doc/qt-5.0/qtdoc/deployment-mac.html

            There is a description about rules macdeployqt works, at the end of page

            bq. SQL driver plugins are deployed if the application uses the QtSql module.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sfilippidis
              wrote on last edited by
              #6

              OK, thanks for reminding me that! :-)

              However, I also have the problem you reported in your original post! Let us hope that someone has a solution there. Meanwhile, I am installing Qt 4.8.5 and if the problem doen't exist there, I will use that (my application works fine with both Qt4 and Qt5).

              https://www.filippidis.name/

              1 Reply Last reply
              0
              • M Offline
                M Offline
                miks131
                wrote on last edited by
                #7

                OK,

                the problem is in linking path - take a look here:

                /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork

                Do you see a double slash Qt5.1.0//5.1.0 - the thing is that when macdeployqt runs install_name_tool - it pass path to QT lib with one slash - but EXE linked by path with two slashes

                As a result install_name_tool looking for a path with one slash, can't find that inside EXE - so paths stays unchanged.

                I've changed links manually, after you build your program, you need to change links inside exe to a right ones

                @install_name_tool -change /Users/username/Qt5.1.0//5.1.0/clang_64/lib/QtQuick.framework/Versions/5/QtQuick /Users/username/Qt5.1.0/5.1.0/clang_64/lib/QtQuick.framework/Versions/5/QtQuick <YourExecutable>@

                After this workaround macdeployqt has changed all links inside exe to a relative ones.

                The same problem on "Stackoverflow":http://stackoverflow.com/questions/17475788/qt-5-1-and-mac-bug-making-macdeployqt-not-working-properly

                But app became broken for me, I've add all my QML and Images files to resources, and now, after I ran macdeployqt - I see next error in the qdb:

                bq. QQmlApplicationEngine failed to load component
                qrc:/qml/main.qml:-1 File not found

                So after I changed a links, Resources which were build into Exe became somehow unavailable, does anyone know any way to fix that?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sfilippidis
                  wrote on last edited by
                  #8

                  Is this recorded as a bug in the respective website?

                  https://www.filippidis.name/

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    miks131
                    wrote on last edited by
                    #9

                    Yep, I have reported bugs to QT:

                    https://bugreports.qt-project.org/browse/QTBUG-32380

                    https://bugreports.qt-project.org/browse/QTBUG-32379

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      stereomatching
                      wrote on last edited by
                      #10

                      I try the solution posted on stack overflow, but the program still crash

                      The message of gdb

                      QQmlApplicationEngine failed to load component
                      qrc:/qml/colorCorrection/mainDesktop.qml:4 module "QtQuick.Layouts" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:2 module "QtQuick.Controls" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:1 module "QtQuick" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:3 module "QtQuick.Dialogs" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:4 module "QtQuick.Layouts" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:2 module "QtQuick.Controls" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:1 module "QtQuick" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:3 module "QtQuick.Dialogs" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:4 module "QtQuick.Layouts" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:2 module "QtQuick.Controls" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:1 module "QtQuick" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:3 module "QtQuick.Dialogs" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:4 module "QtQuick.Layouts" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:2 module "QtQuick.Controls" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:1 module "QtQuick" is not installed
                      qrc:/qml/colorCorrection/mainDesktop.qml:3 module "QtQuick.Dialogs" is not installed

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        miks131
                        wrote on last edited by
                        #11

                        I'm not sure, but it looks like macdeployqt does not copy QtQuick modules. Try to copy QtQuick.2 modules from your qt installation folder to your bundle.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          stereomatching
                          wrote on last edited by
                          #12

                          miks131 thanks.Maybe Qt5 really not as stable as Qt4
                          I use Qt4 9 months, encountered one bug
                          shift to Qt5 about 3 months ago but already encountered 4~5 bugs
                          I can understand why there are many people don't want to shift to Qt5 yet

                          I don't know I should wait for the bug fix or try to find some workaround for this bug
                          it may take more than one day to find out a workable ad-hoc solution.

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            stereomatching
                            wrote on last edited by
                            #13

                            Take a look on this link(on the last answer of stackOverflow)
                            "deploy Qt5 apps to mac":http://www.stringcat.com/company_blog/2013/07/04/failed-to-load-platform-cocoa/

                            Pretty complicated procedures, I am very new to mac and very surprise
                            that deploy third parties dylib on mac could be so complicated, do anyone
                            know what kind of benefits or reasons let mac os become so hard to
                            deploy 3rd parties dll?Deal with those dependencies make me frustration.

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              stereomatching
                              wrote on last edited by
                              #14

                              I am sure the QtQuick Frameworks already copied to the bundle
                              But the program can't find any components related to QtQuick control
                              QtQuick control is under another module?

                              Ah, find out the problem, the QtQuick control, layout and dialog are plugins under other folders

                              The script do change the path of qml folder
                              @for F in find $QTDIR/lib $QTDIR/plugins $QTDIR/qml -perm 755 -type f @
                              But the macdeploy do not copy and configure the id and change the reference path of the dll
                              I guess that despite of the bug, macdeploy do not support QtQuick control and QtQuick dialog yet
                              or this is another bug of Qt5.1?

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                miks131
                                wrote on last edited by
                                #15

                                As far as I can see - it does not. Currently I'm struggling with QtQuick deployment. I got an error -

                                @module "QtQuick" is not installed@

                                I copied QtQuick and QtQuick.2 folders to app bundle, and added path to it, by using AddImportPath function inside my code. But anyway - it is not flying at the moment :/

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  stereomatching
                                  wrote on last edited by
                                  #16

                                  [quote author="miks131" date="1373878229"]As far as I can see - it does not. Currently I'm struggling with QtQuick deployment. I got an error -

                                  @module "QtQuick" is not installed@

                                  I copied QtQuick and QtQuick.2 folders to app bundle, and added path to it, by using AddImportPath function inside my code. But anyway - it is not flying at the moment :/ [/quote]

                                  I have the same problem too, and I also copy the QtQuick.2 folders and
                                  part of the QtQuick folders to app bundle.Can't find a single success
                                  example of deploying QtQuick2 apps on mac.

                                  1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    miks131
                                    wrote on last edited by
                                    #17

                                    Yep, another thread with the same "discussion ":http://qt-project.org/forums/viewthread/25903/

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      miks131
                                      wrote on last edited by
                                      #18

                                      Finally managed to get it work, checkout this "answer":http://stackoverflow.com/a/17591828/2370437

                                      1 Reply Last reply
                                      0
                                      • S Offline
                                        S Offline
                                        stereomatching
                                        wrote on last edited by
                                        #19

                                        miks131, thanks for your answer, thanks for macdeploy of MaximAlien, and the script from lasconic, they work like magic.
                                        Have you add you answer to the bug report you mention before?

                                        Hope your answer could help the developers solve this annoying bug, never
                                        though that deploy a simple app on mac is so painful, it is a real pain without
                                        the help of macdeployqt.

                                        After peeking into the bundle, I find out the folder of QtQuick.2 is place
                                        at the same folder as the exe, maybe this is why the project can't find
                                        the dylib before, because I put all of the plugins into the PlugIns folder

                                        1 Reply Last reply
                                        0
                                        • S Offline
                                          S Offline
                                          sfilippidis
                                          wrote on last edited by
                                          #20

                                          The important think here is that a solution MUST be included in a next version of Qt SDK as soon as possible! Until then, I will stick to Qt 4.8.5, and I would guess that I will not be the only one! ;-)

                                          https://www.filippidis.name/

                                          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