From: Anthony Liguori <aliguori@us.ibm.com>
To: Travis Vachon <Travis.F.Vachon@williams.edu>
Cc: xen-devel@lists.xensource.com
Subject: Re: libxenstat python bindings
Date: Mon, 17 Oct 2005 11:40:03 -0500 [thread overview]
Message-ID: <4353D3E3.1030005@us.ibm.com> (raw)
In-Reply-To: <1129558244.18539.8.camel@localhost.localdomain>
Travis Vachon wrote:
>Hi
>
>I seem to be having a little trouble with libxenstat, and was wondering
>if the xenstat guys might be able to help.
>
>I've pulled the xen-unstable.hg tree and done a somewhat clean install
>(ie, post-make uninstall, as well as deleting the relevant libxenstat
>libraries).
>
>
You have to install libxenstat.so to use the python bindings.
libxenstat is not a supported interface for 3.0. It's in the tree for
xentop. It may play a larger role in future versions but for right now
it's function is pretty limited.
You may have better luck using the xc python bindings that are installed
with Xend. You can get the same information as you can get in
libxenstat just through a different interface.
In xen.lowlevel.xc, you want to use domain_get_info() and
domain_get_vcpu_info().
Regards,
Anthony Liguori
>Next, I entered the tools/xenstat/libxenstat directory and modified the
>Makefile so that the shared libraries would be installed. I've included
>my Makefile below.
>
>I ran:
>
>make
>make install
>make python-bindings
>make install-python-bindings
>
>
>Next, I started a python session and entered:
>
>import xenstat
>
>and got the following output.
>
>
>
>>Python 2.3.5 (#2, Sep 4 2005, 22:01:42)
>>[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
>>Type "help", "copyright", "credits" or "license" for more information.
>>
>>
>>>>>import xenstat
>>>>>
>>>>>
>>Traceback (most recent call last):
>> File "<stdin>", line 1, in ?
>> File "/usr/local/lib/python2.3/site-packages/xenstat.py", line 5, in ?
>> import _xenstat
>>ImportError: /usr/local/lib/python2.3/site-packages/_xenstat.so: undefined symbol: xenstat_init
>>
>>
>>
>
>Any thoughts?
>
>Thanks!
>
>Travis
>
>
>Makefile:
>
># libxenstat: statistics-collection library for Xen
># Copyright (C) International Business Machines Corp., 2005
># Author: Josh Triplett <josht@us.ibm.com>
>#
># This library is free software; you can redistribute it and/or
># modify it under the terms of the GNU Lesser General Public
># License as published by the Free Software Foundation; either
># version 2.1 of the License, or (at your option) any later version.
>#
># This library is distributed in the hope that it will be useful,
># but WITHOUT ANY WARRANTY; without even the implied warranty of
># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
># Lesser General Public License for more details.
>
>XEN_ROOT=../../..
>include $(XEN_ROOT)/tools/Rules.mk
>LINUX_ROOT := $(XEN_ROOT)/linux-2.6-xen-sparse
>
>INSTALL = install
>INSTALL_PROG = $(INSTALL) -m0755 -D
>INSTALL_DATA = $(INSTALL) -m0644 -D
>
>prefix=/usr/local
>includedir=$(prefix)/include
>libdir=$(prefix)/lib
>
>LDCONFIG=ldconfig
>MAKE_LINK=ln -sf
>
>MAJOR=0
>MINOR=0
>
>LIB=src/libxenstat.a
>SHLIB=src/libxenstat.so.$(MAJOR).$(MINOR)
>SHLIB_LINKS=src/libxenstat.so.$(MAJOR) src/libxenstat.so
>OBJECTS=src/xenstat.o src/xen-interface.o
>SONAME_FLAGS=-Wl,-soname -Wl,libxenstat.so.$(MAJOR)
>
>WARN_FLAGS=-Wall -Werror
>
>CFLAGS+=-Isrc -I$(XEN_LIBXC)
>LDFLAGS+=-Lsrc
>
>all: $(LIB) $(SHLIB)
>
>
>$(LIB): $(OBJECTS)
> $(AR) rc $@ $^
> $(RANLIB) $@
>
>$(SHLIB): $(OBJECTS)
> $(CC) $(LDFLAGS) $(SONAME_FLAGS) -shared -o $@ $(OBJECTS)
>
>src/xenstat.o: src/xenstat.c src/xenstat.h src/xen-interface.h
> $(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $<
>
>src/xen-interface.o: src/xen-interface.c src/xen-interface.h
> $(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $<
>
>src/libxenstat.so.$(MAJOR): $(LIB)
> $(MAKE_LINK) $(<F) $@
>
>src/libxenstat.so: src/libxenstat.so.$(MAJOR)
> $(MAKE_LINK) $(<F) $@
>
>install: all
> $(INSTALL_DATA) src/xenstat.h $(DESTDIR)$(includedir)/xenstat.h
> $(INSTALL_PROG) $(LIB) $(DESTDIR)$(libdir)/libxenstat.a
> $(INSTALL_PROG) $(SHLIB) \
> $(DESTDIR)$(libdir)/libxenstat.so.$(MAJOR).$(MINOR)
> $(MAKE_LINK) libxenstat.so.$(MAJOR).$(MINOR) \
> $(DESTDIR)$(libdir)/libxenstat.so.$(MAJOR)
> $(MAKE_LINK) libxenstat.so.$(MAJOR) \
> $(DESTDIR)$(libdir)/libxenstat.so
> -$(LDCONFIG)
>
>PYLIB=bindings/swig/python/_xenstat.so
>PYMOD=bindings/swig/python/xenstat.py
>PYSRC=bindings/swig/python/_xenstat.c
>PERLLIB=bindings/swig/perl/xenstat.so
>PERLMOD=bindings/swig/perl/xenstat.pm
>PERLSRC=bindings/swig/perl/xenstat.c
>BINDINGS=$(PYLIB) $(PYMOD) $(PERLLIB) $(PERLMOD)
>BINDINGSRC=$(PYSRC) $(PERLSRC)
>
># The all-bindings target builds all the language bindings
>all-bindings: perl-bindings python-bindings
>
># The install-bindings target installs all the language bindings
>install-bindings: install-perl-bindings install-python-bindings
>
>$(BINDINGS): $(SHLIB) $(SHLIB_LINKS) src/xenstat.h
>
>SWIG_FLAGS=-module xenstat -Isrc
>
># Python bindings
>PYTHON_VERSION=2.3
>PYTHON_FLAGS=-I/usr/include/python$(PYTHON_VERSION) -lpython$(PYTHON_VERSION)
>$(PYSRC) $(PYMOD): bindings/swig/xenstat.i
> swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $<
>
>$(PYLIB): $(PYSRC)
> $(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) -shared -lxenstat -o $@ $<
>
>python-bindings: $(PYLIB) $(PYMOD)
>
>pythonlibdir=$(prefix)/lib/python$(PYTHON_VERSION)/site-packages
>install-python-bindings: $(PYLIB) $(PYMOD)
> $(INSTALL_PROG) $(PYLIB) $(DESTDIR)$(pythonlibdir)/_xenstat.so
> $(INSTALL_PROG) $(PYMOD) $(DESTDIR)$(pythonlibdir)/xenstat.py
>
>ifeq ($(XENSTAT_PYTHON_BINDINGS),y)
>all: python-bindings
>install: install-python-bindings
>endif
>
># Perl bindings
>PERL_FLAGS=`perl -MConfig -e 'print "$$Config{ccflags} -I$$Config{archlib}/CORE";'`
>$(PERLSRC) $(PERLMOD): bindings/swig/xenstat.i
> swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<
>
>$(PERLLIB): $(PERLSRC)
> $(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) -shared -lxenstat -o $@ $<
>
>perl-bindings: $(PERLLIB) $(PERLMOD)
>
>perllibdir=$(prefix)/lib/perl5
>perlmoddir=$(prefix)/share/perl5
>install-perl-bindings: $(PERLLIB) $(PERLMOD)
> $(INSTALL_PROG) $(PERLLIB) $(DESTDIR)$(perllibdir)/xenstat.so
> $(INSTALL_PROG) $(PERLMOD) $(DESTDIR)$(perlmoddir)/xenstat.pm
>
>ifeq ($(XENSTAT_PERL_BINDINGS),y)
>all: perl-bindings
>install: install-perl-bindings
>endif
>
>clean:
> rm -f $(LIB) $(SHLIB) $(SHLIB_LINKS) $(OBJECTS) \
> $(BINDINGS) $(BINDINGSRC)
>
>
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel
>
>
>
next prev parent reply other threads:[~2005-10-17 16:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-17 14:10 libxenstat python bindings Travis Vachon
2005-10-17 16:40 ` Anthony Liguori [this message]
2005-10-17 21:37 ` Josh Triplett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4353D3E3.1030005@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=Travis.F.Vachon@williams.edu \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.