[Qt-interest] LGPL and static linking

Frank Mertens frank at cyblogic.de
Thu Nov 26 12:17:13 CET 2009


Stefan Josefsson wrote:
> 
> 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.
> 

I'm currently at 18 MB on Linux without ever thinking much about
optimizing the package size (dynamically linked, x86) and I'm shipping
more than just Qt...

My configure flags for Qt 4.5.2 (maybe some accidental magic in here?):

clear
printf "o\nyes\n" | \
./configure \
  -release \
  -fast \
  -prefix $PWD \
  -optimized-qmake \
  -no-pch \
  -no-phonon \
  -no-qt3support \
  -no-stl \
  -no-xmlpatterns \
  -no-scripttools \
  -make 'libs tools docs' \
&& make

BTW I'm using cmake for building my apps.



More information about the Qt-interest-old mailing list