Results 1 to 12 of 12

Thread: Optimize Qt Library

  1. #1
    Join Date
    Jul 2006
    Posts
    16
    Thanks
    4
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Question Optimize Qt Library

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Optimize Qt Library

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

  3. #3
    Join Date
    Jul 2006
    Posts
    16
    Thanks
    4
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Exclamation Re: Optimize Qt Library

    Dear Wysota,

    Thanks for the Reply..

    Quote Originally Posted by wysota View Post
    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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Optimize Qt Library

    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.

  5. #5
    Join Date
    Jul 2006
    Posts
    16
    Thanks
    4
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Smile Re: Optimize Qt Library

    Dear Wysota,

    Thanks for the Suggestion.

    Quote Originally Posted by wysota View Post
    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 !!!!
    and I had several problems regarding the dependencies in #define QT_NO_..... in qconfig.h




    Thanks again,
    Svaths

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Optimize Qt Library

    What switches did you try?

  7. #7
    Join Date
    Jul 2006
    Posts
    16
    Thanks
    4
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Lightbulb Re: Optimize Qt Library

    Hi,

    Quote Originally Posted by wysota View Post
    What switches did you try?
    These are the Configure switches I tried:

    Qt Code:
    1. ./configure -shared -fast -no-exceptions -embedded arm -depths 16
    2. -qvfb -release -disable-network -disable-opengl -disable-xml -disable-sql
    3. -no-nis -no-pch -no-stl -no-ipv6 -no-thread -no-cups -no-gif -qt-gfx-qvfb
    4. -no-gfx-mach64 -no-gfx-matrox -no-gfx-shadowfb -no-gfx-snap -no-gfx-transformed
    5. -no-gfx-vga16 -no-gfx-vnc -no-gfx-voodoo -no-kbd-s15000 -no-kbd-usb
    6. -no-kbd-yopy -qt-kbd-tty -no-mouse-vr41xx -no-mouse-pc -no-mouse-bus
    7. -no-mouse-yopy -no-mouse-linuxtp
    To copy to clipboard, switch view to plain text mode 

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


    Thanks again,
    Regards,
    Svaths

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Optimize Qt Library

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

  9. The following user says thank you to wysota for this useful post:

    Svaths (12th July 2007)

  10. #9
    Join Date
    Jul 2006
    Posts
    16
    Thanks
    4
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Post Re: Optimize Qt Library

    Hi,

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

    Quote Originally Posted by wysota View Post
    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

  11. #10
    Join Date
    Jul 2007
    Posts
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Optimize Qt Library

    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

  12. The following user says thank you to gary_qt for this useful post:

    Svaths (12th July 2007)

  13. #11
    Join Date
    Jul 2006
    Posts
    16
    Thanks
    4
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Thumbs up Re: Optimize Qt Library

    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....

    Qt Code:
    1. ./configure -release -platform qws/linux-x86-g++ -xplatform qws/linux-arm-g++
    2. -embedded arm -no-exceptions -no-cups -depths 16 -qt-gfx-transformed -shared
    3. -no-gif -no-thread -no-nis -no-cups -no-stl -no-ipv6 -disable-dialogs
    4. -disable-iconview -disable-workspace -disable-network -disable-canvas -disable-table
    5. -disable-xml -disable-opengl -disable-sql -no-sql-mysql -no-sql-odbc -no-sql-psql
    6. -no-sql-sqlite -no-gfx-vnc -no-gfx-vodoo -no-kbd-sl50000 -no-kbd-usb -no-kbd-yopy
    7. -no-kbd-vr41xx -no-mouse-ps -no-mouse-bus -no-mouse-linuxtp -no-mouse-yopy
    8. -no-mouse-vr41xx -no-imgfmt-jpeg -no-imgfmt-mng -no-gfx-qvfb -no-gfx-mach64
    9. -no-gfx-matrox -no-gfx-shadowfb -no-gfx-snap -no-gfx-vga16 -no-style-cde
    10. -no-style-compact -no-style-motif -no-style-motifplus -no-style-sgi -qt-style-windows
    11. -no-sql-ibase -no-pch -qconfig ydkim
    To copy to clipboard, switch view to plain text mode 


    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.

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

    Regards,
    Svaths

  14. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Optimize Qt Library

    Could it be that this large size is caused by the compiler? You could compare compiler versions and for instance glibc sizes.

Similar Threads

  1. Wrap a static QT library inside an XPCOM component ?
    By Paul_Xul in forum Qt Programming
    Replies: 2
    Last Post: 3rd August 2010, 07:16
  2. Replies: 4
    Last Post: 18th December 2009, 18:55
  3. Replies: 1
    Last Post: 5th March 2007, 20:50
  4. MinGW Windows Library Search Path
    By zztop in forum Qt Programming
    Replies: 4
    Last Post: 26th March 2006, 15:18
  5. use interesting QWT Library with QT3.X
    By raphaelf in forum Qwt
    Replies: 2
    Last Post: 23rd January 2006, 11:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.