Qt: Reduce the size of the default.app

Created on 21 Jun 2017  路  2Comments  路  Source: therecipe/qt

Today I was trying the library but when I compile the most simple app with the qtdeploy I get a file size of 40mb~. Where I can read to get it optimized? Can I simply delete files on the framework folder or Plugins folder?

This is probably not the best place to question about it, but I don't know where to search. Thanks

Most helpful comment

Hey

Yeah, the file size is still bigger than necessary in most cases.
But depending on what modules you used, 40mb aren't that bad.
If you for example created an qml or qml/quick application than 40mb is the average size.
You can reduce that a bit (~5mb) by removing the "qt/quick" import and only using "qt/qml".

However there are a few improvements planned that should reduce the average size around 5-10mb.

Can I simply delete files on the framework folder or Plugins folder?

Removing unnecessary frameworks won't work (it will work on your machine with Qt installed, but will crash on another machine without Qt)
Removing plugin folders would work, but they don't weight that much and it might also lead to runtime crashes.

What you can do, would be to compile Qt on your own: http://doc.qt.io/qt-5/build-sources.html and configure it to compile without the unnecessary modules (and maybe also use the "-static" flag to create a static version)
This will probably half the file size, but is also a bit of a hassle if you have never done it before.

All 2 comments

Hey

Yeah, the file size is still bigger than necessary in most cases.
But depending on what modules you used, 40mb aren't that bad.
If you for example created an qml or qml/quick application than 40mb is the average size.
You can reduce that a bit (~5mb) by removing the "qt/quick" import and only using "qt/qml".

However there are a few improvements planned that should reduce the average size around 5-10mb.

Can I simply delete files on the framework folder or Plugins folder?

Removing unnecessary frameworks won't work (it will work on your machine with Qt installed, but will crash on another machine without Qt)
Removing plugin folders would work, but they don't weight that much and it might also lead to runtime crashes.

What you can do, would be to compile Qt on your own: http://doc.qt.io/qt-5/build-sources.html and configure it to compile without the unnecessary modules (and maybe also use the "-static" flag to create a static version)
This will probably half the file size, but is also a bit of a hassle if you have never done it before.

Thank you very much for the clarification. I will keep this in mind and hope to soon be able to use the bindings in a serious project.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amlwwalker picture amlwwalker  路  3Comments

LimEJET picture LimEJET  路  6Comments

angiglesias picture angiglesias  路  5Comments

woodyjon picture woodyjon  路  5Comments

adneg picture adneg  路  6Comments