我需要一个提示来解决与Cython相关的问题

时间:2018-08-21 08:14:41

标签: python cython

我有以下文件:

app.py(有一些更复杂的代码)

print("Hello, World!")

compile.py

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
    Extension("APP",  ["app.py"])
]
setup(
    name = 'AVP',
    cmdclass = {'build_ext': build_ext},
    ext_modules = ext_modules
)

main.py

from logic import main      # this comes from a compiled binary
main ()

运行此命令时:

python3 compile.py build_ext --inplace

我得到这个:

(protect) ~/workspace/avp/ (master) $ python3 compile.py build_ext --inplace
running build_ext
skipping 'app.c' Cython extension (up-to-date)
building 'APP' extension
clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wshadow -fPIC -I/opt/pyenv/versions/3.6.0/include/python3.6m -c app.c -o build/temp.linux-x86_64-3.6/app.o
gcc -pthread -shared -L/opt/pyenv/versions/3.6.0/lib -L/opt/pyenv/versions/3.6.0/lib -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wshadow build/temp.linux-x86_64-3.6/app.o -o /home/ubuntu/workspace/avp/APP.cpython-36m-x86_64-linux-gnu.so
gcc: error: unrecognized command line option ‘-fsanitize=signed-integer-overflow’
gcc: error: unrecognized command line option ‘-fsanitize=undefined’
error: command 'gcc' failed with exit status 1

说实话,我不确定自己做错了什么,因为我一直在关注:

https://medium.com/@xpl/protecting-python-sources-using-cython-dcd940bb188e

它仅创建app.c文件,而不创建app.so

0 个答案:

没有答案