My Mac .app bundle is mostly .dSYM. Why?
-
So I am in the process of resurrecting an old application (QQuickView + QML + custom C++ plugins) last built with Qt 5.7 and bringing it up to Qt 5.15.15. I'm on a 2019 MacBook Pro (x86_64) with up-to-date OS.
So far so good (with both clang_64 and macos path tools, and the universal build has been reported to work on an M-chip machine). But the size of the .app bundles built with the newer Qt is a quite a shocker! (And yes, these are
CONFIG += release
builds. I don't use creator; I have build scripts invoking qmake, make and macdeployqt).The old Qt 5.7 (x86_64) built .app bundle was (according to
du -s -h
) about 50MByte big.The Qt 5.15.15 (x86_64) version is a whopping 205MByte! (And the universal build almost double that again!)
Just looking at the x86_64 builds for now, digging into the app bundle the bulk of the extra space seems to be in
.dSYM
files. Runningdu -s -h -c `find . -name '*.dSYM' -print`
in the .app bundles reveals that the Qt 5.7 x86_64 build has just 80Kbyte total in these files, while the Qt 5.15.15 x86_64 build has 118Mbyte (and the universal has 346Mbyte of 'em!) accounting for the bulk of the increase in .app bundle size.
As I understand it, .dSYM is something to do with debugging symbols. So it seems a bit odd that they have suddenly exploded in size in what I think is a straightfoward qmake build with a .pro file containing
CONFIG += release
and no macdeployqt options other than-qmldir
.Any tips what can be done about this .dSYM explosion? What's changed between Qt 5.7 and Qt 5.15.15 that's caused it? Is there a way of trimming them down again or modifying what's put into the .app? (Some qmake variable or macdeployqt option I'm unaware of?) Is it anything to do with Apple's expectations for what should be uploaded to the Mac "appstore"? Thanks for any pointers.
-
Well it's rather old (almost a decade!) but https://apple.stackexchange.com/questions/113622/is-it-safe-to-delete-dsym-files-on-mac-os-x gave me the confidence to just delete the things (the .dSYM folders) wholesale from the .app bundle. All still seems to work fine with 'em gone.
That reduces the universal build (with 5.15.15) to 170MByte c.f 50MByte for the original Qt 5.7 x86_64 only.
The next frontier (for shaving some bloat) seems to be the .app/Contents/Frameworks folder... the Qt 5.7 build had just 14 (total 29MByte), while the Qt 5.15.15 build has 34 (total 102MByte). Seems to be a related post at https://forum.qt.io/topic/111068/macdeployqt-ends-up-with-lots-of-lib-clutter
-
T timday has marked this topic as solved on
-
An amusing follow up to this.
I noticed my qml folder (the one I was pointing macdeployqt's
-qmldir
option at) had a subfolder calledobsolete
where I'd stowed some old QML possibly going back to the QDeclarative days (this app has a long history).Removing that and rebuilding resulted in the (universal) .app bundle having just 20 frameworks included (still more that the Qt 5.7 build's 14) and the total bundle size shrinking to 123MByte. A bit more credible.
(I'm guessing Qt 5.7's macdeployqt qmldir traverse wasn't recursive, but by 5.15.15 it was).
Of the frameworks included in the 5.15.15 build that weren't in the 5.7 build, the biggest ones seem to be QtPdf (14MByte) and QtVirtualKeyboard (4.1MByte). Simply deleting those doesn't seem to stop the app from functioning (and then it'd be marginal gains after that for any of the other things which might not be needed). But that gets me down to much nearer just double the size of the old Qt 5.7 x86_64 build, which seems not unreasonable for a universal app.
-
-
J johngod referenced this topic on
-
Hi
Just to add more info about how to make the app bundle and the dmg smaller without the dSYM.
I used macdeploy tool with the options -dmg and -always-overwrite, bundle grows to 461MB and the dmg is 173MB . Then I deleted all the .dSYM, took me a while to find they are directories and not files, to delete them all, in the terminal I cd into the bundle.app and then I used the command
rm -rf **/*.dSYM
The app bundle dropped to 266MB (I think it is still much larger than the qt5 version, but still much better than the 461MB). Now to make a new dmg file based on the new bundle I just run the macdeploy tool again (with the options -dmg and -always-overwrite), the app bundle keeps the same 266MB and the new dmg dropped to 110MB. Done.