enthought/mayavi

Failed Cython compilation (Cython > 3.0)

Closed this issue · 2 comments

yuzibo commented

Hi,

From #1056816, there is one Cython > 3.0 has one issue for mayavi. The build log is below:

make[1]: Entering directory '/<<PKGBUILDDIR>>'
find /<<PKGBUILDDIR>>/* -name '*.pyx' -exec cython3 '{}' ';'
/usr/lib/python3/dist-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /<<PKGBUILDDIR>>/tvtk/src/array_ext.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)

Error compiling Cython file:
------------------------------------------------------------
...

    cell_length = id_array.dimensions[1];
    dim0 = id_array.dimensions[0]
    id_data = <int*> id_array.data
    out_data = <int*> out_array.data
    stride0 = id_array.strides[0]/sizeof(int)
                                 ^
------------------------------------------------------------

tvtk/src/array_ext.pyx:62:33: Cannot assign type 'double' to 'int'

Error compiling Cython file:
------------------------------------------------------------
...
    cell_length = id_array.dimensions[1];
    dim0 = id_array.dimensions[0]
    id_data = <int*> id_array.data
    out_data = <int*> out_array.data
    stride0 = id_array.strides[0]/sizeof(int)
    stride1 = id_array.strides[1]/sizeof(int)
                                 ^
------------------------------------------------------------

tvtk/src/array_ext.pyx:63:33: Cannot assign type 'double' to 'int'

Error compiling Cython file:
------------------------------------------------------------
...

    cell_length = id_array.dimensions[1];
    dim0 = id_array.dimensions[0]
    id_data = <Py_ssize_t*> id_array.data
    out_data = <Py_ssize_t*> out_array.data
    stride0 = id_array.strides[0]/sizeof(Py_ssize_t)
                                 ^
------------------------------------------------------------

tvtk/src/array_ext.pyx:91:33: Cannot assign type 'double' to 'Py_ssize_t'

Error compiling Cython file:
------------------------------------------------------------
...
    cell_length = id_array.dimensions[1];
    dim0 = id_array.dimensions[0]
    id_data = <Py_ssize_t*> id_array.data
    out_data = <Py_ssize_t*> out_array.data
    stride0 = id_array.strides[0]/sizeof(Py_ssize_t)
    stride1 = id_array.strides[1]/sizeof(Py_ssize_t)
                                 ^
------------------------------------------------------------

tvtk/src/array_ext.pyx:92:33: Cannot assign type 'double' to 'Py_ssize_t'
LD_PRELOAD=libgomp.so.1 xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" dh_auto_build
...
extra options: '-msse -msse2 -msse3'
INFO: x86_64-linux-gnu-gcc: tvtk/src/array_ext.c
tvtk/src/array_ext.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
    1 | #error Do not use this file, it is the result of a failed Cython compilation.
      |  ^~~~~
error: Command "x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -fstack-clash-protection -Wfo

Although use cython3-legacy which < 3.0 as a workaround, but I think the best way should be fixed fron upstream.

@prabhuramachandran this issue can be closed I think as this has been fixed:

stride0 = id_array.strides[0]//sizeof(int)

Thanks @larsoner, @yuzibo, please let us know if this is not fixed in master. Thank you.