Results 1 to 4 of 4

Thread: Reducing deployment size

  1. #1
    Join Date
    Mar 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Reducing deployment size

    Hi,

    I compiled the tutorial t1 - hello world.
    When I would deploy it on Windows, it would be with QtCore4.dll & QtGui4.dll which take more than 10MB.

    I tried static linking, and I got executable of 8.5MB. Is there a way when I link to take from the library just the necessary objects, or create a more efficient library with obj for each function?

    Thanks.

  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: Reducing deployment size

    First of all make sure you compile in release mode. (on Linux you can user "strip" to remove some unneeded data). Then if you still want to reduce the size, use a binary packer such as a tool called UPX. If you still want to reduce the size of the application, you'll have to strip down Qt libraries by recompiling Qt with proper macros defined.

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

    alecs1 (11th March 2008)

  4. #3
    Join Date
    Jul 2006
    Posts
    20
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Reducing deployment size

    Do you have a link to a more in depth discussion on this interesting topic?
    I mention that my knowledge on packaging is almost inexistent, and I ask the following question:

    Isn't it posible that a statically built application to only include the functions it uses?

    When a program only uses, for example, QPushButton and the absolutely necesary classes for a GUI program, only the code for these Qt classes to be included in the executable? I guess that would require a new compilation of these needed Qt classes, but maybe the executable would be so much smaller.

  5. #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: Reducing deployment size

    Quote Originally Posted by alecs1 View Post
    Do you have a link to a more in depth discussion on this interesting topic?
    There should be something in the docs... let me see....

    http://doc.trolltech.com/qq/qq10-win...eployment.html
    http://doc.trolltech.com/latest/deployment.html
    http://doc.trolltech.com/4.3/qtopiacore-features.html (this is about Qtopia, but it's the same for desktop editions too)


    Isn't it posible that a statically built application to only include the functions it uses?
    It's like that by default. Unfortunately Qt is very complex and many things depend on many other things (even if you don't need them)

    When a program only uses, for example, QPushButton and the absolutely necesary classes for a GUI program, only the code for these Qt classes to be included in the executable?
    Unfortunately QPushButton depends on QAbstractButton, they depend on drag&drop functioanlity, etc.

    I guess that would require a new compilation of these needed Qt classes, but maybe the executable would be so much smaller.
    Yes, that's possible. That's what I was describing at the end of my previous post and that's what the last link from the ones above describe.

Similar Threads

  1. QLabel size policy
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2007, 17:57
  2. Simple custom widget won't size properly
    By MrGarbage in forum Qt Tools
    Replies: 2
    Last Post: 9th August 2007, 13:12
  3. Font size calculation when painting in a QImage
    By Ishark in forum Qt Programming
    Replies: 3
    Last Post: 15th July 2007, 22:22
  4. Replies: 1
    Last Post: 24th October 2006, 16:40
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

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.