Compile with -O0 (optimization off) handicap

Aleksey Midenkov midenok at gmail.com
Thu Jun 19 13:55:40 BST 2014


On Thu, Jun 19, 2014 at 3:53 PM, Milian Wolff <mail at milianw.de> wrote:
> Hello Aleksey
>
> On Thursday 19 June 2014 14:47:05 Aleksey Midenkov wrote:
>> When I compile kdevplatform, it inserts -g -O2:
>
> That is deduced from the CMAKE_BUILD_TYPE.
>
>> cd /home/midenok/src/kde/kdevelop/4.6/kdevplatform/build/sublime &&
>> /usr/bin/c++   -DKDE4_CMAKE_TOPLEVEL_DIR_LENGTH=34
>> -DKDE_DEFAULT_DEBUG_AREA=9504 -DKDE_DEPRECATED_WARNINGS
>> -DMAKE_SUBLIME_LIB -DQT_NO_CAST_TO_ASCII -DQT_NO_STL
>> -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS
>> -DQURL_NO_CAST_FROM_QSTRING -D_BSD_SOURCE -D_REENTRANT
>> -D_XOPEN_SOURCE=500 -g -O0 -DDEBUG -Wnon-virtual-dtor -Wno-long-long
>> -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith
>> -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new
>> -fno-common -Woverloaded-virtual -fno-threadsafe-statics
>> -fvisibility=hidden -Werror=return-type -fvisibility-inlines-hidden -g
>> -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline -fPIC ...
>>
>> Attempt to overwrite via CMAKE_CXX_FLAGS or CMAKE_CXX_FLAGS_DEBUG do
>> not have effect because CMAKE_CXX_FLAGS goes before -g -O2 and
>> CMAKE_CXX_FLAGS_DEBUG doesn't work at all even with
>> CMAKE_BUILD_TYPE:STRING=Debug. :(
>>
>> >From where these -g -O2 go? I can't find them in CMakeCache.txt. There
>>
>> are all -O2 in CMakeCache.txt and they are different strings:
>>
>> CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG -DQT_NO_DEBUG
>> CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
>>
>> So, it's not from CMakeCache.txt.
>
> It is, but via CMAKE_BUILD_TYPE. Use ccache to change that setting to e.g.
> debugfull or Debug.
>

But, I tried CMAKE_BUILD_TYPE=Debug and it doesn't have effect at all.
The above output is with CMAKE_BUILD_TYPE=Debug.

I have tried with 'debugfull' though and it worked!

Regards!



More information about the KDevelop mailing list