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.
  • C Offline
    C Offline
    christos.alewa
    wrote on 16 Jun 2016, 12:50 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

    K 1 Reply Last reply 16 Jun 2016, 13:45
    0
    • C christos.alewa
      16 Jun 2016, 12:50

      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

      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 16 Jun 2016, 13:45 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

      C 1 Reply Last reply 16 Jun 2016, 14:06
      3
      • K kshegunov
        16 Jun 2016, 13:45

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

        C Offline
        C Offline
        christos.alewa
        wrote on 16 Jun 2016, 14:06 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.

        K 1 Reply Last reply 16 Jun 2016, 14:11
        0
        • C christos.alewa
          16 Jun 2016, 14:06

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

          K Offline
          K Offline
          kshegunov
          Moderators
          wrote on 16 Jun 2016, 14:11 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
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 16 Jun 2016, 21:59 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

            C 1 Reply Last reply 20 Jun 2016, 11:37
            0
            • S SGaist
              16 Jun 2016, 21:59

              Hi,

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

              C Offline
              C Offline
              christos.alewa
              wrote on 20 Jun 2016, 11:37 last edited by
              #6

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

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 20 Jun 2016, 11:50 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

                C 1 Reply Last reply 20 Jun 2016, 12:20
                0
                • S SGaist
                  20 Jun 2016, 11:50

                  What modules are you using for your application ?

                  C Offline
                  C Offline
                  christos.alewa
                  wrote on 20 Jun 2016, 12:20 last edited by
                  #8

                  @SGaist
                  QCore, QGUI & QWidget..

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 20 Jun 2016, 20:21 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

                    C 1 Reply Last reply 21 Jun 2016, 12:35
                    0
                    • S SGaist
                      20 Jun 2016, 20:21

                      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.

                      C Offline
                      C Offline
                      christos.alewa
                      wrote on 21 Jun 2016, 12:35 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 21 Jun 2016, 13:08 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

                        3/11

                        16 Jun 2016, 14:06

                        topic:navigator.unread, 8
                        • Login

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