Deployment on OSX
-
Hello,
I have an App which runs fine on Android, Windows and OSX.
However, when I try to deploy the App on OSX on a machine without Qt installed and follow the Qt OSX Deployment guide to do this, my App does not run.
I have run the following commands as found in the Qt OSX Deployment howto:
- Copy the frameworks into the App folder:
cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtCore.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks
cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtGui.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks
cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtNetwork.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks
cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtQml.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks
cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtQuick.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks
cp -R /Users/adminmac/Qt/5.4/clang_64/lib/QtWidgets.framework /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks- The -id mode is for libraries and frameworks, and allows us to specify a new identification name:
install_name_tool -id @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore
install_name_tool -id @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui
install_name_tool -id @executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork
install_name_tool -id @executable_path/../Frameworks/QtQml.framework/Versions/5/QtQml /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtQml.framework/Versions/5/QtQml
install_name_tool -id @executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtQuick.framework/Versions/5/QtQuick
install_name_tool -id @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets
- We use the -change mode to change the paths in the application:
install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool
install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool
install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtNetwork.framework/Versions/5/QtNetwork @executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool
install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtQml.framework/Versions/5/QtQml @executable_path/../Frameworks/QtQml.framework/Versions/5/QtQml /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool
install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtQuick.framework/Versions/5/QtQuick @executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool
install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool
install_name_tool -change /Users/adminmac/Qt/5.4/clang_64/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/Frameworks/QtGui.framework/Versions/5/QtGui
-
Mate, just use macdeployqt tool... it will do all this automatically for you. Link to more info.
-
@sierdzio thanks for that! I have used macdeployqt and it has put the frameworks and the plugins inside the App folder.
However, when I run the App after running macdeployqt it does not load up anymore.
I wonder what is the problem here?
-
Try running it from the console, maybe it will print some useful error message. Or, if the standard OS X crash report pops up, open the report and it will likely show you where the problem is.
-
Thanks, I tried running it from the console, running:
open -a YateleySchool.app
And there is no output. Perhaps I am doing the wrong thing here? Maybe there is a different command?
-
Yes, try this instead:
./YateleySchool.app/Contents/MacOS/yourappname
Does any application window show up (blank, for example)?
-
Also, please check the output of otool -L command.
-
I tried this and nothing appears. The icon appears in the OSX Dock but no application window appears.
Here is the output:
viss-imac:YateleySchool adminmac$ /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool
QQmlApplicationEngine failed to load component
qrc:/main.qml:8 module "QtQuick" plugin "qtquick2plugin" not foundAnd here is otool -L
viss-imac:YateleySchool adminmac$ otool -L /Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool
/Users/adminmac/Desktop/build-YateleySchool-Desktop_Qt_5_4_1_clang_64bit-Release/YateleySchool.app/Contents/MacOS/YateleySchool:
@executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.4.0, current version 5.4.1)
@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui (compatibility version 5.4.0, current version 5.4.1)
@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore (compatibility version 5.4.0, current version 5.4.1)
/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
@executable_path/../Frameworks/QtQml.framework/Versions/5/QtQml (compatibility version 5.4.0, current version 5.4.1)
@executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.4.0, current version 5.4.1)
@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.4.0, current version 5.4.1)
/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 104.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
viss-imac:YateleySchool-Android adminmac$ -
@drewpotter said:
tquick2plugin" not found
Hi,
I think the problem is macdeployqt doesn't upload any QML plugins/libraries. To fix this you need execute macdeployqt with parameter -qmldir. And set path to your application QML files.
-
Otool looks correct. The thing to blame is 'module "QtQuick" plugin "qtquick2plugin" not found'
I think you can instruct macdeployqt tool to include QML stuff using
-qmldir=<path>
but you would have to Google it to get a concrete answer: I haven't used a Mac in a long time and I don't remember the details.