nima / python-dmidecode

Python DMI-Decode
39 stars 27 forks source link

python-dmidecode fails to build with GCC 14 #56

Open glaubitz opened 6 months ago

glaubitz commented 6 months ago

Trying to build python-dmidecode with GCC 14 fails with:

[   18s] src/dmidecodemodule.c: In function ‘__dmidecode_xml_getsection’:
[   18s] src/dmidecodemodule.c:482:90: error: passing argument 3 of ‘_pyReturnError’ makes integer from pointer without a cast [-Wint-conversion]
[   18s]   482 |                         _pyReturnError(PyExc_RuntimeError, "Invalid type id '%s' -- %s", typeid, err);
[   18s]       |                                                                                          ^~~~~~
[   18s]       |                                                                                          |
[   18s]       |                                                                                          char *
[   18s] In file included from src/dmidecode.h:24,
[   18s]                  from src/dmidecodemodule.h:58,
[   18s]                  from src/dmidecodemodule.c:47:
[   18s] src/dmierror.h:38:65: note: expected ‘int’ but argument is of type ‘char *’
[   18s]    38 | void _pyReturnError(PyObject *exception, const char *fname, int line, const char *msgfmt, ...);
[   18s]       |                                                             ~~~~^~~~
[   18s] src/dmidecodemodule.c: In function ‘dmidecode_get_section’:
[   18s] src/dmidecodemodule.c:662:25: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
[   18s]   662 |                 section = PyUnicode_AsUTF8(args);
[   18s]       |                         ^
[   18s] src/dmidecodemodule.c: In function ‘dmidecode_set_dev’:
[   18s] src/dmidecodemodule.c:793:19: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
[   18s]   793 |                 f = PyUnicode_AsUTF8(arg);
[   18s]       |                   ^
[   18s] src/dmidecodemodule.c: In function ‘dmidecode_set_pythonxmlmap’:
[   18s] src/dmidecodemodule.c:841:23: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
[   18s]   841 |                 fname = PyUnicode_AsUTF8(arg);
[   18s]       |                       ^
[   18s] src/dmidecodemodule.c: At top level:
[   18s] src/dmidecodemodule.c:916:28: error: initialization of ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} from incompatible pointer type ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *, struct _object *)’} [-Wincompatible-pointer-types]
[   18s]   916 |         {(char *)"xmlapi", dmidecode_xmlapi, METH_VARARGS | METH_KEYWORDS,
[   18s]       |                            ^~~~~~~~~~~~~~~~
[   18s] src/dmidecodemodule.c:916:28: note: (near initialization for ‘DMIDataMethods[16].ml_meth’)
[   18s] src/dmidecodemodule.c: In function ‘PyInit_dmidecodemod’:
[   18s] src/dmidecodemodule.c:997:9: warning: ‘xmlXPathInit’ is deprecated [-Wdeprecated-declarations]
[   18s]   997 |         xmlXPathInit();
[   18s]       |         ^~~~~~~~~~~~
[   18s] In file included from src/libxml_wrap.h:41,
[   18s]                  from src/dmidecodemodule.c:45:
[   18s] /usr/include/libxml2/libxml/xpath.h:564:21: note: declared here
[   18s]   564 |                     xmlXPathInit                (void);
[   18s]       |                     ^~~~~~~~~~~~
[   18s] src/dmidecodemodule.c:1027:72: error: passing argument 3 of ‘PyCapsule_New’ from incompatible pointer type [-Wincompatible-pointer-types]
[   18s]  1027 |         PyModule_AddObject(module, "options", PyCapsule_New(opt, NULL, destruct_options));
[   18s]       |                                                                        ^~~~~~~~~~~~~~~~
[   18s]       |                                                                        |
[   18s]       |                                                                        void (*)(void *)
[   18s] In file included from /usr/include/python3.10/Python.h:102,
[   18s]                  from src/dmidecodemodule.c:42:
[   18s] /usr/include/python3.10/pycapsule.h:31:26: note: expected ‘PyCapsule_Destructor’ {aka ‘void (*)(struct _object *)’} but argument is of type ‘void (*)(void *)’
[   18s]    31 |     PyCapsule_Destructor destructor);
[   18s]       |     ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
[   18s] error: command '/usr/bin/gcc' failed with exit code 1
[   18s] make: *** [Makefile:62: python3.10-dmidecodemod.so] Error 1
sgzGary commented 2 months ago

Is there anyone who has a solution?