xen fails to build with Python 3.11.0b1. /builddir/build/BUILD/xen-4.16.1/tools/python/setup.py:2: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.core import setup, Extension In file included from /usr/include/python3.11/unicodeobject.h:1042, from /usr/include/python3.11/Python.h:51, from xen/lowlevel/xc/xc.c:7: /usr/include/python3.11/cpython/unicodeobject.h: In function ‘_PyUnicode_NONCOMPACT_DATA’: /usr/include/python3.11/cpython/unicodeobject.h:330:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 330 | void *data = _PyUnicodeObject_CAST(op)->data.any; | ^~~~ /usr/include/python3.11/cpython/unicodeobject.h: In function ‘PyUnicode_READ_CHAR’: /usr/include/python3.11/cpython/unicodeobject.h:414:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 414 | unsigned int kind = PyUnicode_KIND(unicode); | ^~~~~~~~ /usr/include/python3.11/cpython/unicodeobject.h: In function ‘PyUnicode_MAX_CHAR_VALUE’: /usr/include/python3.11/cpython/unicodeobject.h:439:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 439 | unsigned int kind = PyUnicode_KIND(op); | ^~~~~~~~ In file included from /usr/include/python3.11/weakrefobject.h:35, from /usr/include/python3.11/Python.h:83: /usr/include/python3.11/cpython/weakrefobject.h: In function ‘PyWeakref_GET_OBJECT’: /usr/include/python3.11/cpython/weakrefobject.h:41:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 41 | PyWeakReference *ref = _Py_CAST(PyWeakReference*, ref_obj); | ^~~~~~~~~~~~~~~ In file included from /usr/include/python3.11/abstract.h:866, from /usr/include/python3.11/Python.h:100: /usr/include/python3.11/cpython/abstract.h: In function ‘PyObject_CallMethodOneArg’: /usr/include/python3.11/cpython/abstract.h:116:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 116 | size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET; | ^~~~~~ /usr/include/python3.11/cpython/abstract.h: In function ‘_PyObject_CallMethodIdOneArg’: /usr/include/python3.11/cpython/abstract.h:165:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] 165 | size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET; | ^~~~~~ cc1: all warnings being treated as errors error: command '/usr/bin/gcc' failed with exit code 1 https://docs.python.org/3.11/whatsnew/3.11.html For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/04392935-xen/ For all our attempts to build xen with Python 3.11, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/xen/ Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/ Let us know here if you have any questions. Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11. A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon. We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.
"Building Python now requires a C11 compiler without optional C11 features." https://docs.python.org/3.11/whatsnew/3.11.html#build-changes Building stuff that includes Python headers and erroring on C90 violations is probably not going to work. Victor, is a C11 compiler also required to build stuff that includes Python headers, or is this a regression?
On the Xen side, I don't get the rationale for using the -Werror=declaration-after-statement option: it makes sense for ISO C90, but the Xen Python extensions is built with -std=gnu99: request a C99 compiler. > Victor, is a C11 compiler also required to build stuff that includes Python headers, or is this a regression? The C11 compile requirement is to build Python itself. But the Python 3.11 C API should remain compatible with older C standards, like ISO C90. We can no longer be fully compatible with ISO C90, the Python C API declares static inline functions since Python 3.6, it requires ISO C99. But the Python C API can at least avoid mixing declarations and code. I created https://github.com/python/cpython/issues/92781 for that and I will work on a PR to address the issue.
Closing this in bulk as it built with Python 3.11. If this needs to remain open for a followup, feel free to reopen, I won't close in bulk again.