Qt: Deployment size issue

Created on 22 Feb 2019  路  5Comments  路  Source: therecipe/qt

When I look at the deploy/linux folder I see that it's 133MB for a very small single screen app. Are all the shared libraries and *.qml files really needed? For example I see that there are sqlite related things there but I don't use local storage at all. How can I know which one is needed and which one is not? Shouldn't this be automatically decided by qtdeploy cmd?

Thanks

Most helpful comment

I created a new static linux docker image (linux_static), which produces more lightweight deployments. Applications deployed with this image should weight between 15 MB (widgets) and 35 MB (qml/quick) now.

All 5 comments

Hey

Yeah, qtdeploy is currently deploying more than really is necessary to make it work.

The problem is, that while qtdeploy can simply wrap Qt's windowsdeployqt or macdeployqt on platforms such as Windows and macOS, there is no official linuxdeployqt to properly handle the dependency resolution for Linux binaries.
And so qtdeploy is resorting to some really basic dependency resolution which should work in most cases, but for it to work it needs to deploy more stuff than is actually necessary.

It might be possible to use https://github.com/probonopd/linuxdeployqt in combination with qtdeploy in the future, like I wrote here https://github.com/therecipe/qt/issues/535 but I haven't had the time to look into that yet.
Also I might start providing static linux builds of Qt in the future, which somewhat works around this problem since the dependency resolution can then be simply made at link time by the compiler.

However, what you could try right now is to test linuxdeployqt on your own, or maybe to manually use ldd or objdump to figure out if a dependency is needed or not.
Also if you just make use of the widgets package and don't work with qml at all, then you can probably safely remove the qml folder and most of the plugins.

I've tried the ldd way and was really disappointed with QT. A simple app is still 75 MB. At this point QT is much more heavy then Electron for making GUI apps. But none of this is due to this package so I'm closing this one. Thank you.

No problem, yeah much of the weight of the dynamically linked Linux versions is also due the ICU libs iirc, but you could compile them yourself and so reduce the weight about 30mb or something.

I created a new static linux docker image (linux_static), which produces more lightweight deployments. Applications deployed with this image should weight between 15 MB (widgets) and 35 MB (qml/quick) now.

thanks right on time for our shipment

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fabstu picture fabstu  路  4Comments

adneg picture adneg  路  6Comments

ohenepee picture ohenepee  路  4Comments

ismlsmile picture ismlsmile  路  5Comments

vahid-sohrabloo picture vahid-sohrabloo  路  7Comments