[Qt-creator] optimization and file size between versions

Duane duane.hebert at group-upc.com
Mon Sep 30 17:44:44 CEST 2013


On 9/30/2013 3:14 AM, Ziller Eike wrote:
>
> On 29.09.2013, at 16:22, Oleksii Serdiuk <contacts at oleksii.name> wrote:
>
>> Hello Dane,
>>
>> Do you build Qt yourself? Prebuilt Qt binaries always default to release build (CONFIG+=release), unless you pass CONFIG+=debug to qmake. However, when you build Qt yourself, depending on configure options you specify, it can default to debug build (CONFIG+=debug) and you have to specify CONFIG+=release explicitly if you want to build in release mode. AFAIK, Qt Creator assumes that Qt defaults to release build so it doesn't explicitly pass CONFIG+=release to qmake.
>
> Qt Creator actually looks into what you Qt does by default, and then only passes CONFIG+=release or CONFIG+=debug if needed.
> The most reliable way to find out if you do a release or debug build is to look for -g options on your gcc command lines.
>
>>>>> […]
>>>>> Try adding "QT=" to your project.
>>>>>
>>>>
>>>>
>>>> Didn't help.  One thing that I do notice is that I don't see +=Release
>>>> in the build string:
>>>>
>>>> 10:04:08: Starting: "/usr/bin/qmake-qt4"
>>>> /home/duane/QtSDK/PT500Projects/visu32/visu32.pro -r -spec linux-g++
>>>> 10:04:08: The process "/usr/bin/qmake-qt4" exited normally.
>>>> 10:04:09: Starting: "/usr/bin/make"
>>>> g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
>
> You have -O2 -g here, so "optimized with debug info" which is something that I think Qt normally doesn't do. Did you manually override compiler flags, or touch the mkspecs?
> The presence or absence of -O flags can also result in different code size, though I'd guess not in the magnitude that you experience?
>

Hmmm.  No, I haven't messed with the make specs and I don't think I've 
changed any compiler flags.  I just built a new 4.8.1 and switched to 
that and I don't have any problems.  The resulting files on 12 of my 
projects match what my colleague's results are.  There must be something 
in the build of the 4.8.4 and 5.2 versions.

My build output with the 4.8.1 version is now:

g++ -c -pipe -O2 -Wall -W -Wno-write-strings -Wno-unused-parameter 
-Wno-unused-variable -DBPP32 -DPT470BUILD 
-I/usr/local/Trolltech/Qt-4.8.1/mkspecs/linux-g++ -I. 
-I../../../SVN_Repos/PT470Development/src/include 
-I../../../SVN_Repos/PT470Development/OpenGUI/src 
-I../../../SVN_Repos/PT470Development/OpenGUI/src -o main.o 
../../../SVN_Repos/PT470Development/src/visu32/main.cpp

no -g

So maybe it was using debug.  But shouldn't that be enabled/disabled 
from the debug/release switch in the ide?



<snip>




More information about the Qt-creator mailing list