Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Does QT configuration tool help in optimizing application size ?
QtWS25 Last Chance

Does QT configuration tool help in optimizing application size ?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
configurationconfigureconfigure toolstatic build
5 Posts 2 Posters 1.8k 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.
  • S Offline
    S Offline
    Srinivasan
    wrote on last edited by Srinivasan
    #1

    Can someone help me understand this? Will I be able to reduce my cross compiled QT application size if I strip down the unnecessary features inside a module using QT configuration tool and perform a static build?

    I'm trying to build qt statically with commercial license. The configure command helps to omit the unnecessary modules that are required using the -skip option say something like this.

    ./configure -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts 
    

    I believe the configuration tool (GUI tool) that QT provides also does the same job of selecting necessary modules that are required to build. But when using the configuration tool, I'm able to see the features available inside the modules.
    For example: Lets say that I compile my application with statically built qt libraries. The only modules that I require are qtdeclarative and qtbase and the executable size is X Megabytes. Now if I use the QT configuration tool and identify and strip down some features withing qtdeclarative and qtbase and rebuild the libraries statically and recompile my application with these new set of libraries, will I be able to reduce my application executable size? I understand that the library size may reduce but will the app size reduce?

    The problem I face is when I remove features inside a module and rebuild my QT source statically, sometimes the build fails because of some dependencies within the modules and it takes a lot of time to do this activity by enabling/disabling the features.

    sierdzioS 1 Reply Last reply
    0
    • S Srinivasan

      Can someone help me understand this? Will I be able to reduce my cross compiled QT application size if I strip down the unnecessary features inside a module using QT configuration tool and perform a static build?

      I'm trying to build qt statically with commercial license. The configure command helps to omit the unnecessary modules that are required using the -skip option say something like this.

      ./configure -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts 
      

      I believe the configuration tool (GUI tool) that QT provides also does the same job of selecting necessary modules that are required to build. But when using the configuration tool, I'm able to see the features available inside the modules.
      For example: Lets say that I compile my application with statically built qt libraries. The only modules that I require are qtdeclarative and qtbase and the executable size is X Megabytes. Now if I use the QT configuration tool and identify and strip down some features withing qtdeclarative and qtbase and rebuild the libraries statically and recompile my application with these new set of libraries, will I be able to reduce my application executable size? I understand that the library size may reduce but will the app size reduce?

      The problem I face is when I remove features inside a module and rebuild my QT source statically, sometimes the build fails because of some dependencies within the modules and it takes a lot of time to do this activity by enabling/disabling the features.

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @Srinivasan said in Does QT configuration tool help in optimizing application size ?:

      I understand that the library size may reduce but will the app size reduce?

      It might. And, as you observed, it is a trial-and-error procedure. Qt Project does not have resources to test each and every combination of configure calls and enabled/ disabled features.

      However, since you are using static Qt and static app (right?), most probably you won't gain anything by tweaking features. A static build already includes only the functions that are actually used, others are removed by linker.

      (Z(:^

      S 1 Reply Last reply
      4
      • sierdzioS sierdzio

        @Srinivasan said in Does QT configuration tool help in optimizing application size ?:

        I understand that the library size may reduce but will the app size reduce?

        It might. And, as you observed, it is a trial-and-error procedure. Qt Project does not have resources to test each and every combination of configure calls and enabled/ disabled features.

        However, since you are using static Qt and static app (right?), most probably you won't gain anything by tweaking features. A static build already includes only the functions that are actually used, others are removed by linker.

        S Offline
        S Offline
        Srinivasan
        wrote on last edited by
        #3

        @sierdzio Thanks for your reply and Yes, I'm building both QT and App as static. As you mentioned, if the linker removes the unwanted functions, then this trial and error activity is of no use as it will not reduce the application size.

        We are trying to reduce our application size as much as possible. We are already using the -optimize-size flag while configuring QT and CONFIG+= optimize_full in the project's .pro file.

        Just wanted to make sure if removing features using QT configuration tool will save some extra memory or not.

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          You can try using LTO to squeeze the libs even further.

          See: https://stackoverflow.com/questions/25878407/how-can-i-use-lto-with-static-libraries

          And some more description of what LTO is and does: https://wiki.debian.org/LTO https://gcc.gnu.org/wiki/LinkTimeOptimization

          (Z(:^

          S 1 Reply Last reply
          2
          • sierdzioS sierdzio

            You can try using LTO to squeeze the libs even further.

            See: https://stackoverflow.com/questions/25878407/how-can-i-use-lto-with-static-libraries

            And some more description of what LTO is and does: https://wiki.debian.org/LTO https://gcc.gnu.org/wiki/LinkTimeOptimization

            S Offline
            S Offline
            Srinivasan
            wrote on last edited by
            #5

            @sierdzio Thank you. Will look into it.

            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