[Qt-creator] optimization and file size between versions

Ziller Eike Eike.Ziller at digia.com
Mon Sep 30 09:14:53 CEST 2013


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?

Br, Eike

>>> -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom
>>> -fasynchronous-unwind-tables -O2 -Wall -W -Wno-write-strings
>>> -Wno-unused-parameter -Wno-unused-variable -DBPP32 -DPT470BUILD
>>> -I/usr/lib/qt4/mkspecs/linux-g++ -I../visu32
>>> -I../../../SVN_Repos/PT470Development/src/include
>>> -I../../../SVN_Repos/PT470Development/OpenGUI/src
>>> -I../../../SVN_Repos/PT470Development/OpenGUI/src -I../visu32 -I. -o
>>> main.o ../../../SVN_Repos/PT470Development/src/visu32/main.cpp
>>> ...
>> 
>> 
>> 
>> When I build with 4.8.1 is see this:
>> 
>> 10:20:09: Starting: "/home/duane/QtSDK/Desktop/Qt/4.8.1/gcc/bin/qmake"
>> /home/duane/QtSDK/PT500Projects/visu32/visu32.pro -r -spec linux-g++
>> CONFIG+=release
>> 10:20:09: The process "/home/duane/QtSDK/Desktop/Qt/4.8.1/gcc/bin/qmake"
>> exited normally.
>> 10:20:09: Starting: "/usr/bin/make"  ...
>> 
>> 
>> The =+release is there.
>> 
>> 
>> _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/qt-creator
>> 
> 
> -- 
> With best regards,
> Oleksii Serdiuk
> 
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

-- 
Eike Ziller, Senior Software Engineer - Digia, Qt
 
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Anja Wasenius
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B




More information about the Qt-creator mailing list