Skip to contentSkip to conversation

setools: fix build with Python 3.9

PATCH New Yi Zhao 1 participant 1 message Nov 10, 2020

lore
Share & tools
lore

Yi Zhao

author
#0 lore raw

PATCH 1/1 setools: fix build with Python 3.9

The Py_UNICODE_COPY, Py_UNICODE_FILL, PyUnicode_WSTR_LENGTH, PyUnicode_FromUnicode(), PyUnicode_AsUnicode(), _PyUnicode_AsUnicode, and PyUnicode_AsUnicodeAndSize() are marked as deprecated in Python 3.9. (See: https://docs.python.org/3/whatsnew/3.9.html). But the current python3-cython (0.29.21) hasn't adapt it yet.
Append '-Wno-deprecated-declarations' in CFLAGS as a workaround to fix the build issue.

Fixes:
In file included from /build/tmp-glibc/work/corei7-64-wrs-linux/setools/4.3.0-r0/recipe-sysroot/usr/include/python3.9/unicodeobject.h:1026,

    from /build/tmp-glibc/work/corei7-64-wrs-linux/setools/4.3.0-r0/recipe-sysroot/usr/include/python3.9/Python.h:97,
    from setools/policyrep.c:49:
/build/tmp-glibc/work/corei7-64-wrs-linux/setools/4.3.0-r0/recipe-sysroot/usr/include/python3.9/cpython/unicodeobject.h:446:26:
note: declared here
  446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~

setools/policyrep.c:97302:3: error: 'PyUnicode_AsUnicode' is deprecated [-Werror=deprecated-declarations]

---
 recipes-security/setools/setools_4.3.0.bb | 2 ++
 1 file changed, 2 insertions(+)
recipes-security/setools/setools_4.3.0.bb +2 -0
index 8fdeeb0..0f166c8 100644
@@ -30,6 +30,8 @@ RDEPENDS_${PN} += "python3-networkx python3-decorator python3-setuptools \
 
 RDEPENDS_${PN}_class-native = ""
 
+CFLAGS_append = " -Wno-deprecated-declarations"
+
 RPROVIDES_${PN} += "${PN}-console"
 
 inherit setuptools3
Signature · 1 line
2.17.1