Unsolved macdeployqt strips resources from deployed binary
-
That's the goal: build the same application as you and try to trigger the bug with macdeployqt.
-
@DJ-Ogurt just to make sure, you actually modified your
*.pro
file to add extra sources to the app-bundle, usingQMAKE_BUNDLE_DATA
? As far as I know macdeployqt does not copy automatically non Qt-Related (ressource files, frameworks etc) files to make the bundle Executable. The Windows tool doesn't either. -
@J-Hilk I'm not using a *.pro file. I suppose that could be the issue if the deploy program looks for that. Should the project file be in the same directory as the binary or as the app bundle?
-
@DJ-Ogurt you missunderstood me.
The macdeployqt-tool does not need a .pro file. It will go through your qt installation and fetch all (most of the time) dependencies of application and copy them to the appropriate location inside your .app file.
Somtimes you'll have to specify a path, for example if you use qml you'll have to tell the tool where to look for those, or other options.If your application needs additional files that are not part of the binary - for example pixtures in your case, you will have to
- a: copy those by hand to the correct place
or - b: use the QMAKE_BUNDLE_DATA inside your Qt-Project file to tell qmake(I believe) to copy the needed files to the correct place, when creating the binary
- a: copy those by hand to the correct place
-
Ok. So I don't believe I'm using any qml. I do have a qrc file which is included with my cmakelists.txt with
QT5_ADD_RESOURCES(RES_SOURCES resources/resources.qrc )
Images are used in the ui_headers with lines like
<string notr="true">background-image: url(:/images/background.svg)
the folder images is a sub directory in resources.
I'm fine with coping by hand, but I'm not sure where in the app bundle the images should end up.
-
@DJ-Ogurt ah ok,
when all your images are part of the qrc file than they should be part of the binary, and you shouldn't have any more work with it. So I'm kind of out of ideas .One last one, all those images that are not displayed/missing, do they happen to be
svg
files?Maybe QtSvg.framework was not copied correctly? You should check that.
-
@J-Hilk
That's exactly what I thought. They are svg images and it seems that QtSvg.framework is in there. Here's a tree of the svg framework sub dir in Contents/Frameworks/QtSvg.framework/my.app/Contents/Frameworks/QtSvg.framework/ ├── QtSvg -> Versions/Current/QtSvg ├── Resources -> Versions/Current/Resources └── Versions ├── 5 │ ├── QtSvg │ └── Resources │ └── Info.plist └── Current -> 5 5 directories, 3 files
This tree view is after the mac deploy has been run on the app bundle.
-
Just ran into this issue myself. Did you end up finding a resolution?
-
@Richicoder
All frameworks are being copied correctly, the problem is with the svg plugin - you have to copy it later manually. On my MacBook I had to use those commands after using macdeployqt:cd <bundle path>/Contents/PlugIns/imageformats cp /usr/local/Cellar/qt/5.11.1/plugins/imageformats/libqsvg.dylib . install_name_tool -change /usr/local/Cellar/qt/5.11.1/lib/QtGui.framework/Versions/5/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui libqsvg.dylib install_name_tool -change /usr/local/Cellar/qt/5.11.1/lib/QtWidgets.framework/Versions/5/QtWidgets @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets libqsvg.dylib install_name_tool -change /usr/local/Cellar/qt/5.11.1/lib/QtSvg.framework/Versions/5/QtSvg @executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg libqsvg.dylib install_name_tool -change /usr/local/Cellar/qt/5.11.1/lib/QtCore.framework/Versions/5/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore libqsvg.dylib
-
Related bug report: QTBUG-55199