I'm making a program (let's call it ProgramWP) made with Qt 4.8.5 on a Fedora and based on a QWizard structure with its QWizardPages. The program has more or less 50 classes, 30 of them are QWizardPages.
The thing is that the program executable 'weights' (dunno the english word/expression) 8Mb ( the release version) and I want to know:
- Why does it weight so much? Which is the cause?
- How can I reduce it?
I need to reduce it because in the product of the enterprise, there are some applications runing, some of them mine. To sup up the exe's:
- ProgramMAIN (1.5MiB): the main program of the enterprise.
- ProgramMAIN2(600KiB): another important program of the enterprise.
- ProgramWP(8MiB): My main program (made with Qt).
- ProgramMINI(2.5Mib): My mini version of my main program (made with Qt).
- Program3(1.3MiB): My other program made with Qt
As you can see my main program weights so so so much than the main one while the main one is soooo much bigger (ProgramWP is just a little program to configure some easy things).
I'm linking statically some of our libs in ProgramWP and ProgramMINI but so does programMAIn and ProgramMAIN2 so... knowing that ProgramMain2 is 600Kibs with the linked libraries, my ProgramWP should not weight more than that.
This is how I do the linking in the .pro file:
unix:!macx: LIBS += -L$PWD/../../ConfigLib/Release/ -lLib1
INCLUDEPATH += $PWD/../../Lib1
DEPENDPATH += $PWD/../../Libs/Release
unix:!macx: PRE_TARGETDEPS += $PWD/../../Libs/Release/Lib1.a
I've searched and asked and found that I could add the QMAKE_CXX_FLAGS+= -s
line to the .pro file to delete the unnecesary symbolsand after doing it and runing the qmake, it stills weight the same (It's like if it was ignored). I've see if gcc uses the -s param and rebuilding I get:
g++ -c -pipe -std=c++11 -s -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_SCRIPT_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/lib/qt4/mkspecs/linux-g++ -I../MyProject-I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtXml -I/usr/include/QtScript -I/usr/include -I../../Utils -I../../Lib1-I../../Lib2-I../../Lib3-I../../Lib4-I. -I. -I../MyProject-I. -o wp2.o ../MyProject/wpmine.cpp
so as you can see, seems that gcc uses that param so... Any idea of why is it so heavy and how can I fix it?
Thank you so much.
Note: Their programs are made with eclipse and c++ basically while mine is made with Qt. To run it they have isntalled some Qt libraries in the enterprise's product so another question is... could they run my program without that libraries installed? Just putting there the exe and calling it?