Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] Qt 5.0.2 static linked - library size and linking time
i recently build Qt 5.0.2 with static linked libraries. So far, so good...
1st issue: The file size of many build libraries is very huge. I.e. Qt5Quick.lib takes 587 MB of disk space (all Libs in /lib folder together take about 5 GB). Is that "normal"? or is there some way to "strip" the libraries?
(PS: It does only affects the release libs. The debug libs have "normal" size (1/10 size of release libs))
2nd issue: The linking of my applikations takes a lot of time, compared to dynamic linked builds. I guess, it depends on the library sizes. Is that right? Then the linking time should be reduced, if the 1st issue is solved.
Source package: qt-everywhere-opensource-src-5.0.2.zip
configure options: -developer-build -nomake docs examples tests demos webkit -debug-and-release -opensource -confirm-license -opengl desktop -mp -static -platform win32-msvc2008 -ltcg -qt-zlib -qt-libpng -qt-libjpeg
Changes in qtbase/mkspecs/win32-msvc2008/qmake.conf for static build:
old: QMAKE_CFLAGS_RELEASE = -O2 -MD
old: QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi
old: QMAKE_CFLAGS_DEBUG = -Zi -MDd
new: QMAKE_CFLAGS_RELEASE = -O2 -MT
new: QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
new: QMAKE_CFLAGS_DEBUG = -Zi -MTd
I'll try to answer myself:
I left out the -ltcg configure flag. As far as I understand, this flag enables the -GL (whole program optimization) compiler flag in release builds, which increases the lib size dramatically.
Rebuild is currently in progress, but until now build release libs hafe 1/3 the size of the debug libs.
Looks good so far...
Build is done now. Lib sizes are as expected and linking time is as usual.