PDA

View Full Version : Optimize Qt Library



Svaths
3rd July 2007, 06:09
Hi All,

I use Qt 3.3 on an Embedded device. As always with such devices, I want to optimize Qt library which I am trying to dynamically link to my application.

I tried to add more "#define" s in "qconfig.h" but there were lot of interdependencies that were not stopping my application to run.

I need to remove as many unwanted widgets ( without losing the required ones ) and things unneeded to my application like sound, network, sql......

Is there any tool available for Qt 3.3 to qconfig

or

Is there a better way I can optmize Qt library?


Thanks in Advance,
Regards,
Svaths

wysota
3rd July 2007, 10:49
If you want to make optimizations, link statically. Then only those components which are used by your application will be linked into the binary.

Svaths
6th July 2007, 07:04
Dear Wysota,

Thanks for the Reply..


If you want to make optimizations, link statically. Then only those components which are used by your application will be linked into the binary.

I have tried to link the application statically using the option -static in the Configure and making other required changes... but the size of my application has increased drastically... more than my device capabilities :(

Through dynamic linking, cant we decrease the size of libqte.so to a more reachable size??
so that I can have the lib on the device and the application loading time also reduces considerably....

Since the size of my application has increased due to dynamic linking, I am now afraid regarding the loading time too...

Is there a way I can remove unwanted components from QT build ??

Thanks in Advance...

Regards,
Svaths

wysota
6th July 2007, 07:09
You can decrease the size of a dynamic library, but do it using switches passed to configure and remove only this functionality that you don't use. And make sure you build the lib in release mode. At the end strip your binary - this will decrease its size as well.

Svaths
10th July 2007, 05:25
Dear Wysota,

Thanks for the Suggestion.


You can decrease the size of a dynamic library, but do it using switches passed to configure and remove only this functionality that you don't use. And make sure you build the lib in release mode. At the end strip your binary - this will decrease its size as well.

I have done the build in -release mode and stripped the binary. The size is a bit reduced now. Thanks !!

But, Configure switches could not reduce the size much !!!! :confused:
and I had several problems regarding the dependencies in #define QT_NO_..... in qconfig.h




Thanks again,
Svaths

wysota
10th July 2007, 09:04
What switches did you try?

Svaths
10th July 2007, 11:53
Hi,


What switches did you try?

These are the Configure switches I tried:


./configure -shared -fast -no-exceptions -embedded arm -depths 16
-qvfb -release -disable-network -disable-opengl -disable-xml -disable-sql
-no-nis -no-pch -no-stl -no-ipv6 -no-thread -no-cups -no-gif -qt-gfx-qvfb
-no-gfx-mach64 -no-gfx-matrox -no-gfx-shadowfb -no-gfx-snap -no-gfx-transformed
-no-gfx-vga16 -no-gfx-vnc -no-gfx-voodoo -no-kbd-s15000 -no-kbd-usb
-no-kbd-yopy -qt-kbd-tty -no-mouse-vr41xx -no-mouse-pc -no-mouse-bus
-no-mouse-yopy -no-mouse-linuxtp

Please suggest any other that I have missed.... to decrease the size??


Thanks again,
Regards,
Svaths

wysota
10th July 2007, 12:39
What was the difference in size of the library between passing those switches and compiling without them?

Svaths
11th July 2007, 07:03
Hi,

Sorry for not giving the complete info earlier....


What was the difference in size of the library between passing those switches and compiling without them?

libqte.so.3.3.6

Without switches - 11M
Stripped was 8.5M


With switches - 9.0M
Stripped was 7.6M

Thus giving me a benefit of 0.9M after configuring with switches...

Thanks again,
Svaths

gary_qt
11th July 2007, 07:58
Hi ,
I am using the LDS software as cross compiler for generating the libqte.so.3.3.6 library.After strip it comes out to 3.5MB. I configure the qte3.3.3.6 using following configuration.

./configure -release –platform qws/linux-x86-g++ -xplatform qws/linux-arm-g++
-embedded arm -no-cups -depths 16 -qt-gfx-transformed -shared -no-gif -no-thread -no-nis -no-cups -no-stl -no-ipv6 -disable-dialogs -disable-iconview -disable-workspace -disable-network -disable-canvas -disable-table -disable-xml -disable-opengl -disable-sql -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-gfx-vnc -no-gfx-vodoo -no-kbd-sl50000 -no-kbd-usb -no-kbd-yopy -no-kbd-vr41xx -no-mouse-ps -no-mouse-bus -no-mouse-linuxtp -no-mouse-yopy -no-mouse-vr41xx -no-imgfmt-jpeg -no-imgfmt-mng -no-gfx-qvfb -no-gfx-mach64 -no-gfx-matrox -no-gfx-shadowfb -no-gfx-snap -no-gfx-vga16 -no-style-cde -no-style-compact -no-style-motif -no-style-motifplus -no-style-platinum -no-style-sgi -qt-style-windows -no-sql-ibase -no-pch -qconfig ydkim

Svaths
11th July 2007, 11:34
Dear gary_qt,

Thanks for the Switches.

I was missing out the Styles.. perhaps...

But I require "style-platinum" and hence removed "-no-style-platinum" from the switches provided.

These are the switches I used for configure....


./configure -release -platform qws/linux-x86-g++ -xplatform qws/linux-arm-g++
-embedded arm -no-exceptions -no-cups -depths 16 -qt-gfx-transformed -shared
-no-gif -no-thread -no-nis -no-cups -no-stl -no-ipv6 -disable-dialogs
-disable-iconview -disable-workspace -disable-network -disable-canvas -disable-table
-disable-xml -disable-opengl -disable-sql -no-sql-mysql -no-sql-odbc -no-sql-psql
-no-sql-sqlite -no-gfx-vnc -no-gfx-vodoo -no-kbd-sl50000 -no-kbd-usb -no-kbd-yopy
-no-kbd-vr41xx -no-mouse-ps -no-mouse-bus -no-mouse-linuxtp -no-mouse-yopy
-no-mouse-vr41xx -no-imgfmt-jpeg -no-imgfmt-mng -no-gfx-qvfb -no-gfx-mach64
-no-gfx-matrox -no-gfx-shadowfb -no-gfx-snap -no-gfx-vga16 -no-style-cde
-no-style-compact -no-style-motif -no-style-motifplus -no-style-sgi -qt-style-windows
-no-sql-ibase -no-pch -qconfig ydkim


After strip, it turned out to be 6.5 MB. Is it that I am missing out something or is it that "-no-style-platinum" has so much influence on the size.:confused:

This was a remarkable reduction of size..anyway...
Thanks again,

Regards,
Svaths

wysota
15th July 2007, 22:25
Could it be that this large size is caused by the compiler? You could compare compiler versions and for instance glibc sizes.