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. Static build - size of exe too big
QtWS25 Last Chance

Static build - size of exe too big

Scheduled Pinned Locked Moved Unsolved General and Desktop
static buildsizeexe
11 Posts 4 Posters 7.1k 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.
  • christos.alewaC Offline
    christos.alewaC Offline
    christos.alewa
    wrote on last edited by
    #1

    Hi,

    we are statically building our executables since we mainly want to use the uniform GUI.
    Problem is though that the executable is way too big (approx. 15MB), compared to the actual program (~ 1MB) we want to run.
    Is there any way to reduce the size of the .exe files, essentially loading only those components which are necessary for the GUI to be displayed correctly?

    Many thanks and best regards,
    Christos

    kshegunovK 1 Reply Last reply
    0
    • christos.alewaC christos.alewa

      Hi,

      we are statically building our executables since we mainly want to use the uniform GUI.
      Problem is though that the executable is way too big (approx. 15MB), compared to the actual program (~ 1MB) we want to run.
      Is there any way to reduce the size of the .exe files, essentially loading only those components which are necessary for the GUI to be displayed correctly?

      Many thanks and best regards,
      Christos

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @christos.alewa
      Hello,

      we are statically building our executables since we mainly want to use the uniform GUI.

      This doesn't constitute a great reasoning for static building in my opinion. Are you sure static linking is what you want (or need)?

      Is there any way to reduce the size of the .exe files, essentially loading only those components which are necessary for the GUI to be displayed correctly?

      My best advice for that question would be - you could build and link dynamically instead of static.
      The second best - strip all symbols and resources from the executable.

      If you provide a bit more on your use case it might attract some better answers.

      Kind regards.

      Read and abide by the Qt Code of Conduct

      christos.alewaC 1 Reply Last reply
      3
      • kshegunovK kshegunov

        @christos.alewa
        Hello,

        we are statically building our executables since we mainly want to use the uniform GUI.

        This doesn't constitute a great reasoning for static building in my opinion. Are you sure static linking is what you want (or need)?

        Is there any way to reduce the size of the .exe files, essentially loading only those components which are necessary for the GUI to be displayed correctly?

        My best advice for that question would be - you could build and link dynamically instead of static.
        The second best - strip all symbols and resources from the executable.

        If you provide a bit more on your use case it might attract some better answers.

        Kind regards.

        christos.alewaC Offline
        christos.alewaC Offline
        christos.alewa
        wrote on last edited by
        #3

        @kshegunov
        Hi and thanks for your quick answer.

        Since we want to start the GUI over the web, it would be much more helpful if it was just one, small, statically linked, file.
        That would be executed - provide the GUI - and then, if necessary, start & download our tool.
        To your second advice, that is probably the true answer i was looking for, but how can i strip all symbols and resources from the executable?

        Thanks again.

        kshegunovK 1 Reply Last reply
        0
        • christos.alewaC christos.alewa

          @kshegunov
          Hi and thanks for your quick answer.

          Since we want to start the GUI over the web, it would be much more helpful if it was just one, small, statically linked, file.
          That would be executed - provide the GUI - and then, if necessary, start & download our tool.
          To your second advice, that is probably the true answer i was looking for, but how can i strip all symbols and resources from the executable?

          Thanks again.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by kshegunov
          #4

          @christos.alewa

          Hello,
          Here's a way to do it with g++, but note that this is platform-dependent, so I have no idea if it's even possible with MS's compiler or on OSX.
          As a side note 15MB is a bit big for a release build, even with static linking. What Qt modules do you include in that? If possible strip out as much as you can in terms of libraries and code.

          Kind regards.

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          1
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            Out of curiosity, what do you mean by "start the GUI over the web" ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            christos.alewaC 1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              Out of curiosity, what do you mean by "start the GUI over the web" ?

              christos.alewaC Offline
              christos.alewaC Offline
              christos.alewa
              wrote on last edited by
              #6

              @SGaist
              Essentially, download the executable and run it.
              That's why size is an issue.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                What modules are you using for your application ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                christos.alewaC 1 Reply Last reply
                0
                • SGaistS SGaist

                  What modules are you using for your application ?

                  christos.alewaC Offline
                  christos.alewaC Offline
                  christos.alewa
                  wrote on last edited by
                  #8

                  @SGaist
                  QCore, QGUI & QWidget..

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    From the server side you should send your files as compressed data.

                    On the Qt side, since you are building Qt yourself anyway, you can try disabling features your application don't need. See the qfeatures.txt file for what you can disable.

                    On a side note, don't forget the licensing constraints that comes with a static build of Qt.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    christos.alewaC 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      From the server side you should send your files as compressed data.

                      On the Qt side, since you are building Qt yourself anyway, you can try disabling features your application don't need. See the qfeatures.txt file for what you can disable.

                      On a side note, don't forget the licensing constraints that comes with a static build of Qt.

                      christos.alewaC Offline
                      christos.alewaC Offline
                      christos.alewa
                      wrote on last edited by
                      #10

                      @SGaist
                      It seems that it is indeed, already optimized, since we did disable many features, until it could not be build anymore - but we're still facing the same sized executable.

                      Thank you, though, maybe we'll figure it out eventually.

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        thEClaw
                        wrote on last edited by
                        #11

                        You could certainly make use of UPX, it should get the filesize down to maybe 4MB (by using compression).

                        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