Fix python bindings for libxenstat
cover Fix python bindings for libxenstat
Hello.
I tried to build and use the python bindings for libxenstat.
Building worked, after I changed the hardcoded PYTHON_VERSION variable in the tools/xenstat/libxenstat/Makefile. Maybe the version detected by configure can be used here. The 1st patch tries to address this.
Then, when I tried to import the python module, the following error occurred:
Python 2.7.12 (default, Mar 31 2017, 19:45:03)
[GCC 4.9.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Quoted 1 line
Quoted 1 line
Quoted 1 line
import xenstat
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "xenstat.py", line 17, in <module>
_xenstat = swig_import_helper()
File "xenstat.py", line 16, in swig_import_helper
return importlib.import_module('_xenstat')
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: /usr/lib64/libxenstat.so.0: undefined symbol: yajl_tree_parse
Quoted 1 line
Quoted 1 line
Quoted 1 line
After some digging in the Makefiles I found, that the only current user of libxenstat, xentop, is linked against libyajl, but doesn't call any of the functions provided by the lib directly. OTOH libxenstat uses libyajl in xenstat_qmp.c, but isn't linked against it.
So my idea to fix the error above was to move the -lyajl from the xentop build to the libxenstat build, as seen in the 2nd patch.
With that patch, the bindings work without problems. But I'm not sure if my ideas are correct.
Regards
Peter
Peter Große (2):
libxenstat: use python detected by configure for python bindings tools/xenstat: fix missing linkage of libxenstat against libyajl
tools/xenstat/libxenstat/Makefile | 4 ++-- tools/xenstat/xentop/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 7 lines
2.13.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 1/2 libxenstat: use python detected by configure for python bindings
--- tools/xenstat/libxenstat/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/xenstat/libxenstat/Makefile +1 -1
@@ -102,7 +102,7 @@ $(BINDINGS): $(SHLIB) $(SHLIB_LINKS) src/xenstat.h SWIG_FLAGS=-module xenstat -Isrc # Python bindings -PYTHON_VERSION=2.3 +PYTHON_VERSION=$(PYTHON:python%=%) PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION) -lpython$(PYTHON_VERSION) $(PYMOD): $(PYSRC) $(PYSRC): bindings/swig/xenstat.i
Signature · 7 lines
2.13.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/2 tools/xenstat: fix missing linkage of libxenstat against libyajl
In reply to Peter GroßeThis fixes the python bindings, since symbols were missing in libxenstat. xentop doesn't use any yajl functions, so drop linking libyajl.
--- tools/xenstat/libxenstat/Makefile | 2 +- tools/xenstat/xentop/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/xenstat/libxenstat/Makefile +1 -1
@@ -34,7 +34,7 @@ SONAME_FLAGS=-Wl,$(SONAME_LDFLAG) -Wl,libxenstat.so.$(MAJOR) CFLAGS+=-fPIC CFLAGS+=-Isrc $(CFLAGS_libxenctrl) $(CFLAGS_libxenstore) $(CFLAGS_xeninclude) -include $(XEN_ROOT)/tools/config.h -LDLIBS-y = $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) +LDLIBS-y = $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) -lyajl LDLIBS-$(CONFIG_SunOS) += -lkstat PKG_CONFIG := xenstat.pc
tools/xenstat/xentop/Makefile +1 -1
@@ -19,7 +19,7 @@ all install xentop: else CFLAGS += -DGCC_PRINTF -Werror $(CFLAGS_libxenstat) -LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(TINFO_LIBS) $(SOCKET_LIBS) -lm -lyajl +LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(TINFO_LIBS) $(SOCKET_LIBS) -lm CFLAGS += -DHOST_$(XEN_OS) # Include configure output (config.h)
Signature · 7 lines
2.13.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 38 lines · Peter Große
Hello.
I tried to build and use the python bindings for libxenstat.
Building worked, after I changed the hardcoded
PYTHON_VERSIONvariable in thetools/xenstat/libxenstat/Makefile. Maybe the version detected by configure can be used here. The 1st patch tries to address this.Then, when I tried to import the python module, the following error occurred:
Python 2.7.12 (default, Mar 31 2017, 19:45:03)
[GCC 4.9.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.Quoted 1 line
Quoted 1 line
Quoted 1 line
import xenstat
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "xenstat.py", line 17, in <module>
_xenstat=swig_import_helper()
File "xenstat.py", line 16, inswig_import_helper
returnimportlib.import_module('_xenstat')
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, inimport_module__import__(name)ImportError:
/usr/lib64/libxenstat.so.0: undefined symbol:yajl_tree_parseQuoted 1 line
Quoted 1 line
Quoted 1 line
After some digging in the Makefiles I found, that the only current user of libxenstat, xentop, is linked against libyajl, but doesn't call any of the functions provided by the lib directly. OTOH libxenstat uses libyajl in
xenstat_qmp.c, but isn't linked against it.So my idea to fix the error above was to move the -lyajl from the xentop build to the libxenstat build, as seen in the 2nd patch.
With that patch, the bindings work without problems. But I'm not sure if my ideas are correct.
Regards
Peter
Quoted 8 lines
Peter Große (2):
libxenstat: use python detected by configure for python bindingstools/xenstat: fix missing linkage of libxenstat against libyajltools/xenstat/libxenstat/Makefile | 4 ++-- tools/xenstat/xentop/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Both patches:
Julien, I think they could be included for 4.9.
Quoted 3 lines
Signature · 1 line
2.13.0
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Wei,
Quoted 48 lines · Wei Liu
Quoted 38 lines · Peter Große
Hello.
I tried to build and use the python bindings for libxenstat.
Building worked, after I changed the hardcoded
PYTHON_VERSIONvariable in thetools/xenstat/libxenstat/Makefile. Maybe the version detected by configure can be used here. The 1st patch tries to address this.Then, when I tried to import the python module, the following error occurred:
Python 2.7.12 (default, Mar 31 2017, 19:45:03)
[GCC 4.9.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.Quoted 1 line
Quoted 1 line
Quoted 1 line
import xenstat
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "xenstat.py", line 17, in <module>
_xenstat=swig_import_helper()
File "xenstat.py", line 16, inswig_import_helper
returnimportlib.import_module('_xenstat')
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, inimport_module__import__(name)ImportError:
/usr/lib64/libxenstat.so.0: undefined symbol:yajl_tree_parseQuoted 1 line
Quoted 1 line
Quoted 1 line
After some digging in the Makefiles I found, that the only current user of libxenstat, xentop, is linked against libyajl, but doesn't call any of the functions provided by the lib directly. OTOH libxenstat uses libyajl in
xenstat_qmp.c, but isn't linked against it.So my idea to fix the error above was to move the -lyajl from the xentop build to the libxenstat build, as seen in the 2nd patch.
With that patch, the bindings work without problems. But I'm not sure if my ideas are correct.
Regards
PeterQuoted 8 lines
Peter Große (2):
libxenstat: use python detected by configure for python bindingstools/xenstat: fix missing linkage of libxenstat against libyajltools/xenstat/libxenstat/Makefile | 4 ++-- tools/xenstat/xentop/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Quoted 5 lines
Both patches:
Acked-by Wei Liu <[email protected]>Julien, I think they could be included for 4.9.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel