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-dmidecode fails to build with GCC 14 #56

Open
glaubitz opened this issue May 28, 2024 · 1 comment · May be fixed by #59
Open

python-dmidecode fails to build with GCC 14 #56

glaubitz opened this issue May 28, 2024 · 1 comment · May be fixed by #59

Comments

@glaubitz
Copy link

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

sgzGary commented Sep 18, 2024

Is there anyone who has a solution?

danigm added a commit to danigm/python-dmidecode that referenced this issue Oct 22, 2024
This patch fixes some type casting that are errors by default in gcc14
and greater.

Fix nima#56
@danigm danigm linked a pull request Oct 22, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants