Macdeployqt dmg disabled build versions in Qt



  • Hi! I tried to use macdeployqt in the terminal on my mac along with the path to my Application.app and -dmg to create a dmg of my app, I tried this with my release and profile version and now I can't run them. Gets error message: QQmlApplicationEngine failed to load component when running them in Qt Creator path to main followed by "QtQuick.Controls" is not installed, same goes for "QtQuick.Window" and a lot more of my imported modules. Luckily I haven't messed up my debug build. Does anyone know how to correct my error?

    /Oliver


  • Lifetime Qt Champion

    Hi,

    Are you also using the -qmldir option ?



  • No I haven't used this, what's it used for?


  • Lifetime Qt Champion

    From the macdeployqt documentation:
    Deploy imports used by .qml files in the given path

    So you give it the path to your application sources where you have your .qml files. It will scan them and then deploy the dependencies needed.



  • Okey thanks, I will try this. Before I've deployed through Qt Creator, but now I want to be able to distribute it to a friend of mine, is this the right way to go?



  • This worked just fine. But I'm using openstreetmap plugin for a map in my application so the map is not visible.
    Quoting macdeployqt: To include a 3rd party library in the application bundle, copy the library into the bundle manually, after the bundle is created.
    What is my bundle? Now I have one folder with my sourceCode with files like myApp.pro, main.cpp, qml files, and so on, and another folder that Qt Creator creates when deploying containing main.o, Makefile, moc_files and myApplication.app.


  • Lifetime Qt Champion

    The bundle is your Application.app.



  • @SGaist said in macdeployqt dmg disabled build versions in Qt:

    The bundle is your Application.app.

    Okey, so how do I: Include a 3rd party library in the application bundle, copy the library into the bundle manually, after the bundle is created. How's this done with OpenStreetMap?


  • Lifetime Qt Champion

    Copy the OpenStreetMap framework/dylib in the corresponding folder in the bundle structure.



  • @SGaist said in macdeployqt dmg disabled build versions in Qt:

    Copy the OpenStreetMap framework/dylib in the corresponding folder in the bundle structure.

    Where do I find the OpenStreetMap framework/dylib? isn't that included in QtLocation?


  • Lifetime Qt Champion

    My bad, I've mixed OpenStreetMap with another one. The osm plugin should be deployed.



  • @SGaist So how come no map is shown only my frame around it and all other tools when I deploy using macdeployqt with -dmg and -qmldir ?


  • Lifetime Qt Champion

    Did you try to start your application from the command line after running macdeployqt ? There might be information printed on the command line.



  • @SGaist I tried this but it didn't work. This is what the folder to the project in Qt Creator looks like 0_1513847225245_Skärmavbild 2017-12-21 kl. 10.06.06.png And this is the folder produced by Qt Creator when deploying 0_1513847235745_Skärmavbild 2017-12-21 kl. 10.06.22.png

    Before running macdeployqt running my app from the terminal with: open -a RTKCar works just fine. Then I call macdeployqt from my root folder like this:
    pathToMacdeployqt/macdeployqt pathToDeployedFolder/RTKCar.app -dmg -qmldir=PathToProjectFolder
    After this I can run it from the terminal but the map won't show, same goes for opening it with the mouse or from the dmg.

    When running the macdeployqt command, I get the following output:
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquick2plugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libdeclarative_location.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libdeclarative_positioning.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libwindowplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqquicklayoutsplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquickcontrols2plugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquickcontrols2materialstyleplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquickcontrols2universalstyleplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libdialogplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libdialogsprivateplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquicktemplates2plugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqmlfolderlistmodelplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqmlsettingsplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquickcontrolsplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquickextrasflatplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libwidgetsplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquickextrasplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtgraphicaleffectsplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtgraphicaleffectsprivate.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquickcontrols2materialstyleplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquickcontrols2materialstyleplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquickcontrols2universalstyleplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libqtquickcontrols2universalstyleplugin.dylib"
    File exists, skip copy: "/Users/user/build-RTKCar-Desktop_Qt_5_9_2_clang_64bit-Profile/RTKCar.app/Contents/PlugIns/quick/libmodelsplugin.dylib"


  • Lifetime Qt Champion

    I didn't expect it to work but to give more clues about what is going wrong. You don't have any message printing on the console ?

    By the way, you should consider updating Qt. 5.9.3 and 5.10 have been released.



  • @SGaist I Downloaded Qt 5.10 and gave it a try, same output as before. I've also tried this for the Qt Map Viewer Example without any success.


  • Lifetime Qt Champion

    Not any QML error ?



  • @SGaist Nope. Do you want to give it a try with the Qt Map Viewer Example?


  • Lifetime Qt Champion

    That's what I was suspecting: missing plugins.

    The quick and easy way would be to build your own version of macdeployqt with this patch applied.



  • @SGaist Wow thanks a lot! Will try this in a few days. Do you reckon linuxdeployqt will have the same issue?


  • Lifetime Qt Champion

    If everything goes well, clone the qttools repository and and build macdeployqt from the latest 5.10 branch.

    Otherwise, you will have to apply two patches since there was a cleanup done in between.



  • @SGaist How do I build macdeployqt after cloning it? Tried to open the macdeployqt.pro file in Qt Creator and just build through there, but I got the error code:

    ld: can't open output file for writing '/bin/macdeployqt.ld_z0wFts', errno=1 for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [/bin/macdeployqt] Error 1
    make: *** [sub-macdeployqt-make_first] Error 2
    15:19:17: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project macdeployqt (kit: Desktop Qt 5.9.2 clang 64bit)
    When executing step "Make"
    

    Or can I do it somehow using the terminal?


  • Lifetime Qt Champion

    /bin ? That strange.

    I do it from the command line in an out of source folder:

    mkdir build_macdeployqt
    pushd build_macdeployqt
    /path/to/qmake /path/to/Qt/qttools/src/macdeployqt/
    make
    make install
    


  • @SGaist when I do /path/to/qmake /path/to/Qt/qttools/src/macdeployqt/
    I get :
    Qt5.10.0/5.10.0/clang_64/mkspecs/features/mac/sdk.prf:26: Cannot write cache file /Users/.qmake.stash: Permission denied,
    Tried it together with sudo, it worked: Info: creating stash file /Users/.qmake.stash
    But when doing make I get:
    ld: can't open output file for writing '/bin/macdeployqt.ld_jnQbB4', errno=1 for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [/bin/macdeployqt] Error 1 make: *** [sub-macdeployqt-make_first] Error 2


  • Lifetime Qt Champion

    Are you using a self-compiled Qt ?



  • @SGaist No I downloaded the whole package from Qt, with Creator and everything and just used the provided installer.


  • Lifetime Qt Champion

    Ok, I was using my own build of Qt.

    Configure the complete qttools module then you can just build macdeployqt.

    mkdir build_qttools
    pushd build_qttools
    /path/to/qmake /path/to/Qt/qttools/ -r
    make -C src/macdeployqt
    cp bin/macdeploqt /path/to/macdeployqt
    

    [edit: added missing option. SGaist]



  • @SGaist
    build_qttools user$ make -C src/macdeployqt gives me:
    make: *** src/macdeployqt: No such file or directory. Stop.
    and
    build_qttools user$ make -C pathTo/qttools/src/macdeployqt make: *** No targets specified and no makefile found. Stop.


  • Lifetime Qt Champion

    There was an option missing. You have to do a recursive configuration. Sorry. I've updated the sample.



  • @SGaist thanks for the quick update, now I got this.
    cp: cannot overwrite directory pathTo/qttools/src/macdeployqt/macdeployqt with non-directory bin/macdeployqt


  • Lifetime Qt Champion

    When calling make install ?



  • @SGaist when calling cp bin/macdeployqt /path/to/macdeployqt

    Should there be an / after qttools in /path/to/qmake /path/to/Qt/qttools/ -r?

    Or when doing:
    make -C src/macdeployqt :
    cd macdeployqt/ && ( test -e Makefile || /Users/user/Qt5.10.0/5.10.0/clang_64/bin/qmake -o Makefile /Users/user/qttools/src/macdeployqt/macdeployqt/macdeployqt.pro ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile make[1]: Nothing to be done forfirst'.`

    My files are laid out like this in my home/root folder of the user:
    /Qt/5.9.2 which I got from the complete Qt installation.
    /Qt5.10.0 New version of Qt downloaded later on
    /qttools git cloned version with the patch

    I've been referring to the path of macdeployqt from the cloned git version, not the ones inside Qt5.9.2 or 5.10.0,
    to qmake inside Qt5.10.0 and to
    qttools in my root/home folder not inside Qt5.9.2 or 5.10.0


  • Lifetime Qt Champion

    It should go in the bin folder of your Qt installation.

    What you seem to be doing is trying to copy the executable in a folder that contains a folder named macdeployqt.



  • @SGaist okey, so it's like:
    mkdir build_qttools
    pushd build_qttools
    /path/to/qmake in Qt5.9 or 5.10 /path/to/Qt/qttools from gitClone? / -r
    make -C src/macdeployqt
    cp bin/macdeploqt /path/to/macdeployqt in Qt 5.9 or 5.10


  • Lifetime Qt Champion

    Looks correct yes


Log in to reply
 

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