QT5 produces half/incomplete macOS package
-
This post is deleted!
-
@why-it-dont-work
Hi, you are likely to need macdeployqt tool to include needed libraries. Once you do that it all depends on your needs for future distribution: you can create .dmg (macdeployqt can help you with that and code signing), you can create .pkg.
There is also Qt's Installer Framework which might or might not be of use for you.A note regarding use of macdeployqt: if your target is Apple AppStore there are additional requirements mentioned in the manual of the tool, i.e. you are likely to create hardened runtime. Also, since you need to notarise binaries I found myself having a shell script that handles all calls to
codesign
. (but that's really outside Qt) -
here is a snippet from .pro file:
QMAKE_POST_LINK = ${QTDIR}/bin/macdeployqt MyApp.app -always-overwrite -dmg MyApp.dmg;
Even after this line, the application is not complete
-
@why-it-dont-work
I never tried to run it this way. What error messages you get?It might be worth to try manual approach:
- copy resulting .app package somewhere, separate folder would be great;
- cd there;
- run minimal macdeployqt in the form of
{your Qt location}/macdeployqt {yourappname}.app
; - try to run it;
Since you are not signing it GateKeeper will probably complain but that's alright at this stage, if GateKeeper complains it means all the needed libs should be included.
Also, since you asked similar questions about Linux deployment I'd advise you to read the basics of deployment techniques for all the platforms needed. I don't know much about packaging for Linux, for macOS though the absolute basics are here:
-
@why-it-dont-work Also, what macOS version you run? Catalina, BigSur, something ancient?
-
Thanks for guiding. I am using Catalina. Let me try
{your Qt location}/macdeployqt {yourappname}.app
; -
{your Qt location}/macdeployqt {yourappname}.app
says file already exists, skip copy.
Then I built the
sudo productbuild --content MyApp.app --sign "Developer ID Installer: XXX(YYY)" ~/Documents/signed.pkg
Although it is signed, but still it is incomplete package and does not install.
-
@why-it-dont-work
So it appears that there is problem with the pkt rather than .app?
Can you run the .app after macdeploy? (you can increase verbosity of the tool with -v, -vv etc)
If it runs before productbuild step the problem is there and has nothing to do with Qt. If it does not though, what error do you get when trying to run the .app? -
When I run the application (.app bundle), this error shows:
“MyApp” is damaged and can’t be opened. You should move it to the Trash. -
@why-it-dont-work Does it run ok when you run it from Qt Creator?