Answer the question
In order to leave comments, you need to log in
Maximum weight reduction of Qt's libraries
In general, I am writing a small online installer for the Windows version of one of my projects. I have no experience with the GUI under windows, so I chose Qt to abstract from all these WinAPI / Com intricacies. And everything seems to be fine, but I'm confused by the size of the resulting binary. With all the necessary linked Qt's libraries, it weighs 15 mb., if dynamically linked - 200 kb. I compiled Qt with the following flags:
configure -release -static -no-accessibility -opensource -no-sql-sqlite -no-qt3support -no-opengl -no-openvg -no-libmng -no-libtiff -no-libjpeg -no-dsp -no-vcproj -openssl-linked -no-dbus -no-phonon -no-phonon-backend -no-multimedia -no-audio-backend -no-webkit -no-script -no-scripttools -no-declarative -no-declarative-debug
when compiling, I used the -Os flag. Is there any other way to reduce the size of the libraries?
Answer the question
In order to leave comments, you need to log in
You've turned almost everything off.
Look at how much the libraries you specifically use (release assemblies qtcore, qtgui, ...) weigh separately - their sum will be your minimum.
Less can be achieved only if you manually throw out the unused parts of qtgui and rebuild them yourself, but I doubt that this is my time spent on this - there are quite a lot of interesting dependencies
PS -no-qt3support in reality discards only a separate library with classes no longer used, but for classes whose names have been preserved since Qt3, such as QString, the code remains in place and is only hidden in the header file via #ifdef QT3_SUPPORT
ZZY there is still #ifndef QT_NO_REGEXP, pulled through QtCore/qregexp.h, maybe there is a key for it too, I can’t say more precisely, because I don't have qt-devel and documentation right now.
Archive the content - that's the only way. Qt libraries like QtGui are heavyweights. Zip it with some lzma and unzip it at startup and run it.
In general, what do you have there at 15 meters? ~9 meters Qt GUI. What else? I have a full-fledged program with Qt Quick weighs 17.5. When creating msi, it turns out 7.5, despite the fact that msi does not use the best archiving algorithm
It is also advised to disable exceptions
and compress the code with UPX 'om.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question