How to reduce Qt Application Binary size ?
-
wrote on 11 May 2011, 09:10 last edited by
Hi All,
I have compiled Qt for Embedded Linux platform statically.
I have also used qconfig to remove some of the functionality to reduce the size of the Qt Binary.
But i haven't gain much size difference between above changes.
Currently my Qt Application size id ~8MB after the some changes i got ~214KB size reduction BUT is there any way i can reduce the size my Qt Application to ~5MB ? Any change in configure command ? I have given following configuration command for embedded linux./home/Qt_lib_optimization/QTOMAP_Optimize/Source/qt-everywhere-commercial-src-4.6.0/configure -prefix /home/Qt_lib_optimization/QTOMAP_Optimize/Install -embedded arm -static -depths 24 -qt-kbd-linuxinput -no-largefile -stl -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-sqlite_symbian -no-sql-tds -no-qt3support -no-phonon -no-webkit -no-gif -no-libtiff -no-libmng -qt-libpng -qt-libjpeg -no-dbus -no-nis -no-openssl -no-scripttools -no-javascript-jit -no-mmx -no-3dnow -no-sse -no-sse2 -little-endian -v -xplatform qws/linux-arm-g++ -host-little-endian -nomake examples -nomake demos -nomake docs -nomake translations -no-xrender -no-xrandr -no-xfixes -no-xcursor -no-nas-sound -no-opengl -no-openvg -no-sm -no-xshape -no-xinerama -no-javascript-jit -no-multimedia -qconfig 10May2011
Give me some idea to reduce the size of my Qt Application.
How can i achieve size reduction ?Thanks,
Neel -
wrote on 11 May 2011, 09:14 last edited by
Maybe there's a linker option that makes sure only code that is actually used is included. Else you will have to remove everything and add certain components until your application can be built again.
-
wrote on 11 May 2011, 09:25 last edited by
which linker option to set ?...
Another way to reduce the size ? -
wrote on 11 May 2011, 09:34 last edited by
[quote author="neel2818" date="1305105920"]which linker option to set ?...[/quote]Don't know about that.
-
wrote on 11 May 2011, 10:00 last edited by
There is also the choice to compress the binary. Look at "upx":http://upx.sourceforge.net/ , it could be available also in linux repositories
-
wrote on 11 May 2011, 13:09 last edited by
Some time ago I heard about that compiler option: gcc has the ability to search for functions that call other functions that... (etc), but skipping those other included in the same file but never called.
I remember finding this option in man gcc, and being unable to finally use it... Maybe the links below offer some help.
http://stackoverflow.com/questions/270984/g-partial-linking-instead-of-archives
http://newsgroups.derkeiler.com/Archive/Comp/comp.compilers/2005-07/msg00131.html
(...) something along the lines ld -Ur -o mylib.o [components] (...)
--
-
wrote on 11 May 2011, 13:23 last edited by
"Building Qt Static (and Dynamic) and Making it Small with GCC, Microsoft Visual Studio, and the Intel Compiler":http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler/
-
wrote on 11 May 2011, 15:02 last edited by
If you want to use static builds, make sure you use the correct license options.
Afaik (I'm not a lawyer!) you have to have a commercial license or your software must be GPL to use static linking. -
wrote on 11 May 2011, 15:53 last edited by
IANAL either, but AFAIK, as long as you provide the option to re-link against another version of the library, you are allowed to use static linking using the LGPL Qt libraries. And no, that is probably not too easy to do, but I think Gerolf's comment is incorrect.
1/9