You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following setup with 2 pyx files and the corresponding setup.py to build them results in a gcc compile time error:
#>>> moda.pyx
cdef class ClassA:
cdef int[2] a
#>>> modb.pyx
from moda cimport ClassA
cdef class ClassB(ClassA):
cdef int[2] b
#>>> setup.py
from setuptools import setup
from Cython.Build import cythonize
import Cython.Compiler.Options
Cython.Compiler.Options.cimport_from_pyx = True
setup(
ext_modules = cythonize(["moda.pyx", "modb.pyx"],
compiler_directives={'language_level': 3})
)
The error is as follows:
$ python setup.py build
running build
running build_ext
building 'modb' extension
gcc -pthread -B /home/clemens/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/clemens/miniconda3/include/python3.7m -c modb.c -o build/temp.linux-x86_64-3.7/modb.o
modb.c:2585:32: error: redefinition of ‘__Pyx_carray_to_py_int’
static CYTHON_INLINE PyObject *__Pyx_carray_to_py_int(int *__pyx_v_v, Py_ssize_t __pyx_v_length) {
^~~~~~~~~~~~~~~~~~~~~~
modb.c:2038:32: note: previous definition of ‘__Pyx_carray_to_py_int’ was here
static CYTHON_INLINE PyObject *__Pyx_carray_to_py_int(int *__pyx_v_v, Py_ssize_t __pyx_v_length) {
^~~~~~~~~~~~~~~~~~~~~~
modb.c:2696:32: error: redefinition of ‘__Pyx_carray_to_tuple_int’
static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_int(int *__pyx_v_v, Py_ssize_t __pyx_v_length) {
^~~~~~~~~~~~~~~~~~~~~~~~~
modb.c:2149:32: note: previous definition of ‘__Pyx_carray_to_tuple_int’ was here
static CYTHON_INLINE PyObject *__Pyx_carray_to_tuple_int(int *__pyx_v_v, Py_ssize_t __pyx_v_length) {
^~~~~~~~~~~~~~~~~~~~~~~~~
modb.c:2804:12: error: redefinition of ‘__Pyx_carray_from_py_int’
static int __Pyx_carray_from_py_int(PyObject *__pyx_v_o, int *__pyx_v_v, Py_ssize_t __pyx_v_length) {
^~~~~~~~~~~~~~~~~~~~~~~~
modb.c:2257:12: note: previous definition of ‘__Pyx_carray_from_py_int’ was here
static int __Pyx_carray_from_py_int(PyObject *__pyx_v_o, int *__pyx_v_v, Py_ssize_t __pyx_v_length) {
^~~~~~~~~~~~~~~~~~~~~~~~
error: command 'gcc' failed with exit status 1
The issue seems to be that certain utility functions are getting inserted into the C source file multiple times. The error goes away if cimport_from_pyx is disabled and a moda.pxd file is generated manually.
This is Python 3.7.4, Cython 0.29.20, Linux (WSL) with gcc 7.5.0.
The text was updated successfully, but these errors were encountered:
The following setup with 2 pyx files and the corresponding setup.py to build them results in a gcc compile time error:
The error is as follows:
The issue seems to be that certain utility functions are getting inserted into the C source file multiple times. The error goes away if
cimport_from_pyx
is disabled and a moda.pxd file is generated manually.This is Python 3.7.4, Cython 0.29.20, Linux (WSL) with gcc 7.5.0.
The text was updated successfully, but these errors were encountered: