tags:

views:

1747

answers:

3

Now that Qt goes LGPL I tend to give it a try again. Years ago I decided against for some reasons, one of them being the huge size of executables (Qt on windows). I found a lower limit of about 5MB. Trolltech affirmed this on request but told me, that the granularity will be improved, which would lead to smaller sizes (depending on required elements).

Things could have changed meanwhile. Which is the size of "hello world" (windows and console) in Qt nowadays?

It's about statically linking. I think qtCore and qtGui are required.

+3  A: 

There is a Discussion from 2007 here, the smallest number I saw there after a quick glance over it was 1.3 MB (compressed using UPX), so it seems it can be lowered a bit, but still is fairly large.

schnaader
+3  A: 

Hi,

Our Installbuilder for Qt product is a crossplatform installation tools that has a Qt frontend and is used by many commercial developers (including Trolltech itself for packaging their QtCreator IDE). Using 4.4 and compiling out the parts that we did not need, we got the overhead down to 4.1 Mb on Linux x86, 5.2M on Linux x64 and 5.3Mb on Windows. Take into account that this is before processing it with UPX. Also, if the same binary needs to support multiple Linux distributions, you may need to consider shipping libstdc++, which will add about 800kb to the size.

You will need to build your own versions, and basically enable / disable ifdef# for widgets that you do not use, image formats you do not need to support, etc. Although the Qt source code is already prepared for that, and there are some tools that should help, the reality is that it is a cumbersome manual process (but necessary for an app like ours). Their embedded version (formerly known as QTopia) and 'regular' Qt were merged into the same codebase, so I am sure moving forward it will be increasingly easier to build customized/trim down versions.

Daniel Lopez
+1  A: 

This depends largely on your configuration and deployment method. You can of course compile as static which will exclude code which isn't used. You can also strip out things like exceptions and STL which will make memory and disk footprint even smaller. And finally, whether you are using a compressed file system like squashfs, cramf or jffs2. Try

configure --help

for lots of options. With the embedded ports of Qt for Embedded Linux and Windows CE you can also use qconfig to load configuration files which allow you to strip out many feature groups. See http://doc.trolltech.com/main-snapshot/fine-tuning-features.html for more info.

Henrik Hartz