hi, I tried this question on the C++/Python SIG and was told to ask here. So.
When using distutils to build an extension (shared library), a C++ library to be imported into python, I find the optimization level set for me, to -O2 This is great, I guess, but for certain debugging tools (valgrind) I need that to be -O0 I tried setting the extra_compile_args and get output like this 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 Which as you can see, has -O2 (the default) following -DNDEBUG ... and my "extra" argument appended ... as -O0. I need to be sure that this overrides the -O2 setting (or know how to set it to -O0 correctly) ... I noted that the binaries produced are different and that the binary created when -O0 is in the gcc string is larger than the other... the GCC documentation I could find didn't address the issue of multiple flags on the same line and/or how the compiler would handle them, and I think there is/should be a "correct" way of doing this such that the confusion of "which optimization level is it using" doesn't exist. Can anyone a) tell me if my binary compiled w/extra_compile_args -O0 is, indeed, level zero b) tell me the correct way to adjust this flag? thank you -mike _______________________________________________ Distutils-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/distutils-sig
