PDA

View Full Version : Self contained, small as possible app.



squidge
5th October 2009, 13:01
I'm trying to squeeze down a Qt app to be as small as possible. I've tried several custom rebuilds of Qt. All use statically compiled executables in 'release' mode.

The smallest size of an application compiled in QtCreator (g++) is 9MB, which works fine, but exe compressors don't work on it. It will however fit into a 3MB RAR archive, so not that bad, but not exactly brilliant either.

If I use Visual Studio with the exact same settings, the app is 4.5MB, works fine, has no dependancy on mingw32, and compresses to a 1.8MB RAR archive or 1.8MB executable.

Am I seeing the right picture here? Is Visual studio really that good that it can halve the size of the application, or am I missing some flags I can pass to the G++ compiler that QtCreator uses?

I only use QtCore and QtGUI. I don't care about the size of the executable during development, but I do when the application is compiled in release format.

I'm quite suprised that even a very simplistic "Hello World!" application is still just under 9MB in size.

axeljaeger
7th October 2009, 13:25
"Strip" the binary: There shall be an executable "strip" with your mingw-installation. Run it on the binary and see what happens.

lyuts
15th October 2009, 10:33
I think 'strip' won't help since he is building in release mode.

axeljaeger
15th October 2009, 12:06
strip does not only remove debug symbols but also unneeded symbols. So it is worth a try. It takes like 5 seconds to try out.

Boron
16th October 2009, 15:58
Afterwards: http://en.wikipedia.org/wiki/UPX