Penlect/rectangle-packer

Cython.Compiler.Errors.CompileError: rpack/_core.pyx

mxmilkiib opened this issue · 5 comments

Trying to build on Arch Linux via https://aur.archlinux.org/packages/python-rectangle-packer

Currently getting:

==> Starting build()...
/usr/lib/python3.11/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
!!

        ********************************************************************************
        Requirements should be satisfied by a PEP 517 installer.
        If you are using pip, you can try `pip install --use-pep517`.
        ********************************************************************************

!!
  dist.fetch_build_eggs(dist.setup_requires)
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-311
creating build/lib.linux-x86_64-cpython-311/rpack
copying rpack/__init__.py -> build/lib.linux-x86_64-cpython-311/rpack
running egg_info
creating rectangle_packer.egg-info
writing rectangle_packer.egg-info/PKG-INFO
writing dependency_links to rectangle_packer.egg-info/dependency_links.txt
writing top-level names to rectangle_packer.egg-info/top_level.txt
writing manifest file 'rectangle_packer.egg-info/SOURCES.txt'
reading manifest file 'rectangle_packer.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.md'
writing manifest file 'rectangle_packer.egg-info/SOURCES.txt'
copying rpack/_core.pxd -> build/lib.linux-x86_64-cpython-311/rpack
copying rpack/_core.pyx -> build/lib.linux-x86_64-cpython-311/rpack
running build_ext
Compiling rpack/_core.pyx because it changed.
[1/1] Cythonizing rpack/_core.pyx
warning: rpack/_core.pyx:15:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: rpack/_core.pyx:16:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: rpack/_core.pyx:17:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: rpack/_core.pyx:18:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: rpack/_core.pyx:19:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: rpack/_core.pyx:20:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310

Error compiling Cython file:
------------------------------------------------------------
...
        self.sum_width, self.sum_height = self.sum_height, self.sum_width
        self.min_width, self.min_height = self.min_height, self.min_width
        self.max_width, self.max_height = self.max_height, self.max_width

    cdef void sort_by_index(self, size_t length) nogil:
        qsort(<void*>(self.rectangles), length, sizeof(Rectangle), rectangle_index_cmp)
                                                                   ^
------------------------------------------------------------

rpack/_core.pyx:209:67: Cannot assign type 'int (const void *, const void *) except? -1 nogil' to 'int (*)(const void *, const void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'int (const void *, const void *) except? -1 nogil'.

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

    cdef void sort_by_index(self, size_t length) nogil:
        qsort(<void*>(self.rectangles), length, sizeof(Rectangle), rectangle_index_cmp)

    cdef void sort_by_width(self) nogil:
        qsort(<void*>(self.rectangles), self.length, sizeof(Rectangle), rectangle_width_cmp)
                                                                        ^
------------------------------------------------------------

rpack/_core.pyx:212:72: Cannot assign type 'int (const void *, const void *) except? -1 nogil' to 'int (*)(const void *, const void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'int (const void *, const void *) except? -1 nogil'.

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

    cdef void sort_by_width(self) nogil:
        qsort(<void*>(self.rectangles), self.length, sizeof(Rectangle), rectangle_width_cmp)

    cdef void sort_by_height(self) nogil:
        qsort(<void*>(self.rectangles), self.length, sizeof(Rectangle), rectangle_height_cmp)
                                                                        ^
------------------------------------------------------------

rpack/_core.pyx:215:72: Cannot assign type 'int (const void *, const void *) except? -1 nogil' to 'int (*)(const void *, const void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'int (const void *, const void *) except? -1 nogil'.

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

    cdef void sort_by_height(self) nogil:
        qsort(<void*>(self.rectangles), self.length, sizeof(Rectangle), rectangle_height_cmp)

    cdef void sort_by_area(self) nogil:
        qsort(<void*>(self.rectangles), self.length, sizeof(Rectangle), rectangle_area_cmp)
                                                                        ^
------------------------------------------------------------

rpack/_core.pyx:218:72: Cannot assign type 'int (const void *, const void *) except? -1 nogil' to 'int (*)(const void *, const void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'int (const void *, const void *) except? -1 nogil'.
Traceback (most recent call last):
  File "/home/milk/.cache/yay/python-rectangle-packer/src/rectangle-packer-2.0.1/setup.py", line 46, in <module>
    setup(
  File "/usr/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command
    super().run_command(command)
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
    self.run_command(cmd_name)
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command
    super().run_command(command)
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
    _build_ext.run(self)
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
    self.build_extensions()
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
    self._build_extensions_serial()
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
    self.build_extension(ext)
  File "/usr/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
    _build_ext.build_extension(self, ext)
  File "/usr/lib/python3.11/site-packages/Cython/Distutils/build_ext.py", line 122, in build_extension
    new_ext = cythonize(
              ^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
    cythonize_one(*args)
  File "/usr/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: rpack/_core.pyx
==> ERROR: A failure occurred in build().
    Aborting...
 -> Failed to install layer, rolling up to next layer.error:error making: python-rectangle-packer - exit status 4

im also getting the same error

Which version of Cython was used here?

3.0.3

Trying to build this on Solus with cython 3.0.10 gets a build error as well.

https://build.getsol.us/logs/python-rectangle-packer-2.0.2-7.log

I bumped Cython to version 3 when building wheels with the latest version of cibuildwheel, and the package appears to build correctly. Hopefully, this resolves the issue.