Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.11 compilation error #81

Open
priv-kweihmann opened this issue Oct 30, 2022 · 5 comments
Open

Python 3.11 compilation error #81

priv-kweihmann opened this issue Oct 30, 2022 · 5 comments
Labels

Comments

@priv-kweihmann
Copy link
Contributor

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
Copy link
Contributor Author

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

priv-kweihmann added a commit to priv-kweihmann/intbitset that referenced this issue Oct 30, 2022
this is a backport of a change done in cython to include the
correct definition of PyFrame for python 3.11.
Only added a guard macro to avoid double including the
header file

Closes inveniosoftware-contrib#81

Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
@pombredanne
Copy link
Collaborator

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

@pombredanne
Copy link
Collaborator

Keeping this open until we have a stable fix upstream
Likely with cython/cython#4827 or cython/cython#4681

@pombredanne pombredanne reopened this Dec 9, 2022
pombredanne added a commit to aboutcode-org/intbitset that referenced this issue Jan 11, 2023
Reference: inveniosoftware-contrib#81

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit to aboutcode-org/intbitset that referenced this issue Jan 14, 2023
Using Cython 0.29.33

Cython-fix-by: Konrad Weihmann @priv-kweihmann
Reference: inveniosoftware-contrib#81
Reference: inveniosoftware-contrib@a2dcd77
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit to aboutcode-org/intbitset that referenced this issue Jan 14, 2023
Using Cython 0.29.33

Cython-fix-by: Konrad Weihmann @priv-kweihmann
Reference: inveniosoftware-contrib#81
Reference: inveniosoftware-contrib@a2dcd77
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue Jan 14, 2023
Reference: #81

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue Jan 14, 2023
Using Cython 0.29.33

Cython-fix-by: Konrad Weihmann @priv-kweihmann
Reference: #81
Reference: a2dcd77
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@rnjudge
Copy link

rnjudge commented Jan 17, 2023

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants