Skip to content

Py_GetConstant compatibility breaking numpy build #89

Closed
@tacaswell

Description

@tacaswell

Which looks like a collaboration of python/cpython#116883 and #87

FAILED: numpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p/meson-generated_scalartypes.c.o
ccache cc -Inumpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p -Inumpy/_core -I../numpy/_core -Inumpy/_core/include -I../numpy/_core/include -I../numpy/_core/src/common -I../numpy/_core/src/multiarray -I../numpy/_core/src/npymath -I../numpy/_core/src/umath -I/opt/intel/oneapi/mkl/latest/include -I/home/tcaswell/.pybuild/py313/include/python3.13 -I/tmp/build-via-sdist-qfvwz43e/numpy-2.1.0.dev0/.mesonpy-jctwrujm/meson_cpu -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -std=c11 -O3 -fno-strict-aliasing -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 -DNPY_HAVE_SSE2 -DNPY_HAVE_SSE -DNPY_HAVE_SSE3 -DNPY_HAVE_SSSE3 -DNPY_HAVE_SSE41 -DNPY_HAVE_POPCNT -DNPY_HAVE_SSE42 -DNPY_HAVE_AVX -DNPY_HAVE_F16C -DNPY_HAVE_FMA3 -DNPY_HAVE_AVX2 -Wall -O2 -pipe -fomit-frame-pointer -fno-strict-aliasing -Wmaybe-uninitialized -Wdeprecated-declarations -Wimplicit-function-declaration -march=native -DCYTHON_FAST_THREAD_STATE=0 -fPIC -DHAVE_CBLAS -DNPY_INTERNAL_BUILD -DHAVE_NPY_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -MD -MQ numpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p/meson-generated_scalartypes.c.o -MF numpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p/meson-generated_scalartypes.c.o.d -o numpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p/meson-generated_scalartypes.c.o -c numpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p/scalartypes.c
In file included from ../numpy/_core/src/common/npy_pycompat.h:5,
                 from ../numpy/_core/src/multiarray/scalartypes.c.src:16:
../numpy/_core/src/common/pythoncapi-compat/pythoncapi_compat.h:1227:25: error: static declaration of ‘Py_GetConstant’ follows non-static declaration
 1227 | static inline PyObject* Py_GetConstant(unsigned int constant_id)
      |                         ^~~~~~~~~~~~~~
In file included from /home/tcaswell/.pybuild/py313/include/python3.13/Python.h:58,
                 from ../numpy/_core/src/multiarray/scalartypes.c.src:3:
/home/tcaswell/.pybuild/py313/include/python3.13/object.h:1088:23: note: previous declaration of ‘Py_GetConstant’ with type ‘PyObject *(unsigned int)’ {aka ‘struct _object *(unsigned int)’}
 1088 | PyAPI_FUNC(PyObject*) Py_GetConstant(unsigned int constant_id);
      |                       ^~~~~~~~~~~~~~
../numpy/_core/src/common/pythoncapi-compat/pythoncapi_compat.h:1280:25: error: static declaration of ‘Py_GetConstantBorrowed’ follows non-static declaration
 1280 | static inline PyObject* Py_GetConstantBorrowed(unsigned int constant_id)
      |                         ^~~~~~~~~~~~~~~~~~~~~~
/home/tcaswell/.pybuild/py313/include/python3.13/object.h:1089:23: note: previous declaration of ‘Py_GetConstantBorrowed’ with type ‘PyObject *(unsigned int)’ {aka ‘struct _object *(unsigned int)’}
 1089 | PyAPI_FUNC(PyObject*) Py_GetConstantBorrowed(unsigned int constant_id);
      |                       ^~~~~~~~~~~~~~~~~~~~~~
[209/412] C

but I have not any debugging other than to try building with 5a76d1be8ef371b75ca65166726923c249b5f615 (with c4bf58a14f162557038a1535ca22c52b49d81d7b cherry-picked on) for CPython (which worked) and pushing the numpy's submodule of this repo back one commit (which worked).

It does not appear that numpy otherwise uses these symbols, but I have not tracked down if this is a "numpy is using it wrong" problem or this project is confliting with cpython problem.

attn @rgommers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions