[SciPy-Dev] How to compile Scipy without optimisations -O0?
Blair Azzopardi
blairuk at gmail.com
Sun Sep 27 13:26:02 EDT 2020
Hi
I'm trying to debug some scipy C code between two platforms and I'm
struggling with each platform optimizing away different variables while
stepping through.
I'd like to add -O0 flag and rebuild but when I do something along the
lines of:
OPT=-O0 python setup.py build_ext --inplace
I see the flag added but it's superseded by later flags (default
optimization -O2), ie.
..
extra options: '-std=c++14'
x86_64-linux-gnu-g++: /tmp/tmpnf9pc9rw/main.c
C compiler: x86_64-linux-gnu-g++ -pthread -Wno-unused-result -Wsign-compare
-O0 -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv
-O2 -g -fstack-protector-strong -Wformat -Werror=format-security
-Wdate-time -D_FORTIFY_SOURCE=2 -fPIC
..
I've also tried creating a site.cfg with the following:
[ALL]
extra_compile_args = -O0
where I see the buildlog picking this option up but it appears to have no
effect on the compiler flags.
FOUND:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/lib/x86_64-linux-gnu']
language = c
define_macros = [('HAVE_CBLAS', None)]
extra_compile_args = ['-O0']
Finally, I also tried building via runtests.py but this appears to have the
same effect as setting the OPT environment variable above (eg python
runtests.py -g -b).
Short of sifting through the numpy distutils package and hacking the flags
in, I was wondering if there's a recommended way to do this in Scipy? I'm
sure I'm just being daft.
Kind regards,
Blair
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20200927/20ce072e/attachment.html>
More information about the SciPy-Dev
mailing list