Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Let's build small Qt libraries! (Step 2: Optimize build-settings)
Forum Updated to NodeBB v4.3 + New Features

Let's build small Qt libraries! (Step 2: Optimize build-settings)

Scheduled Pinned Locked Moved Installation and Deployment
36 Posts 6 Posters 25.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Peppy
    wrote on 17 May 2011, 18:14 last edited by
    #21

    But they were designed about 20 years before, and probably they will change...

    But back to the topic, I don't remember what it was...

    I think: http://wiki.wxwidgets.org/Reducing_Executable_Size (--strip-all)

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Hedge
      wrote on 17 May 2011, 18:22 last edited by
      #22

      Thanks for clarifying that CFLAGS-thing. I'm currently writing my BA so I've got time to try some configurations (and also the MSVC-compiler).

      I'll post the details here.

      However I've a problem atm ...size-wise.
      My application, although build in release-mode asks for the debug-DLLs as well (QtGui4d.dll etc.) when I try to execute it on another PC. Any ideas what would could've gone wrong?
      The executables size is much smaller than in debug-mode (400kb vs. 2.4MB).

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Peppy
        wrote on 17 May 2011, 18:25 last edited by
        #23

        Yes, executable is much more smaller than DLLs (who knows why?)...

        Why that happens? Good question... Please make new thread, it's new question, and it'll going to off topic...

        1 Reply Last reply
        0
        • H Offline
          H Offline
          Hedge
          wrote on 17 May 2011, 18:31 last edited by
          #24

          There's already a thread "here":here http://developer.qt.nokia.com/forums/viewthread/6033/ regarding that question but no one had a good idea yet.
          I threw it in b/c it didn't seem to be too off-topic (it's influencing the application-size in a very bad way).

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Peppy
            wrote on 17 May 2011, 18:39 last edited by
            #25

            Yes, but this topic is named as "Minimizing sizes of DLLs" not as "Issue with DLLs" ;) That's just detial, but that I've learnt on other board as moderator (just my habit :-D)

            Yes, it's quite strange...

            1 Reply Last reply
            0
            • D Offline
              D Offline
              deni-herdiman
              wrote on 17 May 2011, 20:15 last edited by
              #26

              [quote author="Hedge" date="1305656526"]
              However I've a problem atm ...size-wise.
              My application, although build in release-mode asks for the debug-DLLs as well (QtGui4d.dll etc.) when I try to execute it on another PC. Any ideas what would could've gone wrong?
              The executables size is much smaller than in debug-mode (400kb vs. 2.4MB).
              [/quote]
              if you're using UPX....
              try delete pagefile.sys of your compiler's pc, than run your apps than something going haven...
              sadly crash in previous trial... :(

              1 Reply Last reply
              0
              • H Offline
                H Offline
                Hedge
                wrote on 17 May 2011, 20:16 last edited by
                #27

                The problem was another dll build in debug-mode. Peppy found the solution in the thread mentioned above.

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  Hedge
                  wrote on 18 May 2011, 10:45 last edited by
                  #28

                  I've got some results to show off.

                  I can't run configure with the Microsoft-compiler ("Your text to link here...":http://developer.qt.nokia.com/forums/viewthread/6060/).

                  For now I built Qt with the following configure-options:

                  @Configure -L -release -platform win32-g++ -opensource -no-exceptions -no-stl -no-opengl -no-openvg -no-libjpeg -no-libtiff -no-dsp -no-vcproj -no-webkit -no-scripttools -no-native-gestures -qconfig ali@

                  I checked off as much stuff as possible in my custom config-file but especially didn't know which GUI-components I could remove (I use the qml-desktop-components).

                  The result is a lower size of around 1MB (6,51MB compared to 7,55MB before)

                  @default size | self-compiled(gcc) | UPX -9 | Name

                    2,43MB        |      2,04MB        |    0,80MB    | QTCore4.dll
                    2,92MB        |      2,23MB        |    0,67MB    | QTDeclarative4.dll
                    9,39MB        |      7,75MB        |    3,19MB    | QtGui4.dll
                    1,15MB        |      0,77MB        |    0,28MB    | QTNetwork4.dll
                    2,07MB        |      1,74MB        |    0,55MB    | QTScript4.dll
                    0,20MB        |      0,20MB        |    0,08MB    | QTSql4.dll
                    3,82MB        |      3,82MB        |    0,94MB    | QTXmlPatterns4.dll (wasn't compiled)
                  

                   21,98MB              18,55MB             6,51MB@
                  

                  These were the old results:

                  @Uncompressed size | UPX -9 size | Name

                    2,43MB          |    0,91MB    | QTCore4.dll
                    2,92MB          |    0,86MB    | QTDeclarative4.dll
                    9,39MB          |    3,69MB    | QtGui4.dll
                    1,15MB          |    0,40MB    | QTNetwork4.dll
                    2,07MB          |    0,65MB    | QTScript4.dll
                    0,20MB          |    0,10MB    | QTSql4.dll
                    3,82MB          |    0,94MB    | QTXmlPatterns4.dll
                  

                   21,98MB              7,55MB@
                  
                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    Peppy
                    wrote on 18 May 2011, 11:13 last edited by
                    #29

                    From 22MB to 6,5MB is quite good ;-) ... Do you have any start-up "speed" test? Is it slower/faster ?

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      Hedge
                      wrote on 18 May 2011, 11:14 last edited by
                      #30

                      No, my application doesn't work standalone right now in release-mode because of the problem mentioned in another thread.

                      1 Reply Last reply
                      0
                      • H Offline
                        H Offline
                        Hedge
                        wrote on 18 May 2011, 14:50 last edited by
                        #31

                        Now I've compiled using MSVC2010 and excluding just a bit stuff (-no-stl, -no-exceptions etc).

                        These are the new results:

                        The result is a lower size of around 0,71 MB compared to the GCC-built libraries.

                        I'm trying to compile with exceptions now so I can get XMLPatterns built.

                        @default size | self-compiled(MSVC)| UPX -9 | Name

                          2,43MB        |      1,85MB        |    0,82MB    | QTCore4.dll
                          2,92MB        |      1,71MB        |    0,58MB    | QTDeclarative4.dll
                          9,39MB        |      6,57MB        |    3,02MB    | QtGui4.dll
                          1,15MB        |      0,59MB        |    0,24MB    | QTNetwork4.dll
                          2,07MB        |      1,05MB        |    0,37MB    | QTScript4.dll
                          0,20MB        |      0,13MB        |    0,07MB    | QTSql4.dll
                          3,82MB        |      2,52MB        |    0,60MB    | QTXmlPatterns4.dll
                        

                         21,98MB              14,32MB             5,70MB@
                        

                        These were the old results:

                        @Uncompressed size | UPX -9 size | Name

                          2,43MB          |    0,91MB    | QTCore4.dll
                          2,92MB          |    0,86MB    | QTDeclarative4.dll
                          9,39MB          |    3,69MB    | QtGui4.dll
                          1,15MB          |    0,40MB    | QTNetwork4.dll
                          2,07MB          |    0,65MB    | QTScript4.dll
                          0,20MB          |    0,10MB    | QTSql4.dll
                          3,82MB          |    0,94MB    | QTXmlPatterns4.dll
                        

                         21,98MB              7,55MB@
                        
                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SteveKing
                          wrote on 18 May 2011, 15:11 last edited by
                          #32

                          Hi,

                          I'm using Qt on WinCE 5, and using qconfig to rip out all of the QWidgets that I don't use, and compiling for optimize for size rather than speed I've managed to get QtGui down to between 5 and 6MB depending on the platform.

                          I've also remove QtSql and QtSvg support from QtDeclarative (as I don't use them) and that means another couple of hundred K that's saved. These changes are very minor code changes to the library.

                          Steve

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            andre
                            wrote on 18 May 2011, 15:39 last edited by
                            #33

                            Actually, I think some (groups of) widgets can be left out, by using the right #defines. In qabstractitemview.h, line 56, for instance, there is a conditional compilation like this:
                            @
                            #ifndef QT_NO_ITEMVIEWS
                            @

                            Another example is for XML (xmlstream.h, line 47):
                            @
                            #ifndef QT_NO_XMLSTREAM
                            @

                            I think that many Qt features can be compiled out this way, thus reducing the size of the Qt libraries.

                            1 Reply Last reply
                            0
                            • H Offline
                              H Offline
                              Hedge
                              wrote on 18 May 2011, 15:48 last edited by
                              #34

                              @SteveKing, could you upload your qconfig somewhere? The example-ones distributed with Qt don't work at all and I couldn't get my own to compile past QtDeclarative.

                              I'm also intersted in the changes you made to leave out QtSql and QtSvg in QtDeclarative.

                              @Andre: That's the purpose of qconfig.
                              It adds define QT_NO_WHATEVER statements, but I found it difficulty to find a fully compiling configuration.

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                SteveKing
                                wrote on 19 May 2011, 09:50 last edited by
                                #35

                                @Hedge. Our "company website":http://www.domino-printing.com/Global/en/QuickStepQTFiles/QuickStepQTFiles.aspx has all of the Qt files we're using on it. The things you'll be interested in are:

                                4.7.2 Changed Files: This zip has the source I modified in Qt Declarative to remove the Sql support and the configuration files. It also includes a change to the Pixmap cache class to allow us to define the cache size.

                                4.7.2 Configuration Batch Files: This has the mkspecs for our WinCE platforms and also the configure batch files we use. Some of the configure options I've used don't do anything (-nomake), but I threw everything at it and haven't tidied them up yet!

                                The qconfig-QML.h is the minimum config for our WinCE application. _QML-http-html _and _QML-IC _are variations on this adding in some extra features as required. _QML-PC _is the minimum config I managed for a PC build, although even with this I hit problems building the active Qt components. I tried to fix this by modifying .pro files etc, but got nowhere and everything I use has been built by then so I stopped. The main reason the _qconfig-QML _didn't work with the PC build was because of all the tools that build with it, again I didn't investigate how to disable these.

                                If you find any of this useful and need to ask any more questions feel free to mail me.

                                Steve

                                1 Reply Last reply
                                0
                                • H Offline
                                  H Offline
                                  Hedge
                                  wrote on 19 May 2011, 09:55 last edited by
                                  #36

                                  Thanks for putting them up.
                                  I'll try them as soon as I find the time to.

                                  EDIT: I couldn't compile them. I think I'm out for now as Volker is right. It's eating plenty of time.

                                  1 Reply Last reply
                                  0

                                  21/36

                                  17 May 2011, 18:14

                                  • Login

                                  • Login or register to search.
                                  21 out of 36
                                  • First post
                                    21/36
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved