Skip to contentSkip to conversation

issues with Python 3.8

PATCH YOUNG, MICHAEL A. 1 participant 1 message Jun 3, 2019 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

Fedora rawhide is about to to update to Python 3.8 (in beta I think) and there are two issues with compiling xen with it (see
https://bugzilla.redhat.com/show_bug.cgi?id=1704807 ).

It seems that in 3.8 python3-config --libs no longer includes -lpython3.8 by default which causes tools/configure to fail. You can get -lpython3.8 back by adding --embed , but this option isn't recognized in earlier versions of python.

It also seems python 3.8 adds the options -Wno-unused-result -Wsign-compare to the compilations in tools/python (though I am not sure how this happens) and -Wsign-compare gives some build warnings which the Fedora build treats as errors.

I have attached the patch I used to get xen-4.12.0 to build with python 3.8 and also the build warnings it fixes in case they are useful.

Michael Young

m4/python_devel.m4 renamed from m4/python_devel.m4.orig +2 -1
@@ -24,7 +24,8 @@
     dnl If python-config is found use it
     CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
     LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
-    LIBS="$LIBS `$PYTHON-config --libs`"
+    LIBSTMP="`$PYTHON-config --libs --embed`" || LIBSTMP="`$PYTHON-config --libs`"
+    LIBS="$LIBS $LIBSTMP"
 ])
 
 AC_CHECK_HEADER([Python.h], [],
tools/configure renamed from tools/configure.orig +2 -1
@@ -7482,7 +7482,8 @@
 
         CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
     LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
-    LIBS="$LIBS `$PYTHON-config --libs`"
+    LIBSTMP="`$PYTHON-config --libs --embed`" || LIBSTMP="`$PYTHON-config --libs`"
+    LIBS="$LIBS $LIBSTMP"
 
 fi
 
tools/python/xen/lowlevel/xc/xc.c renamed from tools/python/xen/lowlevel/xc/xc.c.orig +8 -5
@@ -118,7 +118,8 @@
                                     PyObject *kwds)
 {
     uint32_t dom = 0, target = 0;
-    int      ret, i;
+    int      ret;
+    unsigned int i;
     PyObject *pyhandle = NULL;
     struct xen_domctl_createdomain config = {
         .handle = {
@@ -296,7 +297,7 @@
 
 static PyObject *pyxc_domain_sethandle(XcObject *self, PyObject *args)
 {
-    int i;
+    unsigned int i;
     uint32_t dom;
     PyObject *pyhandle;
     xen_domain_handle_t handle;
@@ -337,7 +338,8 @@
     PyObject *list, *info_dict, *pyhandle;
 
     uint32_t first_dom = 0;
-    int max_doms = 1024, nr_doms, i, j;
+    int max_doms = 1024, nr_doms, i;
+    unsigned int j;
     xc_dominfo_t *info;
 
     static char *kwd_list[] = { "first_dom", "max_doms", NULL };
@@ -632,7 +634,8 @@
 {
     uint32_t sbdf;
     uint32_t max_sdevs, num_sdevs;
-    int domid, seg, bus, dev, func, rc, i;
+    int domid, seg, bus, dev, func, rc;
+    unsigned int i;
     PyObject *Pystr;
     char *group_str;
     char dev_str[9];
@@ -972,7 +975,7 @@
 {
     xc_physinfo_t pinfo;
     char cpu_cap[128], virt_caps[128], *p;
-    int i;
+    unsigned int i;
     const char *virtcap_names[] = { "hvm", "hvm_directio" };
 
     if ( xc_physinfo(self->xc_handle, &pinfo) != 0 )
tools/python/xen/lowlevel/xs/xs.c renamed from tools/python/xen/lowlevel/xs/xs.c.orig +2 -2
@@ -186,7 +186,7 @@
     Py_END_ALLOW_THREADS
 
     if (xsval) {
-        int i;
+        unsigned int i;
         PyObject *val = PyList_New(xsval_n);
         for (i = 0; i < xsval_n; i++)
 #if PY_MAJOR_VERSION >= 3
@@ -276,7 +276,7 @@
     struct xs_handle *xh = xshandle(self);
     struct xs_permissions *perms;
     unsigned int perms_n = 0;
-    int i;
+    unsigned int i;
 
     xs_transaction_t th;
     char *thstr;
BUILDSTDERR: xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_create’:
BUILDSTDERR: xen/lowlevel/xc/xc.c:148:24: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
BUILDSTDERR:          for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
BUILDSTDERR:                         ^
BUILDSTDERR: xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_sethandle’:
BUILDSTDERR: xen/lowlevel/xc/xc.c:313:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
BUILDSTDERR:      for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
BUILDSTDERR:                     ^
BUILDSTDERR: xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_getinfo’:
BUILDSTDERR: xen/lowlevel/xc/xc.c:392:24: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
BUILDSTDERR:          for ( j = 0; j < sizeof(xen_domain_handle_t); j++ )
BUILDSTDERR:                         ^
BUILDSTDERR: xen/lowlevel/xc/xc.c: In function ‘pyxc_get_device_group’:
BUILDSTDERR: xen/lowlevel/xc/xc.c:678:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
BUILDSTDERR:      for ( i = 0; i < num_sdevs; i++ )
BUILDSTDERR:                     ^
BUILDSTDERR: xen/lowlevel/xc/xc.c: In function ‘pyxc_physinfo’:
BUILDSTDERR: xen/lowlevel/xc/xc.c:983:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
BUILDSTDERR:      for ( i = 0; i < sizeof(pinfo.hw_cap)/4; i++ )
BUILDSTDERR:                     ^
BUILDSTDERR: xen/lowlevel/xs/xs.c: In function ‘xspy_ls’:
BUILDSTDERR: xen/lowlevel/xs/xs.c:191:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
BUILDSTDERR:          for (i = 0; i < xsval_n; i++)
BUILDSTDERR:                        ^
BUILDSTDERR: xen/lowlevel/xs/xs.c: In function ‘xspy_get_permissions’:
BUILDSTDERR: xen/lowlevel/xs/xs.c:297:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
BUILDSTDERR:          for (i = 0; i < perms_n; i++) {
BUILDSTDERR:                        ^

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel