App crashes after deployment
-
Hello, I have a problem which I have 1 day to solve. I want to deploy my qml application to be able to run on a clean system. No matter the os. I have a windows computer and a macos laptop. on both platforms on a brand new project when I try to use
windeployqt
ormacdeployqt
the application crashes before it even starts. for macos I use this commandboyankiovtorov@Boyans-MacBook-Air Qt_6_8_0_for_macOS-Release % macdeployqt appuntitled1.app -qmldir=/Users/boyankiovtorov/Documents/untitled1/build/Qt_6_8_0_for_macOS-Release/untitled1 -dmg
Please do tell what I am doing wrong
-
I used a command which worked for my windows computer but on macos i still have issues
boyankiovtorov@Boyans-MacBook-Air Qt_6_8_0_for_macOS-Release % macdeployqt appFinbank.app -qmldir=/Users/boyankiovtorov/Documents/Finbank/build/Qt_6_8_0_for_macOS-Release/Finbank -dmg -verbose=1 ERROR: Cannot resolve rpath "@rpath/QtHunspellInputMethod.framework/Versions/A/QtHunspellInputMethod" ERROR: using QList("/Users/boyankiovtorov/Qt/6.8.0/macos/lib", "/Users/boyankiovtorov/Documents/lib") ERROR: Cannot resolve rpath "@rpath/QtHunspellInputMethod.framework/Versions/A/QtHunspellInputMethod" ERROR: using QList("/Users/boyankiovtorov/Qt/6.8.0/macos/lib", "/Users/boyankiovtorov/Documents/lib")
-
It tells you that it can't find the library bundle
QtHunspellInputMethod.framework
. Double check that it is available in the Qt installation directory, I think it is part of the virtual keyboard module.Though, not sure how your *.app bundle even runs locally if that's the error from the deployment tool.
-
The output says that the program can not find
Qt PDF
Qt Virtual Keyboard
Qt Multimedia (as a dependency)boyankiovtorov@Boyans-MacBook-Air Release % macdeployqt appFinbank.app -qmldir=/Users/boyankiovtorov/Documents/Finbank/build/Qt_6_8_2_for_macOS-Release/Release/Finbank -dmg -verbose=1 ERROR: Cannot resolve rpath "@rpath/QtPdfQuick.framework/Versions/A/QtPdfQuick" ERROR: using QList("/Users/boyankiovtorov/Qt/6.8.2/macos/lib", "/Users/boyankiovtorov/Documents/Finbank/build/Qt_6_8_2_for_macOS-Release/lib") ERROR: Cannot resolve rpath "@rpath/QtPdf.framework/Versions/A/QtPdf" ERROR: using QList("/Users/boyankiovtorov/Qt/6.8.2/macos/lib", "/Users/boyankiovtorov/Documents/Finbank/build/Qt_6_8_2_for_macOS-Release/lib") ERROR: Cannot resolve rpath "@rpath/QtHunspellInputMethod.framework/Versions/A/QtHunspellInputMethod" ERROR: using QList("/Users/boyankiovtorov/Qt/6.8.2/macos/lib", "/Users/boyankiovtorov/Documents/Finbank/lib") ERROR: Cannot resolve rpath "@rpath/QtHunspellInputMethod.framework/Versions/A/QtHunspellInputMethod" ERROR: using QList("/Users/boyankiovtorov/Qt/6.8.2/macos/lib", "/Users/boyankiovtorov/Documents/Finbank/lib") ERROR: Cannot resolve rpath "@rpath/QtPdf.framework/Versions/A/QtPdf" ERROR: using QList("/Users/boyankiovtorov/Qt/6.8.2/macos/lib", "/Users/boyankiovtorov/Documents/Finbank/build/Qt_6_8_2_for_macOS-Release/Release/lib")
and I confirmed it using otool
boyankiovtorov@Boyans-MacBook-Air Qt_6_8_2_for_macOS-Release % otool -L appFinbank.app/Contents/MacOS/appFinbank appFinbank.app/Contents/MacOS/appFinbank: @rpath/QtMultimedia.framework/Versions/A/QtMultimedia (compatibility version 6.0.0, current version 6.8.2) @rpath/QtNetworkAuth.framework/Versions/A/QtNetworkAuth (compatibility version 6.0.0, current version 6.8.2) @rpath/QtSql.framework/Versions/A/QtSql (compatibility version 6.0.0, current version 6.8.2) @rpath/QtCharts.framework/Versions/A/QtCharts (compatibility version 6.0.0, current version 6.8.2) @rpath/QtQuickControls2.framework/Versions/A/QtQuickControls2 (compatibility version 6.0.0, current version 6.8.2) @rpath/QtOpenGLWidgets.framework/Versions/A/QtOpenGLWidgets (compatibility version 6.0.0, current version 6.8.2) @rpath/QtWidgets.framework/Versions/A/QtWidgets (compatibility version 6.0.0, current version 6.8.2) @rpath/QtQuick.framework/Versions/A/QtQuick (compatibility version 6.0.0, current version 6.8.2) @rpath/QtQmlMeta.framework/Versions/A/QtQmlMeta (compatibility version 6.0.0, current version 6.8.2) @rpath/QtQmlWorkerScript.framework/Versions/A/QtQmlWorkerScript (compatibility version 6.0.0, current version 6.8.2) @rpath/QtOpenGL.framework/Versions/A/QtOpenGL (compatibility version 6.0.0, current version 6.8.2) @rpath/QtGui.framework/Versions/A/QtGui (compatibility version 6.0.0, current version 6.8.2) /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2487.60.105) /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 343.19.0) @rpath/QtQmlModels.framework/Versions/A/QtQmlModels (compatibility version 6.0.0, current version 6.8.2) @rpath/QtQml.framework/Versions/A/QtQml (compatibility version 6.0.0, current version 6.8.2) @rpath/QtNetwork.framework/Versions/A/QtNetwork (compatibility version 6.0.0, current version 6.8.2) @rpath/QtCore.framework/Versions/A/QtCore (compatibility version 6.0.0, current version 6.8.2) /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/UniformTypeIdentifiers.framework/Versions/A/UniformTypeIdentifiers (compatibility version 1.0.0, current version 709.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1700.255.5) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.120.2)
looking at the qt maintencetool i can see that I have installed them all. Can anyone help?
-
Hi,
You can pass additional modules to include to macdeployqt. Add those that are missing currently.
-
Hi, could you clarify more. Should I try to copy them inside the app package something like
cp -R /Users/boyankiovtorov/Qt/6.8.2/macos/lib/QtPdf.framework appFinbank.app/Contents/somewhere/ cp -R /Users/boyankiovtorov/Qt/6.8.2/macos/lib/QtVirtualKeyboard.framework appFinbank.app/Contents/somewhere/ cp -R /Users/boyankiovtorov/Qt/6.8.2/macos/lib/QtMultimedia.framework appFinbank.app/Contents/somewhere/
or should i try to pass them inside the command of macdeploy
chatgpt says the command should look something like thismacdeployqt appFinbank.app \ -executable=appFinbank.app/Contents/MacOS/appFinbank \ -libpath=/Users/boyankiovtorov/Qt/6.8.2/macos/lib \ -dmg \ -verbose=1 ``` but still no success.
-
I got to a point where I don't get any errors but the app still crashes when launched
boyankiovtorov@boyans-air Release % cp -R /Users/boyankiovtorov/Qt/6.8.2/macos/lib/QtPdf.framework appFinbank.app/Contents/Frameworks/ boyankiovtorov@boyans-air Release % cp -R /Users/boyankiovtorov/Qt/6.8.2/macos/lib/QtPdfQuick.framework appFinbank.app/Contents/Frameworks/ boyankiovtorov@boyans-air Release % cp -R /Users/boyankiovtorov/Qt/6.8.2/macos/lib/QtHunspellInputMethod.framework appFinbank.app/Contents/Frameworks cp: /Users/boyankiovtorov/Qt/6.8.2/macos/lib/QtHunspellInputMethod.framework: No such file or directory boyankiovtorov@boyans-air Release % cp -R /Users/boyankiovtorov/Qt/6.8.2/macos/lib/QtVirtualKeyboard.framework appFinbank.app/Contents/Frameworks/ boyankiovtorov@boyans-air Release % install_name_tool -add_rpath @executable_path/../Frameworks appFinbank.app/Contents/MacOS/appFinbank boyankiovtorov@boyans-air Release % install_name_tool -change @rpath/QtPdf.framework/Versions/A/QtPdf @executable_path/../Frameworks/QtPdf.framework/Versions/A/QtPdf appFinbank.app/Contents/MacOS/appFinbank boyankiovtorov@boyans-air Release % install_name_tool -change @rpath/QtPdfQuick.framework/Versions/A/QtPdfQuick @executable_path/../Frameworks/QtPdfQuick.framework/Versions/A/QtPdfQuick appFinbank.app/Contents/MacOS/appFinbank boyankiovtorov@boyans-air Release % install_name_tool -change @rpath/QtVirtualKeyboard.framework/Versions/A/QtVirtualKeyboard \ @executable_path/../Frameworks/QtVirtualKeyboard.framework/Versions/A/QtVirtualKeyboard \ appFinbank.app/Contents/MacOS/appFinbank boyankiovtorov@boyans-air Release % mkdir -p appFinbank.app/Contents/Resources/qml/QtQuick/ boyankiovtorov@boyans-air Release % cp -R /Users/boyankiovtorov/Qt/6.8.2/macos/qml/QtQuick/VirtualKeyboard appFinbank.app/Contents/Resources/qml/QtQuick/ boyankiovtorov@boyans-air Release % macdeployqt appFinbank.app \ -qmldir=/Users/boyankiovtorov/Documents/Finbank/build/Qt_6_8_2_for_macOS-Release/Release/Finbank \ -dmg -verbose=1
what can I do to debug why is it crashing
-
I ran a debugger to check what is going on and it looks like the program needs "cocoa"?. Anyway it finds it but it doesn't link
(lldb) run Process 70275 launched: '/Users/boyankiovtorov/Documents/Finbank/build/Qt_6_8_2_for_macOS-Release/Release/appFinbank.app/Contents/MacOS/appFinbank' (arm64) 2025-03-09 13:25:17.057987+0200 appFinbank[70275:2518404] [qt.qpa.plugin] Could not load the Qt platform plugin "cocoa" in "" even though it was found. 2025-03-09 13:25:17.058169+0200 appFinbank[70275:2518404] This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: cocoa. Process 70275 stopped