Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to reduce the size of the program?
QtWS25 Last Chance

How to reduce the size of the program?

Scheduled Pinned Locked Moved General and Desktop
9 Posts 6 Posters 5.2k Views
  • 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.
  • D Offline
    D Offline
    De_Broglie
    wrote on last edited by
    #1

    I have a small program, but to run it on another computer, you must send it with 80 mb of libraries(*.dll). I'm sure that I do not use them all. How do I reduce their quantity, well, or at least merge them with the *.exe?
    Thank you.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      welcome to devnet

      In order to find out which dll is required you can use on windows dependency walker.
      You find some "details here":http://qt-project.org/wiki/Show_library_dependencies#aea23489ce3aa9b6406ebb28e0cda430

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qxoz
        wrote on last edited by
        #3

        Hi!
        Can you give more info about how you build it, and which dlls do you send. Probably you build it in debug mode?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MuldeR
          wrote on last edited by
          #4

          You may also apply an "EXE Packer" such as the widely-used UPX:
          http://upx.sourceforge.net/

          Though, if you distribute your files in a compressed archive with a good compressor (e.g. 7-Zip) anyway, this won't make much of a difference, except that the un-archived program will take less space on the HDD.

          --

          Anyway, definitely use Dependency Walker to see what DLL's your program actually depends on:
          http://www.dependencywalker.com/

          Then kick out all DLL's that your program doesn't use. But make sure you use the "profiling" feature of Dependency Walker on your program, because only this way Plug-in DLL's can be picked up...

          --

          Last but not least, if possible License-wise, you can build your application with the static Qt libraries, which can further reduce the overall size, compared to using Qt as separate DLL's. Of course only if you have a single EXE file. As soon as you have several EXE files, using Qt as shared DLL's is more space efficient.

          My OpenSource software at: http://muldersoft.com/

          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

          Go visit the coop: http://youtu.be/Jay...

          1 Reply Last reply
          0
          • U Offline
            U Offline
            utcenter
            wrote on last edited by
            #5

            Keep in mind dependency walker doesn't catch all the dependencies - only compile time, Qt applications will still load and resolve dlls dynamically, and if those are missing, you won't get not error no notice, just an application that does not run when started.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MuldeR
              wrote on last edited by
              #6

              [quote author="utcenter" date="1365979267"]Keep in mind dependency walker doesn't catch all the dependencies - only compile time, Qt applications will still load and resolve dlls dynamically, and if those are missing, you won't get not error no notice, just an application that does not run when started.[/quote]

              It does catch all DLL's, if you use the "Profiling" feature. That's why I suggested using it. Nonetheless not all Plug-in DLL's that Qt will find and load at run-time will absolute be necessary. For example, Qt will load all image format plug-in's it finds. But if you don't need some image formats, your program will work just fine without the corresponding extra plug-in DLL's. You won't get around deciding which plug-in's you need manually.

              My OpenSource software at: http://muldersoft.com/

              Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

              Go visit the coop: http://youtu.be/Jay...

              1 Reply Last reply
              0
              • P Offline
                P Offline
                parcpaes
                wrote on last edited by
                #7

                the files dll of qt are in (QtSDK\Desktop\Qt\4.7.4\mingw\bin) main dll

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  De_Broglie
                  wrote on last edited by
                  #8

                  Unfortunately Dependency Walker began to show some strange library, so I had to copy all the libraries and removing some of them to find out which ones are needed for the program.
                  But now the total size of DLL 36,2 mb, and now the size is not a problem. Is it worth try to merge all dll and exe to exe?

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    MuldeR
                    wrote on last edited by
                    #9

                    [quote author="De_Broglie" date="1366026134"]Unfortunately Dependency Walker began to show some strange library, so I had to copy all the libraries and removing some of them to find out which ones are needed for the program.[/quote]

                    Not quite sure what you mean. Can you share a screenshort?

                    (BTW: I would recommend to configure Dependency Walker to show full paths)

                    [quote author="De_Broglie" date="1366026134"]But now the total size of DLL 36,2 mb, and now the size is not a problem. Is it worth try to merge all dll and exe to exe?[/quote]

                    If with that you mean "static linking", yes, it's definitely worth a try, if your application is a single EXE and if your license allows for static linking. If the Qt libraries are linked statically, the Linker can optimized (throw out) all the functions and/or classes that are never referenced in your program. And as Qt is a rather big (feature-rich) framework, chances are good your program only needs a small subset of it. With DLL's that's not possible. When building Qt as DLL's, you always get a complete Qt, as the Linker cannot know which functions the program is going to call. It cannot optimize out anything (except maybe for some code that is unreachable/dead anyway).

                    My OpenSource software at: http://muldersoft.com/

                    Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

                    Go visit the coop: http://youtu.be/Jay...

                    1 Reply Last reply
                    0

                    • Login

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