WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] libxenstat python bindings

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] libxenstat python bindings
From: Travis Vachon <Travis.F.Vachon@xxxxxxxxxxxx>
Date: Mon, 17 Oct 2005 10:10:44 -0400
Delivery-date: Mon, 17 Oct 2005 14:08:06 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Williams College
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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).

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@xxxxxxxxxx>
# 
# 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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>