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 Qt Application Binary size ?
QtWS25 Last Chance

How to reduce Qt Application Binary size ?

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

    Hi All,

    I have compiled Qt for Embedded Linux platform statically.
    I have also used qconfig to remove some of the functionality to reduce the size of the Qt Binary.
    But i haven't gain much size difference between above changes.
    Currently my Qt Application size id ~8MB after the some changes i got ~214KB size reduction BUT is there any way i can reduce the size my Qt Application to ~5MB ? Any change in configure command ? I have given following configuration command for embedded linux.

    /home/Qt_lib_optimization/QTOMAP_Optimize/Source/qt-everywhere-commercial-src-4.6.0/configure -prefix /home/Qt_lib_optimization/QTOMAP_Optimize/Install -embedded arm -static -depths 24 -qt-kbd-linuxinput -no-largefile -stl -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-sqlite_symbian -no-sql-tds -no-qt3support -no-phonon -no-webkit -no-gif -no-libtiff -no-libmng -qt-libpng -qt-libjpeg -no-dbus -no-nis -no-openssl -no-scripttools -no-javascript-jit -no-mmx -no-3dnow -no-sse -no-sse2 -little-endian -v -xplatform qws/linux-arm-g++ -host-little-endian -nomake examples -nomake demos -nomake docs -nomake translations -no-xrender -no-xrandr -no-xfixes -no-xcursor -no-nas-sound -no-opengl -no-openvg -no-sm -no-xshape -no-xinerama -no-javascript-jit -no-multimedia -qconfig 10May2011

    Give me some idea to reduce the size of my Qt Application.
    How can i achieve size reduction ?

    Thanks,
    Neel

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      Maybe there's a linker option that makes sure only code that is actually used is included. Else you will have to remove everything and add certain components until your application can be built again.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • N Offline
        N Offline
        neel2818
        wrote on last edited by
        #3

        which linker option to set ?...
        Another way to reduce the size ?

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Franzk
          wrote on last edited by
          #4

          [quote author="neel2818" date="1305105920"]which linker option to set ?...[/quote]Don't know about that.

          "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • D Offline
            D Offline
            deimos
            wrote on last edited by
            #5

            There is also the choice to compress the binary. Look at "upx":http://upx.sourceforge.net/ , it could be available also in linux repositories

            1 Reply Last reply
            0
            • ? This user is from outside of this forum
              ? This user is from outside of this forum
              Guest
              wrote on last edited by
              #6

              Some time ago I heard about that compiler option: gcc has the ability to search for functions that call other functions that... (etc), but skipping those other included in the same file but never called.

              I remember finding this option in man gcc, and being unable to finally use it... Maybe the links below offer some help.

              http://www.google.es/search?q=partial+linking&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:es-ES:official&client=firefox-a

              http://stackoverflow.com/questions/270984/g-partial-linking-instead-of-archives

              http://newsgroups.derkeiler.com/Archive/Comp/comp.compilers/2005-07/msg00131.html

              (...) something along the lines ld -Ur -o mylib.o [components] (...)

              --

              1 Reply Last reply
              0
              • A Offline
                A Offline
                augiekim
                wrote on last edited by
                #7

                "Building Qt Static (and Dynamic) and Making it Small with GCC, Microsoft Visual Studio, and the Intel Compiler":http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler/

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  giesbert
                  wrote on last edited by
                  #8

                  If you want to use static builds, make sure you use the correct license options.
                  Afaik (I'm not a lawyer!) you have to have a commercial license or your software must be GPL to use static linking.

                  Nokia Certified Qt Specialist.
                  Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #9

                    IANAL either, but AFAIK, as long as you provide the option to re-link against another version of the library, you are allowed to use static linking using the LGPL Qt libraries. And no, that is probably not too easy to do, but I think Gerolf's comment is incorrect.

                    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