Skip to content
QtWS25 Call for Papers
  • 0 Votes
    2 Posts
    488 Views
    A

    Ok I managed to get it through to App Store Connect! Had to replace the call to macdeployqt with Xcode's equivalents :( Got some helpful info from Apple, details on this thread if anyone's interested https://developer.apple.com/forums/thread/740606

  • 0 Votes
    2 Posts
    342 Views
    Y

    I've managed to deploy a test app from Monterey which works on Catalina and Monterey and given up on building on Catalina after spending a few days trying to fix the result of macdeployqt using otool and install_name_tool.

    It seems that the CMake qt_generate_deploy_app_script method doesn't work when run from Monterey either. Running the macdeployqt utility almost works out of the box, it just leaves the plugins' RPATH pointing to a nonexistent 'lib' folder where it expects Qt frameworks to be. Rather than fix the RPATH's in each of those plugin libs, adding a 'lib' symlink pointing to the Frameworks folder seems to do the trick.

    In case it's useful to anyone, I've made a template repository on GitHub with this solution. The template allows you to deploy apps with LGPL Qt on Mac and Windows and use VSCode as an IDE rather than QtCreator:

    https://github.com/yergin/qt-cmake-vscode

  • 0 Votes
    2 Posts
    301 Views
    D

    Ok I got it working.
    To suimmarize
    macdeployqt did not relink all files properly. In order to fix it I ended up

    Loop over all frameworks in my bundle otool -chant oldPath newPath targetDylib file codesign --force --timestamp --sign "FSDVASDVASDVASVSA" dylibPath

    codesign stamp taken from security find-identity -v -p codesigning

    I looped over frameworks 1st, then extra libs, then target executable at the end. Apparently all this has to happen in order.
    After that both ARM and Intel build start.
    ARM is very sensitive with code signing apparently. Hope this helps the next poor soul wanted to use cmake on mac.

    EDIT1.
    There is more to this answer...
    Once. you re-path the dylibs... then you need to sign them, ideally with -option runtime. Then you need zip it all and send to apple for notarization... there is WWDC talk in 2019 that introduces the concept/explains why and in 2021 (I think) another video that shows new APi to do it all in 1 command. - well mostly.
    In any case you need to notarize ur app & then stamp. So that any mac can run it without warning... lots of FUN TIME APPPLE. But at least its provided by apple and work nicely as opposed to Microsoft signing bananas ;/// Microsoft u officially sux.

  • 1 Votes
    7 Posts
    602 Views
    SGaistS

    Or you can fix the macdeployqt code and build it to replace your version. That way you benefit from all the file processing done during the deployment process.

  • 0 Votes
    6 Posts
    575 Views
    artwawA

    @sierdzio Thank you for all the info, I think I'll be able to take things on from here.

    Have a lovely day :)

  • 0 Votes
    11 Posts
    1k Views
    C

    @sgaist
    There does not seem to be any discernible environment-related reason as to why this happens on some systems and not others.

    I have created a new bug report https://bugreports.qt.io/projects/QTBUG/issues/QTBUG-78146

    Clive

  • 0 Votes
    3 Posts
    2k Views
    D

    Another way is to create .dmg file by hdiutil create instead of macdeployqt -dmg .

    mkdir ui-release cd ui-release ln -s /Applications cd .. mv $appfolder ui-release/ hdiutil create -volname $volname -srcfolder ui-release/ -ov -format UDZO $dmgfilename
  • 0 Votes
    8 Posts
    2k Views
    Y

    Hi,

    With help of our senior Engineer. I am able to solve this issue. He change the binary path of libSquidStateLibrary.1.dylib into libChargeDischarge1.dylib and .app file.

    Inside the bundle my library location at _Squidstate.app/squidstatelibrary/libSquidStateLibrary.1.dylib

    //change Binary path in Plugin

    install_name_tool -change libSquidStateLibrary.1.dylib @executable_path/squidstatelibrary/libSquidStateLibrary.1.dylib ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/prebuilt/libChargeDischarge1.dylib

    // change binary path in app

    install_name_tool -change libSquidStateLibrary.1.dylib @executable_path/squidstatelibrary/libSquidStateLibrary.1.dylib ./../../out/Release/_SquidStat/_SquidStat.app/Contents/MacOS/_SquidStat

    solution may be helpful to novice programmer like me.
    Thank you.

  • 0 Votes
    6 Posts
    2k Views
    D

    @MaxL Yes! That did it. I had been misusing that option from the start. Thanks for spotting it!

  • 0 Votes
    5 Posts
    5k Views
    StevenFSS

    Bug Report: https://bugreports.qt.io/browse/QTBUG-65844
    "macdeployqt produced .dmg on High Sierra not working on El Capitan"

  • 0 Votes
    35 Posts
    9k Views
    SGaistS

    Looks correct yes

  • 0 Votes
    11 Posts
    4k Views
    G

    @chips-and-fish Thank you so much ! That fixed it.
    Although I am a bit surprised as the path to Framework is an artifact of macdeployqt; one would think it would automatically add it...

  • 0 Votes
    6 Posts
    4k Views
    SGaistS

    Yes it is, but I just saw I misunderstood how you used it. There's been cases where developer gave the Qt installation QML path.

    Can you share your QML imports ? There might be something there that could be useful to understand why not everything needed was included.

  • 1 Votes
    2 Posts
    1k Views
    P

    I now filed a bug https://bugreports.qt.io/browse/QTBUG-54960.

  • 0 Votes
    6 Posts
    2k Views
    S

    Hi everyone!

    I've test the command and all works fine if I commented module "Qt.labs.controls 1.0". But if I use this model I receive error every time when I try to use macdeplotqt tool.

    QmlApplicationEngine failed to load component qrc:/qml/main.qml:340 Type ApplicationDetailView unavailable qrc:/qml/Applications/ApplicationDetailView.qml:140 Type ApplicationTestsResultsView unavailable qrc:/qml/Applications/ApplicationTestsResultsView.qml:243 Type CreateTestcaseView unavailable qrc:/qml/Applications/Testcases/CreateTestcaseView.qml:302 Type CustomComboBox unavailable qrc:/qml/Components/CustomComboBox.qml:3 module "Qt.labs.controls" plugin "qtquickcontrolsplugin" not found

    I think the problem with plugin. I'll wait RC version of Qt 5.7 maybe this bug will be fixed.

  • 0 Votes
    3 Posts
    1k Views
    M

    @jsulm You're right. I don't know why I didn't think of that

    I filled in a bug report regarding this issue here: https://bugreports.qt.io/browse/QTBUG-51728

  • 0 Votes
    14 Posts
    4k Views
    SGaistS

    What is still confusing ?

  • 0 Votes
    2 Posts
    1k Views
    M

    I found the answer. The problem is that the QtWebKit.framework bundle requires some of these other ones, even though I might not be using them. The only fix would be to acquire the QtWebKit.framework project, remove the QML and Quick dependencies, recompile, swap that framework bundle out of my project after macdeployqt, and then remove the QML and Quick framework bundles.

    Long story short, that ain't happening. Not worth my time because it's super difficult.

  • 0 Votes
    6 Posts
    3k Views
    hskoglundH

    Yes, Qt is kind of braindead :-) before QApplication a(argc, argv); not many things work; it tries to load the libqcocoa.dylib when you specify that Fusion setting line, and because you did it before the QApplication constructor, Qt hasn't found and read in qt.conf file (written by macdeployqt, it tells Qt where to find libqcocoa.dylib). That's why moving the Fusion setting after makes Qt much happier.

    P.S. Actually you can get around this error in another way than by moving the Fusion setting line: by copying the PlugIns folder (created by macdeployqt in example.app) and place it together with the .exe/ELF file (MacOs/example). Because then Qt can load the Cocoa plugin without having read any qt.conf file.

  • 0 Votes
    5 Posts
    4k Views
    M

    Some added notes from the trenches:

    Above, I describe a small stub setup that downloads a larger payload. However, if your payload is large from the server, you're going to be looking at the screen stuck at the "Running package scripts..." notice and a jammed progress bar while it continues to download over Curl your larger payload. One solution to that in your preinstall Bash script is to do this:

    osascript -e 'tell application "System Events" to set visible of process "Installer" to false'

    That super neat trick hides the installer so that you can show something else. That way, the customer doesn't think your installer just jammed.

    Then, build yourself a simplistic ObjectiveC application that looks just like that Installer but shows a more active progress bar (use a timer) and then displays a few messages like "Downloading..." and "Finishing download..." and stuff like that. Of course, you can do it in Qt, but even the most minimum Mac-based Qt widget app (not statically compiled) is 8.9MB zipped, whereas in ObjectiveC you can make an app that does the same thing in a mere 32K (unzipped). (Oh, and for you QML die-hards out there, a widget-based app has you topped on file size. I was seeing 12.1MB zipped for something comparable in QML.)

    Once that Curl has finished, it can then kill the ObjectiveC process and reverse the osascript to get the installer to show you the Finish page.

    If deploying a large commercial application, and especially if you need to hook up special high-permission items and require script control, then you may not want to use either the .pkg or .dmg formats at all. This is because, psychologically, customers are not likely to want to download a huge honking 200MB+ DMG or PKG file. Instead, they would be more likely to download a smaller file, run it, and then when it says Installing, it does the rest of the download steps. (I know it's the same wait time, but psychology is important in product marketing.) Take a look at Norton's Antivirus for the Mac. (There's a free trial on their website.) They basically made an ObjectiveC / Cocoa application and then zipped it. However, it's a stub setup that's very small. When you run it, it then shows the typical EULA and then starts downloading components from the web, and putting things into the appropriate places.