Costimizing statically built binary

  • I am created a project on Ubuntu 10.04 using Qt 4.7.4 . My executable should be portable across Linux machines so I made it as statically built.

    I have followed below mentioned url instructions for statical build.

    Q1) With out configuring and compiling the source code dose Qt creator have any option for static build?

    After making statically built my executable appears to be 14MB.

    Q2) Is there any way to optimize statically build executable size ?

    Any idea how to optimize size?


  • I think that I have an answer for question 2. In linux is a command:
    Execute this program on your executable:
    strip qt_program.out
    Check size. Read of course strip's manual.

  • Regarding Q1: Qt Creator dose not provide these means, but qmake does. You will have to rebuild Qt manually for static linking though. The option is set during the ./configure run, there's nothing Creator can help you here.

    Make sure to check the licensing issues with static building, though.

Log in to reply