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. Why does the size of the file grow so much with each release without changing the code?
QtWS25 Last Chance

Why does the size of the file grow so much with each release without changing the code?

Scheduled Pinned Locked Moved Unsolved General and Desktop
54 Posts 9 Posters 8.6k 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 ChrisW67

    @duncan98 I am certain it has nothing to do with Qt Creator. Starting Qt Creator will not change an executable. Creator is not a C++ compiler; it is an editor that can launch a make process to build your executable for you. The compiler and linker are what produce the executable. In your case, this a GCC version. Producing the executable is not connected to running the executable.

    The ways a Windows executable file can grow is:

    • You put more code, or embedded resources, in it.
    • You build a version with debug symbols, which will be a bit larger (but not usually an order of magnitude)
    • You build a version with different compiler optimisation options.
    • You change the compiler; different compilers will produce different sized results.
    • Some external process, that is neither the compiler nor the running executable, opens the file and appends to the executable.

    If you want to support your claimed behaviour with some evidence:

    • Delete your build folder
    • Verify that your target executable (wms.exe) does not exist.
    • Build your application
    • Post the entire content of the Qt Creator compiler output panel (copy and paste the text not a partial screen shot)
    • Execute "dir wms.exe" in the build folder and post the result
    • Delete the executable
    • Build your application
    • Post the entire content of the Qt Creator compiler output panel (copy and paste the text not a partial screen shot). Note that this should not include calls to compile C++ source, only a linker call.
    • Execute "dir wms.exe" in the build folder and post the result
    D Offline
    D Offline
    duncan98
    wrote on last edited by
    #21

    @ChrisW67
    Thank you for your explanation. It should be related to the compiler. But something more strange happened. I uninstalled and reinstalled QT, and now I can't start it 😂

    jsulmJ 1 Reply Last reply
    0
    • D duncan98

      @ChrisW67
      Thank you for your explanation. It should be related to the compiler. But something more strange happened. I uninstalled and reinstalled QT, and now I can't start it 😂

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #22

      @duncan98 You mean you can't start QtCreator? What exactly happens? Any error message?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      D 2 Replies Last reply
      1
      • jsulmJ jsulm

        @duncan98 You mean you can't start QtCreator? What exactly happens? Any error message?

        D Offline
        D Offline
        duncan98
        wrote on last edited by
        #23

        @jsulm
        Creator failed to start without any response

        jsulmJ 1 Reply Last reply
        0
        • D duncan98

          @jsulm
          Creator failed to start without any response

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #24

          @duncan98 Then start it from a terminal to see whether there are any errors/warnings.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • C ChrisW67

            @duncan98 I am certain it has nothing to do with Qt Creator. Starting Qt Creator will not change an executable. Creator is not a C++ compiler; it is an editor that can launch a make process to build your executable for you. The compiler and linker are what produce the executable. In your case, this a GCC version. Producing the executable is not connected to running the executable.

            The ways a Windows executable file can grow is:

            • You put more code, or embedded resources, in it.
            • You build a version with debug symbols, which will be a bit larger (but not usually an order of magnitude)
            • You build a version with different compiler optimisation options.
            • You change the compiler; different compilers will produce different sized results.
            • Some external process, that is neither the compiler nor the running executable, opens the file and appends to the executable.

            If you want to support your claimed behaviour with some evidence:

            • Delete your build folder
            • Verify that your target executable (wms.exe) does not exist.
            • Build your application
            • Post the entire content of the Qt Creator compiler output panel (copy and paste the text not a partial screen shot)
            • Execute "dir wms.exe" in the build folder and post the result
            • Delete the executable
            • Build your application
            • Post the entire content of the Qt Creator compiler output panel (copy and paste the text not a partial screen shot). Note that this should not include calls to compile C++ source, only a linker call.
            • Execute "dir wms.exe" in the build folder and post the result
            D Offline
            D Offline
            duncan98
            wrote on last edited by duncan98
            #25

            @ChrisW67
            dir.jpg

            compiler output

            JonBJ C 2 Replies Last reply
            0
            • D duncan98

              @ChrisW67
              dir.jpg

              compiler output

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #26
              This post is deleted!
              1 Reply Last reply
              0
              • jsulmJ jsulm

                @duncan98 You mean you can't start QtCreator? What exactly happens? Any error message?

                D Offline
                D Offline
                duncan98
                wrote on last edited by
                #27

                @jsulm
                I uninstall qt5.15.2 and install qt5.15.1. It just works

                1 Reply Last reply
                0
                • JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by
                  #28

                  Wow, such a big difference between these two versions. I will check them out on Linux.

                  1 Reply Last reply
                  0
                  • D duncan98

                    @ChrisW67
                    dir.jpg

                    compiler output

                    C Offline
                    C Offline
                    ChrisW67
                    wrote on last edited by
                    #29

                    @duncan98
                    Here is the very first call to a C++ compiler in your output:

                    g++ -c -fno-keep-inline-dllexport -O2 -g -std=gnu++11 ...
                    

                    The option -g tells, "GCC to emit extra information for use by a debugger"
                    https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#Debugging-Options

                    So, while you think you are generating a release build, g++ is embedding debugging information.

                    I am not sure if the bundled MingW ships a strip.exe, but if it does, run it against a copy of mysoft.exe and look at the resulting size.

                    Now the question is, how did that '-g' option get there. This is consistent with a normal debug build.
                    This could be a deliberate action in your project, a stale Makefile, broken Project configuration in Qt Creator.

                    You need to check:

                    • The project configuration in Qt Creator to ensure you have a sane setup. You could delete the Qt Creator *.user file and import the project fresh.
                    • Your PRO file or CMakeLists.txt for manipulations of the CFLAGS/CXXFLAGS.
                    • Absolutely rerun qmake/cmake to regenerate your Makefile (delete it first to ensure it is generating the file you think).

                    You could build the project from clean source outside QtCreator to eliminate that as any cause.

                    D JoeCFDJ 2 Replies Last reply
                    2
                    • C ChrisW67

                      @duncan98
                      Here is the very first call to a C++ compiler in your output:

                      g++ -c -fno-keep-inline-dllexport -O2 -g -std=gnu++11 ...
                      

                      The option -g tells, "GCC to emit extra information for use by a debugger"
                      https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#Debugging-Options

                      So, while you think you are generating a release build, g++ is embedding debugging information.

                      I am not sure if the bundled MingW ships a strip.exe, but if it does, run it against a copy of mysoft.exe and look at the resulting size.

                      Now the question is, how did that '-g' option get there. This is consistent with a normal debug build.
                      This could be a deliberate action in your project, a stale Makefile, broken Project configuration in Qt Creator.

                      You need to check:

                      • The project configuration in Qt Creator to ensure you have a sane setup. You could delete the Qt Creator *.user file and import the project fresh.
                      • Your PRO file or CMakeLists.txt for manipulations of the CFLAGS/CXXFLAGS.
                      • Absolutely rerun qmake/cmake to regenerate your Makefile (delete it first to ensure it is generating the file you think).

                      You could build the project from clean source outside QtCreator to eliminate that as any cause.

                      D Offline
                      D Offline
                      duncan98
                      wrote on last edited by
                      #30

                      @ChrisW67
                      I feel that creator has some obvious non-human bugs, such as making a makefile error for no reason, and the size of the released file is too large

                      C 1 Reply Last reply
                      0
                      • D duncan98

                        @ChrisW67
                        I feel that creator has some obvious non-human bugs, such as making a makefile error for no reason, and the size of the released file is too large

                        C Offline
                        C Offline
                        ChrisW67
                        wrote on last edited by
                        #31

                        @duncan98 Do you actually want to solve the problem? Constantly asserting your feelings that Qt Creator is at fault is not helping anyone.

                        Did you actually do any of the things I suggested?

                        D 1 Reply Last reply
                        1
                        • C ChrisW67

                          @duncan98 Do you actually want to solve the problem? Constantly asserting your feelings that Qt Creator is at fault is not helping anyone.

                          Did you actually do any of the things I suggested?

                          D Offline
                          D Offline
                          duncan98
                          wrote on last edited by
                          #32

                          @ChrisW67
                          I have done the steps you mentioned many times, including rebuild pro.user, clean up, qmake, build

                          1 Reply Last reply
                          0
                          • C Offline
                            C Offline
                            ChrisW67
                            wrote on last edited by
                            #33

                            From here it looks like you are not approaching the problem in a methodical way. Computers are deterministic beasts, same input, same process, same output. You are claiming that building the same source, with the same tool chain, gives a small executable the first time, a larger executable the second, even larger the third etc. This is plainly utterly extraordinary given that the executable is rewritten from scratch every time. With extraordinary claims you need to present extraordinary evidence.

                            The evidence you have presented to date is that your build is misconfigured and, despite looking like a release build is actually including a bunch of debug information. There is a reason for this that I, and others, are trying to help you find. It may be bug in the mkspecs bundled in the particular Qt library you building against (this is not Qt Creator BTW) but this is the last place to look for the fault.

                            Since you have done what I asked:

                            • Please provide the result of the second build from my earlier post and the size of the executable produced by that build (not some other one you stashed away). I expect it will be exactly the same size as the first and establish that the extraordinary claim is false.
                            • Tell me whether the bundled MingW contains a strip.exe and what the result of using it was? I expect the size will shrink to something more reasonable, consistent with the extra size being debug information.
                            • Tell us whether any part of your PRO file, or things it includes, manipulate the QMAKE_*, CFLAG or CXXFLAGS variable, and how. What is in the QT variable set to?

                            Tell us about the "makefile error for no reason." The output you posted earlier looks like a quite normal Makefile was processed and your code generated large numbers of warnings when compiled. Warnings are not without reason and not errors, but they may bite you later.

                            D 1 Reply Last reply
                            3
                            • C ChrisW67

                              From here it looks like you are not approaching the problem in a methodical way. Computers are deterministic beasts, same input, same process, same output. You are claiming that building the same source, with the same tool chain, gives a small executable the first time, a larger executable the second, even larger the third etc. This is plainly utterly extraordinary given that the executable is rewritten from scratch every time. With extraordinary claims you need to present extraordinary evidence.

                              The evidence you have presented to date is that your build is misconfigured and, despite looking like a release build is actually including a bunch of debug information. There is a reason for this that I, and others, are trying to help you find. It may be bug in the mkspecs bundled in the particular Qt library you building against (this is not Qt Creator BTW) but this is the last place to look for the fault.

                              Since you have done what I asked:

                              • Please provide the result of the second build from my earlier post and the size of the executable produced by that build (not some other one you stashed away). I expect it will be exactly the same size as the first and establish that the extraordinary claim is false.
                              • Tell me whether the bundled MingW contains a strip.exe and what the result of using it was? I expect the size will shrink to something more reasonable, consistent with the extra size being debug information.
                              • Tell us whether any part of your PRO file, or things it includes, manipulate the QMAKE_*, CFLAG or CXXFLAGS variable, and how. What is in the QT variable set to?

                              Tell us about the "makefile error for no reason." The output you posted earlier looks like a quite normal Makefile was processed and your code generated large numbers of warnings when compiled. Warnings are not without reason and not errors, but they may bite you later.

                              D Offline
                              D Offline
                              duncan98
                              wrote on last edited by
                              #34

                              @ChrisW67
                              I just want to know how to solve the oversized problem

                              C 1 Reply Last reply
                              0
                              • D duncan98

                                @ChrisW67
                                I just want to know how to solve the oversized problem

                                C Offline
                                C Offline
                                ChrisW67
                                wrote on last edited by
                                #35

                                @duncan98 Stop producing a debug build is my best guess.

                                D 1 Reply Last reply
                                1
                                • C ChrisW67

                                  @duncan98 Stop producing a debug build is my best guess.

                                  D Offline
                                  D Offline
                                  duncan98
                                  wrote on last edited by
                                  #36

                                  @ChrisW67
                                  This is true for debugging and publishing

                                  JonBJ 1 Reply Last reply
                                  0
                                  • D duncan98

                                    @ChrisW67
                                    This is true for debugging and publishing

                                    JonBJ Offline
                                    JonBJ Offline
                                    JonB
                                    wrote on last edited by
                                    #37

                                    @duncan98
                                    @ChrisW67 has replied to you at length stating that it looks like the -g option is being passed to g++ even when building for Release instead of Debug, at least some of the time from what you say. You need to find out why that is and stop it doing so. That is the answer to your question, even if you ask it repeatedly.

                                    D 2 Replies Last reply
                                    0
                                    • JonBJ JonB

                                      @duncan98
                                      @ChrisW67 has replied to you at length stating that it looks like the -g option is being passed to g++ even when building for Release instead of Debug, at least some of the time from what you say. You need to find out why that is and stop it doing so. That is the answer to your question, even if you ask it repeatedly.

                                      D Offline
                                      D Offline
                                      duncan98
                                      wrote on last edited by
                                      #38
                                      This post is deleted!
                                      1 Reply Last reply
                                      0
                                      • D Offline
                                        D Offline
                                        duncan98
                                        wrote on last edited by
                                        #39

                                        This problem often occurs, sometimes good and sometimes bad. Isn't it a bug?20210811211406.png

                                        M 1 Reply Last reply
                                        0
                                        • D duncan98

                                          This problem often occurs, sometimes good and sometimes bad. Isn't it a bug?20210811211406.png

                                          M Offline
                                          M Offline
                                          mchinand
                                          wrote on last edited by
                                          #40

                                          Can you copy and paste (not a screenshot) the output from the 'Compile Output' window when you get this error? You are showing very little info about your problem that would allow someone to help you.

                                          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