Solved How to command line build a proper dmg from a Qt app
-
Hi,
macdeployqt
uses system tools to build the .dmg. These tools depending on the macOS version you have as well as your root file system will not generate the same .dmg content. There's now an option in the more recent versions ofmacdeployqt
that allows to set the filesystem used to build the .dmg and uses a sensible default that is backward compatible. -
@SGaist Is there an example I can get on how to use the new way in
macdeployqt
to get a properdmg
? -
Just use a recent version of
macdeployqt
. The option is-fs
. -
Looks like
-fs
did somthing with filestystem. I can see it logged the follwing extra thing. But its still the same issueLog: Image will use "HFS+"
But, If I open
MyApp/MyApp.app/Contents/MacOS/MyApp
then it complains the following on console and gives up with a crashQQmlApplicationEngine failed to load component qrc:/qml/main.qml:1 module "QtQuick" is not installed qrc:/qml/main.qml:4 module "QtWebView" is not installed qrc:/qml/main.qml:2 module "QtQuick.Window" is not installed qrc:/qml/main.qml:3 module "QtQuick.Controls" is not installed qrc:/qml/main.qml:1 module "QtQuick" is not installed qrc:/qml/main.qml:4 module "QtWebView" is not installed qrc:/qml/main.qml:2 module "QtQuick.Window" is not installed qrc:/qml/main.qml:3 module "QtQuick.Controls" is not installed qrc:/qml/main.qml:1 module "QtQuick" is not installed qrc:/qml/main.qml:4 module "QtWebView" is not installed qrc:/qml/main.qml:2 module "QtQuick.Window" is not installed qrc:/qml/main.qml:3 module "QtQuick.Controls" is not installed qrc:/qml/main.qml:1 module "QtQuick" is not installed qrc:/qml/main.qml:4 module "QtWebView" is not installed qrc:/qml/main.qml:2 module "QtQuick.Window" is not installed qrc:/qml/main.qml:3 module "QtQuick.Controls" is not installed [1] 57951 segmentation fault /Volumes/MyApp/MyApp.app/Contents/MacOS/MyApp
-
You did not use the
qmldir
option when running macdeployqt. -
@SGaist
Ah superb ! This made a difference. Now if I doubled clicked on the dmg and openedMyApp/MyApp.app/Contents/MacOS/MyApp
that is inside it. It works and I am able to launch my app.Thanks a lot till here.
But I am still curious why just double clicking on
MyApp
dies not work? Why do I have to runMyApp/MyApp.app/Contents/MacOS/MyApp
instead of justMyApp
? -
Do you have any error message ?
-
@SGaist
The error message says following with a pop upYou can’t open the application “MyApp.app” because it is not
supported on this type of Mac. -
Are you using a pre-built version of Qt to build your application ?
By the way, why not use a more recent version of 5.9 ?
-
Do you mean 5.9.6 ? I am using 5.9.4 but this error occurs even if I build with
5.11.2
. -
Can you show your .pro file ?
-
My .pro file has so many things which is due to multiple stuff and it would not make much sense to share it here. But I have set
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.12
andQML_IMPORT_PATH
is set to nothing. Plus, following are some more settings I have in my .pro which might be relevant to this questionCONFIG += c++14 CONFIG -= bitcode
I am marking this Topic as solved. Do let me know if have a suggestion on this last error.