cc1plus: warning: command line option “-Wstrict-prototypes” is valid for Ada/C/ObjC but not for C++

后端 未结 7 785
日久生厌
日久生厌 2020-12-13 12:40

I am building a C++ extension for use in Python. I am seeing this warning being generated during the compilation process - when a type:

python setup.py build         


        
7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-13 13:17

    For the sake of anyone arriving here after trying to install pydoop under pypy, this solution which was adopted in pydoop 1.0.0:

    from distutils.sysconfig import get_config_var
    _UNWANTED_OPTS = frozenset(['-Wstrict-prototypes'])
    os.environ['OPT'] = ' '.join(
        _ for _ in get_config_var('OPT').strip().split() if _ not in _UNWANTED_OPTS
    

    breaks the installation under pypy because pypy sysconfig does not supply the 'OPT' variable at all, causing it to abort when it tries to apply strip() to None. Solution is just to comment out the whole block.

提交回复
热议问题