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

Fail to compile C extension with GCC14 #351

Open
oerc0122 opened this issue Dec 18, 2024 · 0 comments
Open

Fail to compile C extension with GCC14 #351

oerc0122 opened this issue Dec 18, 2024 · 0 comments

Comments

@oerc0122
Copy link
Collaborator

oerc0122 commented Dec 18, 2024

GCC14 now treats incompatible-pointer-types as error (c.f. https://gcc.gnu.org/gcc-14/porting_to.html), this leads to the C extensions failing:

Error log
  [1/6] Compiling C object _euphonic.cpython-310-x86_64-linux-gnu.so.p/c__euphonic.c.o
  FAILED: _euphonic.cpython-310-x86_64-linux-gnu.so.p/c__euphonic.c.o
  gcc -I_euphonic.cpython-310-x86_64-linux-gnu.so.p -I. -I.. -I/home/jacob/.pyenv/versions/3.10.14/include/python3.10 -I/tmp/pip-build-env-9vc2kyi_/overlay/lib/python3.10/site-packages/numpy/_core/include -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -fPIC -fopenmp -MD -MQ _euphonic.cpython-310-x86_64-linux-gnu.so.p/c__euphonic.c.o -MF _euphonic.cpython-310-x86_64-linux-gnu.so.p/c__euphonic.c.o.d -o_euphonic.cpython-310-x86_64-linux-gnu.so.p/c__euphonic.c.o -c ../c/_euphonic.c
  ../c/_euphonic.c: In function ‘calculate_phonons’:
  ../c/_euphonic.c:129:51: error: passing argument 3 of ‘attr_from_pyobj’ from incompatible pointer type [-Wincompatible-pointer-types]
    129 |         attr_from_pyobj(py_idata, "_n_sc_images", &py_n_sc_ims) ||
        |                                                   ^~~~~~~~~~~~
        |                                                   |
        |                                                   PyArrayObject ** {aka struct tagPyArrayObject **}
  In file included from ../c/_euphonic.c:11:
  ../c/py_util.h:6:70: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyArrayObject **’ {aka ‘struct tagPyArrayObject **’}
      6 | int attr_from_pyobj(PyObject *obj, const char *attr_name, PyObject **result);
        |                                                           ~~~~~~~~~~~^~~~~~
  ../c/_euphonic.c:130:50: error: passing argument 3 of ‘attr_from_pyobj’ from incompatible pointer type [-Wincompatible-pointer-types]
    130 |         attr_from_pyobj(py_idata, "_sc_image_i", &py_sc_im_idx) ||
        |                                                  ^~~~~~~~~~~~~
        |                                                  |
        |                                                  PyArrayObject ** {aka struct tagPyArrayObject **}
  ../c/py_util.h:6:70: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyArrayObject **’ {aka ‘struct tagPyArrayObject **’}
      6 | int attr_from_pyobj(PyObject *obj, const char *attr_name, PyObject **result);
        |                                                           ~~~~~~~~~~~^~~~~~
  ../c/_euphonic.c:131:51: error: passing argument 3 of ‘attr_from_pyobj’ from incompatible pointer type [-Wincompatible-pointer-types]
    131 |         attr_from_pyobj(py_idata, "cell_origins", &py_cell_ogs)) {
        |                                                   ^~~~~~~~~~~~
        |                                                   |
        |                                                   PyArrayObject ** {aka struct tagPyArrayObject **}
  ../c/py_util.h:6:70: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyArrayObject **’ {aka ‘struct tagPyArrayObject **’}
      6 | int attr_from_pyobj(PyObject *obj, const char *attr_name, PyObject **result);
        |                                                           ~~~~~~~~~~~^~~~~~
  ../c/_euphonic.c:137:60: error: passing argument 3 of ‘attr_from_pyobj’ from incompatible pointer type [-Wincompatible-pointer-types]
    137 |         if (attr_from_pyobj(py_idata, "_dipole_init_data", &py_dipole_init_data)) {
        |                                                            ^~~~~~~~~~~~~~~~~~~~
        |                                                            |
        |                                                            PyDictObject **
  ../c/py_util.h:6:70: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyDictObject **’
      6 | int attr_from_pyobj(PyObject *obj, const char *attr_name, PyObject **result);
        |                                                           ~~~~~~~~~~~^~~~~~
  ../c/_euphonic.c:142:48: error: passing argument 3 of ‘attr_from_pyobj’ from incompatible pointer type [-Wincompatible-pointer-types]
    142 |         if (attr_from_pyobj(py_idata, "_born", &py_born) ||
        |                                                ^~~~~~~~
        |                                                |
        |                                                PyArrayObject ** {aka struct tagPyArrayObject **}
  ../c/py_util.h:6:70: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyArrayObject **’ {aka ‘struct tagPyArrayObject **’}
      6 | int attr_from_pyobj(PyObject *obj, const char *attr_name, PyObject **result);
        |                                                           ~~~~~~~~~~~^~~~~~
  ../c/_euphonic.c:143:54: error: passing argument 3 of ‘attr_from_pyobj’ from incompatible pointer type [-Wincompatible-pointer-types]
    143 |             attr_from_pyobj(py_idata, "_dielectric", &py_dielectric) ||
        |                                                      ^~~~~~~~~~~~~~
        |                                                      |
        |                                                      PyArrayObject ** {aka struct tagPyArrayObject **}
  ../c/py_util.h:6:70: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyArrayObject **’ {aka ‘struct tagPyArrayObject **’}
      6 | int attr_from_pyobj(PyObject *obj, const char *attr_name, PyObject **result);
        |                                                           ~~~~~~~~~~~^~~~~~
  ../c/_euphonic.c:145:58: error: passing argument 3 of ‘val_from_pydict’ from incompatible pointer type [-Wincompatible-pointer-types]
    145 |             val_from_pydict(py_dipole_init_data, "H_ab", &py_H_ab) ||
        |                                                          ^~~~~~~~
        |                                                          |
        |                                                          PyArrayObject ** {aka struct tagPyArrayObject **}
  ../c/py_util.h:4:69: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyArrayObject **’ {aka ‘struct tagPyArrayObject **’}
      4 | int val_from_pydict(PyDictObject *dict, const char *key, PyObject **result);
        |                                                          ~~~~~~~~~~~^~~~~~
  ../c/_euphonic.c:146:59: error: passing argument 3 of ‘val_from_pydict’ from incompatible pointer type [-Wincompatible-pointer-types]
    146 |             val_from_pydict(py_dipole_init_data, "cells", &py_dipole_cells) ||
        |                                                           ^~~~~~~~~~~~~~~~
        |                                                           |
        |                                                           PyArrayObject ** {aka struct tagPyArrayObject **}
  ../c/py_util.h:4:69: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyArrayObject **’ {aka ‘struct tagPyArrayObject **’}
      4 | int val_from_pydict(PyDictObject *dict, const char *key, PyObject **result);
        |                                                          ~~~~~~~~~~~^~~~~~
  ../c/_euphonic.c:147:65: error: passing argument 3 of ‘val_from_pydict’ from incompatible pointer type [-Wincompatible-pointer-types]
    147 |             val_from_pydict(py_dipole_init_data, "gvec_phases", &py_gvec_phases) ||
        |                                                                 ^~~~~~~~~~~~~~~
        |                                                                 |
        |                                                                 PyArrayObject ** {aka struct tagPyArrayObject **}
  ../c/py_util.h:4:69: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyArrayObject **’ {aka ‘struct tagPyArrayObject **’}
      4 | int val_from_pydict(PyDictObject *dict, const char *key, PyObject **result);
        |                                                          ~~~~~~~~~~~^~~~~~
  ../c/_euphonic.c:148:64: error: passing argument 3 of ‘val_from_pydict’ from incompatible pointer type [-Wincompatible-pointer-types]
    148 |             val_from_pydict(py_dipole_init_data, "gvecs_cart", &py_gvecs_cart) ||
        |                                                                ^~~~~~~~~~~~~~
        |                                                                |
        |                                                                PyArrayObject ** {aka struct tagPyArrayObject **}
  ../c/py_util.h:4:69: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyArrayObject **’ {aka ‘struct tagPyArrayObject **’}
      4 | int val_from_pydict(PyDictObject *dict, const char *key, PyObject **result);
        |                                                          ~~~~~~~~~~~^~~~~~
  ../c/_euphonic.c:149:63: error: passing argument 3 of ‘val_from_pydict’ from incompatible pointer type [-Wincompatible-pointer-types]
    149 |             val_from_pydict(py_dipole_init_data, "dipole_q0", &py_dipole_q0)) {
        |                                                               ^~~~~~~~~~~~~
        |                                                               |
        |                                                               PyArrayObject ** {aka struct tagPyArrayObject **}
  ../c/py_util.h:4:69: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyArrayObject **’ {aka ‘struct tagPyArrayObject **’}
      4 | int val_from_pydict(PyDictObject *dict, const char *key, PyObject **result);
        |                                                          ~~~~~~~~~~~^~~~~~
  ../c/_euphonic.c:157:47: error: passing argument 3 of ‘attr_from_pyobj’ from incompatible pointer type [-Wincompatible-pointer-types]
    157 |         attr_from_pyobj(py_crystal, "atom_r", &py_atom_r)) {
        |                                               ^~~~~~~~~~
        |                                               |
        |                                               PyArrayObject ** {aka struct tagPyArrayObject **}
  ../c/py_util.h:6:70: note: expected ‘PyObject **’ {aka ‘struct _object **’} but argument is of type ‘PyArrayObject **’ {aka ‘struct tagPyArrayObject **’}
      6 | int attr_from_pyobj(PyObject *obj, const char *attr_name, PyObject **result);
        |                                                           ~~~~~~~~~~~^~~~~~
  [2/6] Compiling C object _euphonic.cpython-310-x86_64-linux-gnu.so.p/c_util.c.o
  [3/6] Compiling C object _euphonic.cpython-310-x86_64-linux-gnu.so.p/c_load_libs.c.o
  [4/6] Compiling C object _euphonic.cpython-310-x86_64-linux-gnu.so.p/c_py_util.c.o
  FAILED: _euphonic.cpython-310-x86_64-linux-gnu.so.p/c_py_util.c.o
  gcc -I_euphonic.cpython-310-x86_64-linux-gnu.so.p -I. -I.. -I/home/jacob/.pyenv/versions/3.10.14/include/python3.10 -I/tmp/pip-build-env-9vc2kyi_/overlay/lib/python3.10/site-packages/numpy/_core/include -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -fPIC -fopenmp -MD -MQ _euphonic.cpython-310-x86_64-linux-gnu.so.p/c_py_util.c.o -MF _euphonic.cpython-310-x86_64-linux-gnu.so.p/c_py_util.c.o.d -o _euphonic.cpython-310-x86_64-linux-gnu.so.p/c_py_util.c.o -c ../c/py_util.c
  ../c/py_util.c: In function ‘val_from_pydict’:
  ../c/py_util.c:11:42: error: passing argument 1 of ‘PyDict_GetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]
     11 |     PyObject *tmp = PyDict_GetItemString(dict, key);
        |                                          ^~~~
        |                                          |
        |                                          PyDictObject *
  In file included from /home/jacob/.pyenv/versions/3.10.14/include/python3.10/Python.h:93,
                   from ../c/py_util.c:4:
  /home/jacob/.pyenv/versions/3.10.14/include/python3.10/dictobject.h:57:55: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of type ‘PyDictObject *’
     57 | PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
        |                                             ~~~~~~~~~~^~
  [5/6] Compiling C object _euphonic.cpython-310-x86_64-linux-gnu.so.p/c_dyn_mat.c.o
  ninja: build stopped: subcommand failed.
  [end of output]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant