[Qt-interest] LGPL and static linking
Stefan Josefsson
stefan.josefsson at vsmgroup.com
Thu Nov 26 07:44:10 CET 2009
Hi Frank and all others that has been trying to give me an answer so far!
I have spent many days in trying to configure Qt and also to find the
right compiler switches to use. I end up with a statically linked exe file
that is 16 MB. I have then:
- Used qconfig to strip away things that I do not need.
- Used compiler optimization.
- Compiled so that unused code is not included in the exe file (btw, this
is only possible when linking statically which is one of the reasons of
why statical linking is preferable).
- Stripped the binary.
The statically linked application starts in less than a second on my
target while the corresponding dynamically linked application needs about
10 seconds. One way to improve the startup time for the dynamically linked
application would probably be to use "prelinking", but then again there
may be some issues with the LGPL license as a prelinker makes it
impossible to exchange the shared library.
Thanks,
Stefan
On Linux there's a great tool called chrpath, which lets you
edit the rpath and runpath of your binary (check out the Debian package
repros), which lets you safely forget about LD_LIBRARY_PATH.
(I'm telling everybody who whines about dynamic linking;)
Secondly I can't buy that you have issues with load times of dynamic Qt
libs. If taking the configure flags carefully when building Qt it will
pop up like nothing, even if loaded dynamically from a cheap flash.
ld performance bugs have been fixed years ago!
Currently my Qt 4.5.2 is at 20 MB for QtCore + QtGui and it starts
in about a second or less (can't tell) on a class 6 SD card.
Maybe there is a problem with call indirection when using DSO's instead
of static linking. For me there is about a 30% performance gain
if linking my own libs statically and nobody keeps me from doing so,
even if Qt is linked dynamically.
Cheers,
Frank.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091126/443d35b8/attachment.html
More information about the Qt-interest-old
mailing list