PDA

View Full Version : Qt binaries too big.



William Wilson
19th January 2008, 19:29
I'm trying to make the smallest possible Qt binaries with no luck. It turns out that the release versions of QtCore4 is ~1.5MB and QtGui4 ~6MB. You may ask why do you even worry about the size in this era of broadband and cheap storage but I still need to consider slower connection speeds and would like to make the total download size including my application to ~10-12MB.
Considering the fact that MFC DLL(mfc71.dll) is only 1 MB, Qt binaries look to be too big. I'm using these options to build Qt
Code:
qconfigure msvc2005 -debug-and-release -no-qt3support -no-stl -plugin-sql-sqlite -no-mmx -no-3dnow -no-sse -no-sse2 -no-qdbus -no-style-motif -no-style-cde

I would like to take the shared library approach but if Qt static options can make the binaries smaller, I can switch to the static approach.
Thanks in advance on any tips to make the Qt binaries smaller.

elcuco
19th January 2008, 22:14
Use Qt3? Use Qt2?

MFC is small, since it's a wrapper arround operating system functions. Qt re-implements all (top level widgets, internal process managment, text rendering etc). You can't make Qt4 smaller.

jacek
19th January 2008, 22:36
I would like to take the shared library approach but if Qt static options can make the binaries smaller, I can switch to the static approach.
Static approach might give you a smaller binary, since you can strip away everything you don't use.

Brandybuck
20th January 2008, 18:43
Or you could build Qt yourself, and turn off all the features you don't need. This is not well known, because it's meant for Qtopia Core and not Qt. But because they share the same code base, it still works. Look in the assistant page "Fine-Tuning Features in Qtopia Core" for more information.

Of course, if you start customizing Qt, and it breaks, don't blame me! But it is an area to look into if you are overly concerned about the size of the libraries.

wysota
20th January 2008, 20:45
You can also disable exceptions, remove widget styles and tweak the makefile to build Qt size optimized instead of speed optimized (-Os vs -O2 for GCC/MinGW). You can also remove features you don't want to use by adding some defines that will remove particular components.

William Wilson
21st January 2008, 21:18
You can also remove features you don't want to use by adding some defines that will remove particular components.

Thank you. I take it that you're referring to some documented Qt defines. Can you give some examples?

wysota
21st January 2008, 22:23
It's best to look into or grep Qt source code. They are in a form of QT_NO_DRAGANDDROP.

pherthyl
22nd January 2008, 00:46
Well my install files (static or dynamic build) are less than 4MB compressed as an installer. This is for a small app though of ~7000loc, and includes Qt GUI, Qt Core, Qt SQL, and Qt SVG libs, as well as the microsoft runtime libs. I use NSIS to build my installer and compress using LZMA /solid which gives the best compression. I've also distributed a standalone Qt exe in the past which was statically linked and compressed with UPX to get a final exe size of 1.7 mb.

Brandybuck
22nd January 2008, 01:26
As I mentioned above, please look at the page "Fine-Tuning Features in Qtopia Core" in assistant. That is where you can find the documentation on those defines. Really, they are there. Don't let the "Qtopia" name fool you.