Question

I'm learning to develop apps using Qt Creator. I have built a simple app under Windows, depends on uses mingwm10.dll, QtCore4.dll, QtGui4.dll, QtNetwork4.dll. Out of QtQui4.dll I use only a a couple of widgets, and don't need all of the rest... Is it possible to either shrink the size of QtGui4.dll or do something else to decrease deployment size of application? How about static linking? Will it embed the whole dll, or only parts of it that are used? And also is it possible with Qt to link some dlls staticly and some dynamicly?

Was it helpful?

Solution

It's not possible to shrink the QtGui4.dll by removing some functions. Trolltech is having a look at this, but the good solution seems quite distant:

Static linking, I think it is very problematic on windows. Each time I tried, it was a nightmare.

So, it looks like you are stuck with the regular DLL. The only thing you can do (which I do for my Qt apps is):

  • use UPX to compress your DLL

or

  • use strong compression in your installer

If you already UPX your dll, you can not reduce it further with the installer compression, but this can reduce other files.

OTHER TIPS

The best way is to manually configure the Qt library with configure. By issuing

configure --help

you'll see a number of options that might help reduce both disk and memory footprint. E.g.

--no-stl
--no-exceptions

can both reduce the footprint of your application. You can also modify the mkspec to use more aggressive optimization flags for your compiler.

If you link statically you end up with a 1.5GB exe and you sacrifice some functionality like plug-ins. So it's not really worth it unless you don't want to distribute the dlls. But yeah, you could try Henrik's suggestion and also exclude Webkit which is probably the biggest chunk of code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top