inveniosoftware-contrib / intbitset

Python C-based extension implementing fast integer bit sets
https://intbitset.readthedocs.io
GNU Lesser General Public License v3.0
22 stars 18 forks source link

Python 3.11 compilation error #81

Open priv-kweihmann opened 2 years ago

priv-kweihmann commented 2 years ago

Package version (if known): 3.0.1

Describe the bug

Compilation on x86-64 (and potentially all other platforms) fails

Steps to Reproduce

Try to compile the c extension with python 3.11.0 release, up to py 3.10.6 everything at least compiled

Expected behavior

c extension compiles

Screenshots (if applicable)

Additional context

| intbitset/intbitset.c: In function ‘__pyx_pf_9intbitset_9intbitset___cinit__’:
| intbitset/intbitset.c:2337:13: warning: ‘PyObject_AsReadBuffer’ is deprecated [-Wdeprecated-declarations]
|  2337 |             __pyx_t_4 = ((PyObject_AsReadBuffer(__pyx_v_tmp, (&__pyx_v_buf), (&__pyx_v_size)) < 0) != 0);
|       |             ^~~~~~~~~
| In file included from /opt/build/build/tmp/work/x86_64-linux/python3-intbitset-native/3.0.1-r0/recipe-sysroot-native/usr/include/python3.11/Python.h:100,
|                  from intbitset/intbitset.c:6:
| /opt/build/build/tmp/work/x86_64-linux/python3-intbitset-native/3.0.1-r0/recipe-sysroot-native/usr/include/python3.11/abstract.h:343:17: note: declared here
|   343 | PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
|       |                 ^~~~~~~~~~~~~~~~~~~~~
| intbitset/intbitset.c: In function ‘__pyx_f_9intbitset_9intbitset_fastload’:
| intbitset/intbitset.c:9595:7: warning: ‘PyObject_AsReadBuffer’ is deprecated [-Wdeprecated-declarations]
|  9595 |       __pyx_t_9 = ((PyObject_AsReadBuffer(__pyx_v_tmp, (&__pyx_v_buf), (&__pyx_v_size)) < 0) != 0);
|       |       ^~~~~~~~~
| In file included from /opt/build/build/tmp/work/x86_64-linux/python3-intbitset-native/3.0.1-r0/recipe-sysroot-native/usr/include/python3.11/Python.h:100,
|                  from intbitset/intbitset.c:6:
| /opt/build/build/tmp/work/x86_64-linux/python3-intbitset-native/3.0.1-r0/recipe-sysroot-native/usr/include/python3.11/abstract.h:343:17: note: declared here
|   343 | PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
|       |                 ^~~~~~~~~~~~~~~~~~~~~
| intbitset/intbitset.c: In function ‘__Pyx_AddTraceback’:
| intbitset/intbitset.c:438:62: error: dereferencing pointer to incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
|   438 |   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
|       |                                                              ^~
| intbitset/intbitset.c:17283:5: note: in expansion of macro ‘__Pyx_PyFrame_SetLineNumber’
| 17283 |     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
|       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
priv-kweihmann commented 2 years ago

Likely an issue with the code generation from cython - there are several issues in the cython upstream bug tracker that claim to have fixed this - so I guess a refresh of the c code should do it using the latest cython master

pombredanne commented 2 years ago

@priv-kweihmann Thanks, the likely solution is to regen the C code indeed!

pombredanne commented 1 year ago

Keeping this open until we have a stable fix upstream Likely with https://github.com/cython/cython/issues/4827 or https://github.com/cython/cython/issues/4681

rnjudge commented 1 year ago

I hit a similar compilation error for this library with Python 3.10 installed (while trying to install scancode, @pombredanne). I am doing so on an Mac M1 arm chip:

     creating build/temp.linux-aarch64-cpython-310/intbitset
      aarch64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/rose/ternenv/include -I/usr/include/python3.10 -c intbitset/intbitset.c -o build/temp.linux-aarch64-cpython-310/intbitset/intbitset.o -O3 -march=core2 -mtune=native
      intbitset/intbitset.c: In function ‘__pyx_pf_9intbitset_9intbitset___cinit__’:
      intbitset/intbitset.c:2267:13: warning: ‘PyObject_AsReadBuffer’ is deprecated [-Wdeprecated-declarations]
       2267 |             __pyx_t_4 = ((PyObject_AsReadBuffer(__pyx_v_tmp, (&__pyx_v_buf), (&__pyx_v_size)) < 0) != 0);
            |             ^~~~~~~~~
      In file included from /usr/include/python3.10/genobject.h:12,
                       from /usr/include/python3.10/Python.h:110,
                       from intbitset/intbitset.c:4:
      /usr/include/python3.10/abstract.h:343:17: note: declared here
        343 | PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
            |                 ^~~~~~~~~~~~~~~~~~~~~
      intbitset/intbitset.c: In function ‘__pyx_f_9intbitset_9intbitset_fastload’:
      intbitset/intbitset.c:9543:7: warning: ‘PyObject_AsReadBuffer’ is deprecated [-Wdeprecated-declarations]
       9543 |       __pyx_t_9 = ((PyObject_AsReadBuffer(__pyx_v_tmp, (&__pyx_v_buf), (&__pyx_v_size)) < 0) != 0);
            |       ^~~~~~~~~
      /usr/include/python3.10/abstract.h:343:17: note: declared here
        343 | PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
            |                 ^~~~~~~~~~~~~~~~~~~~~
      Assembler messages:
      Error: unknown architecture `core2'

      Error: unrecognized option -march=core2
      error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
pombredanne commented 1 year ago

I released macOS fat binary "universal" wheels in the last few days. These are not for Linux ARM though they should work on macOS M1 natively.

Could you test if these pre-built binaries work on your machine with a pip install? See https://pypi.org/project/intbitset/3.0.2/#files