Hey all, recently, I had a gcc compile time error with cython. The work around is obvious, as the problem happens when a cdef-ed numpy array in a function is unused. Nevertheless, I feel it's useful to report the problem I had.
The following is a test case ---------------------------------------- test.pyx import numpy as np cimport numpy as np def f(np.ndarray[dtype=np.int_t, ndim=2] arg1): cdef np.ndarray[dtype=np.int_t, ndim=2] arr return 3 ----------------------------------------- setup.py from distutils.core import setup from Cython.Build import cythonize setup( ext_modules = cythonize("test.pyx"), ) ---------------------------------------------------------- This gives me the error error: ‘__pyx_pybuffernd_arr’ undeclared Full shell output: ~/tmp/ctest > python setup.py build_ext --inplace running build_ext building 'test' extension x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c test.c -o build/temp.linux-x86_64-2.7/test.o In file included from /usr/include/python2.7/numpy/ndarraytypes.h:1761:0, from /usr/include/python2.7/numpy/ndarrayobject.h:17, from /usr/include/python2.7/numpy/arrayobject.h:4, from test.c:250: /usr/include/python2.7/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp] #warning "Using deprecated NumPy API, disable it by " \ ^ test.c: In function ‘__pyx_pf_4test_f’: test.c:1240:30: error: ‘__pyx_pybuffernd_arr’ undeclared (first use in this function) __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer); ^ test.c:1240:30: note: each undeclared identifier is reported only once for each function it appears in In file included from /usr/include/python2.7/numpy/ndarrayobject.h:26:0, from /usr/include/python2.7/numpy/arrayobject.h:4, from test.c:250: test.c: At top level: /usr/include/python2.7/numpy/__multiarray_api.h:1629:1: warning: ‘_import_array’ defined but not used [-Wunused-function] _import_array(void) ^ In file included from /usr/include/python2.7/numpy/ufuncobject.h:327:0, from test.c:251: /usr/include/python2.7/numpy/__ufunc_api.h:241:1: warning: ‘_import_umath’ defined but not used [-Wunused-function] _import_umath(void) ^ error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel