-O2 in Debug build?

Thiago Macieira thiago at kde.org
Fri Jul 18 22:55:50 CEST 2008


Alexander Neundorf wrote:
>On Friday 18 July 2008, Andreas Pakulat wrote:
>> Hi,
>>
>> Whats the reasoning behind using -O2 in the Debug CXX flags? A debug
>> build shouldn't use _any_ optimizations IMHO.
>
>I think there were lengthy discussion about the flags for the different
> build types. I guess this was the result.
>/me hasn't slept a lot this week, so I don't feel like searching for
> this now

The reason is that we split the build types in (for gcc):

Release
	optimised for speed, qDebug/kDebug turned off, no debug symbols
Release with debug info
	optimised for speed, debugging symbols on (-g)
Debug
	optimised but debuggable, debugging on (-g)
	(-fno-reorder-blocks -fno-schedule-insns -fno-inline)
DebugFull
	no optimisation, full debugging on (-g3)
Profile
	DebugFull + -ftest-coverage -fprofile-arcs

It is expected that the "Debug" build type be still debuggable with gdb 
without going all over the place, but still produce better performance. 
It's also important to note that gcc cannot detect all warning conditions 
unless the optimiser is active.

I'd say that "debug" is recommended for kdelibs for people developing KDE 
applications, since oftentimes they may have to go into kdelibs 
functions. Their own code should be build under debugfull while still in 
development, but should be built a few times in release before a release.

>> And the _DEBUGFULL versions are meaningless as there's no such
>> buildtype (at least with cmake 2.6).
>
>You can define your own build modes by setting these variables and then
>setting the buildtype to that identifier.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20080718/67a34275/attachment.pgp 


More information about the Kde-buildsystem mailing list