How may I override the compiler (gcc) flags that setup.py uses by default?

隐身守侯 提交于 2019-11-26 21:55:29
clsung
  • Prepend CFLAGS="-O0" before you run setup.py:

    % CFLAGS="-O0" python ./setup.py
    

    The -O0 will be appended to CFLAGS while compiling, therefore will override previous -O2 setting.

  • Another way is add -O0 to extra_compile_args in setup.py:

    moduleA = Extension('moduleA', .....,
            include_dirs = ['/usr/include', '/usr/local/include'], 
            extra_compile_args = ["-O0"], 
            )
    
  • If you want to remove all default flags, use:

    % OPT="" python ./setup.py
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!