views:

73

answers:

3

Hi All,

Currently we are working on how to optimize the application's binary size of QT. I need only one QLable and QLineEdit widget in application and i have removed other widgets from the compilation options. Currenlty application link libQtGui and libQtCore library. I have compiled QT for embedded arm architecture. I have compile one sample code and the binary size of the code is around 6MB. Is there any way to optimize the binary size ?

Thanks, Neel

A: 

I just tested compiling Hello World app with Qt on embedded arm and the binary is 120k. The only way your binary can climb into megabyte range is that you link it statically, ie. include all required Qt within your binary. Try removing static keyword from your project file.

Obviously, if your app is the sole user of Qt in the device, it makes sense to statically link it. Otherwise, Qt as a shared library and linking dynamically makes much more sense and will save a lot of space.

Tuminoid
You are right my project is compiled with static building of library.I want to reduce the binary size with linking statically.If i use my application with dynamic linking then also i have to put .so file on board where my application is running.In my case only binary is needed not .so files so i want to reduce my application binary size with statically linked.
Neel Patel
+2  A: 

Please take a look at http://doc.trolltech.org/4.7-snapshot/fine-tuning-features.html

guruz
A: 

Build a custom version of QtCore and QtGui libraries with all unnecessary features disabled which you can link statically.

See the link in guruz' answer for instructions.

teukkam