[C++-sig] Set optimization level for build_ext ??

Michael Wieher michael.wieher at gmail.com
Mon Jun 30 18:55:06 CEST 2008


Hey,

trying to use valgrind with some libraries generated via native
python's extension capabilities (not boost)

so, by default I see

gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fPIC
-I/usr/include/python2.4 .... (my files)

I want -O0 not -O2 so valgrind can find line numbers more correctly...

I tried using "extra_complie_args" but that appends -O0 to the same
line, still has -O2 ...

not sure if -O0 over-rides the -O2 from earlier in the invocation or
if it is ignored in favor of -O2

it looks like

gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fPIC
-I/usr/include/python2.4 -c memrid.cpp -o
build/temp.linux-i686-2.4/memrid.o -O0


can anyone help me to be sure that I'm using NO optimization when this
is compiled (ie: how to turn it on/off?)

thanks,
-mike



More information about the Cplusplus-sig mailing list