Does QT configuration tool help in optimizing application size ?
-
Can someone help me understand this? Will I be able to reduce my cross compiled QT application size if I strip down the unnecessary features inside a module using QT configuration tool and perform a static build?
I'm trying to build qt statically with commercial license. The configure command helps to omit the unnecessary modules that are required using the -skip option say something like this.
./configure -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts
I believe the configuration tool (GUI tool) that QT provides also does the same job of selecting necessary modules that are required to build. But when using the configuration tool, I'm able to see the features available inside the modules.
For example: Lets say that I compile my application with statically built qt libraries. The only modules that I require are qtdeclarative and qtbase and the executable size is X Megabytes. Now if I use the QT configuration tool and identify and strip down some features withing qtdeclarative and qtbase and rebuild the libraries statically and recompile my application with these new set of libraries, will I be able to reduce my application executable size? I understand that the library size may reduce but will the app size reduce?The problem I face is when I remove features inside a module and rebuild my QT source statically, sometimes the build fails because of some dependencies within the modules and it takes a lot of time to do this activity by enabling/disabling the features.
-
@Srinivasan said in Does QT configuration tool help in optimizing application size ?:
I understand that the library size may reduce but will the app size reduce?
It might. And, as you observed, it is a trial-and-error procedure. Qt Project does not have resources to test each and every combination of configure calls and enabled/ disabled features.
However, since you are using static Qt and static app (right?), most probably you won't gain anything by tweaking features. A static build already includes only the functions that are actually used, others are removed by linker.
-
@sierdzio Thanks for your reply and Yes, I'm building both QT and App as static. As you mentioned, if the linker removes the unwanted functions, then this trial and error activity is of no use as it will not reduce the application size.
We are trying to reduce our application size as much as possible. We are already using the -optimize-size flag while configuring QT and CONFIG+= optimize_full in the project's .pro file.
Just wanted to make sure if removing features using QT configuration tool will save some extra memory or not.
-
You can try using LTO to squeeze the libs even further.
See: https://stackoverflow.com/questions/25878407/how-can-i-use-lto-with-static-libraries
And some more description of what LTO is and does: https://wiki.debian.org/LTO https://gcc.gnu.org/wiki/LinkTimeOptimization