Solved Intermittent problem with macdeployqt
-
Experienced programmer, almost no experience with Qt.
Details: The program has run successfully many times for years. However, I have had this same problem off and on. This time I can’t find a work around.The error message is
Library not loaded: @rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport
Referenced from:/Volumes/VOLUME/*/Ifstool10.0.app/Contents/MacOS/Ifstool10.0
Reason: image not foundI built it the app using Qt Creator 4.4.1 which is based on Qt 5.9.2.
It runs fine under Qt Creator. It also runs on this computer (the one on which it was built) if Qt Creator is not running. It only crashes when moved to a computer that does not have Qt installed. Also crashes if I rename the Qt home directory.
After building, I used macdeployqt which builds a bundle supposedly containing everything it needs.
Inside the app, in the Contents directory, I find
Qtcore.framework
QtGui.framework
QtPrintSupport.framework
QtSvg.framework
QtWidgets.frameworkSo the supposedly missing framework is there. Some path is wrong somewhere.
Here is my qt.conf file, which lives inside the app in Contents/Resources:
[Paths]
Plugins = PlugIns
Imports = Resources/qml
Qml2Imports = Resources/qml
QtPrintSupport = Frameworks/Qtprintsupport.frameworkThe last one I added in hopes of fixing the problem. It doesn’t. (tried lots of other variations too)
Been having a tough time finding help.
Kasungu -
Hi and welcome to devnet,
Can you run
otool -L
on your deployed QtPrintSupport library in the QtPrintSupport framework ? -
Yes, I had done that. Here is the result:( I notice QtPrintSupport is the first entry)
Clipper:bin wes$ otool -L Ifstool10.0.app/Contents/MacOs/Ifstool10.0
Ifstool10.0.app/Contents/MacOs/Ifstool10.0:
@rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.9.0, current version 5.9.2)
@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.9.0, current version 5.9.2)
@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.9.0, current version 5.9.2)
@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.9.0, current version 5.9.2)
/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)
/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/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0) -
Your application binary looks fine. It's the QtPrintSupport framework itself you should run
otool
on. -
Sorry, had to go out last night. Here it is:
QtPrintSupport:
@rpath/QtPrintSupport.framework/Versions/5/QtPrintSupport (compatibility version 5.9.0, current version 5.9.2)
@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.9.0, current version 5.9.2)
@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.9.0, current version 5.9.2)
@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.9.0, current version 5.9.2)
/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)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1404.32.0)
/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/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 48.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) -
One more item: Maybe my .pro file is not correct...
QT += core
QT += gui
QT += widgets
QT += printsupportVERSION = "10.0"
DEFINES = "MacX64"CONFIG -= console
CONFIG += app_bundle
CONFIG += staticlibTEMPLATE = app
TARGET = $$PWD/bin/Ifstool10.0
INCLUDEPATH += ../hdrSOURCES +=
main.cpp
ifstoolMainWindow.cpp
ifstool.cpp
subclassqapp.cpp
ifs2qt.cpp
ifstoolChildWindow.cpp
ifsOp.cpp
plotMainWindow.cpp
qcustomplot.cppFORMS +=
plotMainWindow.uiHEADERS +=
main.h
../hdr/flip.h
../hdr/ifs.h
../hdr/ifsdocs.h
../hdr/ifsequ.h
../hdr/ifserr.h
../hdr/ifsmatrix.h
../hdr/ifstypes.h
../hdr/nicedefs.h
../hdr/resample.h
../hdr/rfft.h
../hdr/stddefs.h
../hdr/cclC4.h
ifstoolMainWindow.h
ifstool.h
generictypes.h
subclassqapp.h
ifs2qt.h
ifstoolChildWindow.h
ifsOp.h
plotMainWindow.h
qcustomplot.hmacx {
QMAKE_MAC_SDK=macosx10.12
}macx: LIBS += -L$$PWD/../lib/macX64/ -lifs
INCLUDEPATH += $$PWD/../lib/macX64/ifslib
DEPENDPATH += $$PWD/../lib/macX64/ifslibmacx: PRE_TARGETDEPS += $$PWD/../lib/macX64/libifs.a
RESOURCES +=
images.qrcPlugins = PlugIns
-
Can you check with a more recent version of Qt ? IIRC the current is 5.9.3 but you can also test 5.10
-
I just built 5.9.3 and tried it. It failed in an identical way. I can try 5.4, but I fear this is not the problem.
-
I downloaded and tried 5.4. This fails with
This application failed to start because it could not find or load the Qt platform plugin "cocoa" and that is running under Qt Creator.
I tried the complete download/install on this twice. I'll go back to 5.9.3.
Wesley -
Is your code available somewhere to test the deployment ?
-
The source code is not on a public cloud at the moment, but I'll be glad to send it to you. But how do we do it without making our actual email addresses public? I have used Wetransfer and Dropbox both.
-
@Kasungu This may be a stupid question, but are you sure, that you use the correct macdeployqt-tool ?
Each installation of Qt - 5.9.3, 5.92, 5.4 etc. - each come with their own deploy-tool. If you're using the 5.4 tool for a 5.9.3 binary, than theres a high chance that it won't work.
A file is copied into the folder, but the wrong one.
-
It was a great idea! I was excited, but I checked and unfortunately I had done it right. But I double-checked, made sure no other versions of Qt existed, rebuilt using the version of Creator which was in 5.9.3, etc. It still fails in the same way.
(By the way, when I run the version of Creator in 5.9.3, and hit About Creator, I get
"Based on Qt 5.9.2". I presume this is because Creator did not change between 5.9.2 and 5.9.3, and this message didn't get changed. Right?)Sigh..
-
@Kasungu said in Intermittent problem with macdeployqt:
"Based on Qt 5.9.2".
Means what Qt Creator was build with and it is not related to the version of Qt
you are using to build your application.
In fact you can have multiple version of Qt installed and use in the same Creator. -
I found the fix! all it required was the correct switch used withmacdeployqt:
/Users/[PathtoQt]/Qt/5.9.3/clang_64/bin/macdeployqt [space] /Users/[pathtoapp]/ThisApp.app - [note the dash] executable=/Users/[pathtoapp]ThisApp.app/Contents/MacOS/ThisApp
The online manual says this about that switch:
-executable=<path> Let the given executable also use the deployed frameworks
Perhaps this could be described a bit more clearly, since if you do this, all the stuff using Install_name_tool isn't needed. (Finding this took me weeks). Of course, I am not a Qt guru, maybe it's just me.
-
It's a bit surprising, in most cases you shouldn't need that option.
Anyway, glad you found out and thanks for sharing ! :)