[Libvir] Re: libvirt on mingw

Brecht Sanders wrote:
Hello again, Note that I am using gcc (mingw) 3.4.5, and not 4 as you recommend. The attached patch got rid of the warnings though. Maybe there is a compiler switch to fix it in a cleaner way though. Anyway, with the attached patch it does compile. Basically it casts to void* before converting to a different type. Regards
Yes thanks, that patch does indeed fix it. I'll apply it and release a new version shortly. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903

Richard W.M. Jones wrote:
Brecht Sanders wrote:
Hello again, Note that I am using gcc (mingw) 3.4.5, and not 4 as you recommend. The attached patch got rid of the warnings though. Maybe there is a compiler switch to fix it in a cleaner way though. Anyway, with the attached patch it does compile. Basically it casts to void* before converting to a different type. Regards
Yes thanks, that patch does indeed fix it. I'll apply it and release a new version shortly.
OK, PortableXDR version 4.0.8 contains your fix + I also fixed the Makefile so it actually builds a DLL again under MinGW: http://et.redhat.com/~rjones/portablexdr/ Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903

Hi Richard, I have finally compiled a libvirt Python module. Attached are the files that need to go into <python 2.4 home>lib/site-packages, in case you want to try this. But it looks like there is still some way to go. So many other Python dependancies are required for virt-manager to run. One of them is dbus. I tried using the command line parameter --no-dbus but even then it still dbus is still imported. So it looks like this needs some "if not options.nodbus" line here and there. Is there a list anywhere specifiying which (Python) dependancies are required? Regards Brecht

Brecht Sanders wrote:
Hi Richard, I have finally compiled a libvirt Python module. Attached are the files that need to go into <python 2.4 home>lib/site-packages, in case you want to try this.
How did you build _libvirtmod though? Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903

Aha, the big question. So far I only have loose notes, but basically it comes down to the instructions below. I used SWIG (http://www.swig.org/) to build the DLL of the Python module. My setup had Python 2.4 installed in C:\Prog\Python24. Of course the required C dependancies where also already met on my system (including libxen). I have quite some experience in porting *nix stuff to Windows/win32 using MinGW/MSYS, but Python was new to me. Nevertheless it took my days (well, nights mostly) to get this result, but the instructions below aren't too long. So I believe it shouldn't require that many changes to sources and autoconf/automake stuff to incorporate the MinGW/MSYS port. I'm afraid there is still some work ahead meeting all the Python dependancies. If we're lucky they will exist for Windows. Otherwise they will need porting too (hopefully easier than libvirt). Here goes: wget -c http://downloads.sourceforge.net/swig/swigwin-1.3.33.zip unzip -oqj swigwin-1.3.33.zip -d /C/Prog/Python24 swigwin-1.3.33/swig.exe wget -c http://libvirt.org/sources/libvirt-cvs-snapshot.tar.gz tar xfz libvirt-cvs-snapshot.tar.gz cd libvirt-0.4.0 mkdir linux touch linux/param.h mv src/internal.h src/internal.h.bak echo "#include <pthread.h>" > src/internal.h sed -e 's/^\(#define VIR_DEBUG(.*) *\)$/\1 \\/' src/internal.h.bak >> src/internal.h mv qemud/remote_protocol.c qemud/remote_protocol.c.bak echo "#include <winsock2.h>" > qemud/remote_protocol.c cat qemud/remote_protocol.c.bak >> qemud/remote_protocol.c mv configure configure.bak sed -e "s?/include/python\${PYTHON_VERSION}?/include?; s?/lib/python\${PYTHON_VERSION}/site-packages?$/Lib/site-packages?; s?-lpython\\\${PYTHON_VERSION}?-lpython\`echo \\\$PYTHON_VERSION|sed -e 's/\\\.//'\`?" configure.bak > configure ./configure --prefix=$INSTALLPREFIX --disable-rpath --enable-debug=no --enable-compile-warnings=minimum --with-xen --without-xen-proxy --without-qemu --without-openvz --without-test --without-libvirtd --without-remote --with-init-scripts=none --with-depends --without-sasl --without-polkit --with-python=/C/Prog/Python24/python.exe PYTHON=/C/Prog/Python24/python.exe PYTHON_INCLUDES="/C/Prog/Python24/include" CFLAGS="-Drestrict=__restrict -DWSAAPI=" LDFLAGS="-no-undefined -lportablexdr -lwsock32 -lintl" # don't build tests mv tests/Makefile tests/Makefile.bak cat > tests/Makefile << EOF all: install: EOF make install cd python mv Makefile Makefile.bak sed -e "s?^\(PYTHON_INCLUDES *= *.*\)?\1/C/Prog/Python24/include?; s?^\(PYTHON_SITE_PACKAGES *= *.*\)?\1/C/Prog/Python24/Lib/site-packages?" Makefile.bak > Makefile /C/Prog/Python24/python.exe generator.py make libvirtmod_la-libvir.lo libvirtmod_la-types.lo libvirtmod_la-libvirt-py.lo # use SWIG to create Python wrapper cat > libvirtmod.i << EOF %module libvirtmod %{ #include "../include/libvirt/libvirt.h" %} EOF sed -e "s/^\(.*libvirt.*\)$/extern \1/" libvirt-py.h >> libvirtmod.i ../../swigwin-1.3.33/swig -python -I../../swigwin-1.3.33/Lib -I../../swigwin-1.3.33/Lib/python/ libvirtmod.i gcc -shared libvirtmod_wrap.c libvirtmod_la-libvir.o libvirtmod_la-types.o libvirtmod_la-libvirt-py.o -lportablexdr -lws2_32 -I/C/Prog/Python24/include -L/C/Prog/Python24/libs -lpython24 -L../src/.libs/ -lvirt -Wl,--export-all-symbols -o _libvirtmod.dll # test it /C/Prog/Python24/python.exe -c "import libvirt" cp libvirt.py libvirtmod.py _libvirtmod.dll /C/Prog/Python24/Lib/site-packages Richard W.M. Jones wrote:
Brecht Sanders wrote:
Hi Richard, I have finally compiled a libvirt Python module. Attached are the files that need to go into <python 2.4 home>lib/site-packages, in case you want to try this.
How did you build _libvirtmod though?
Rich.
participants (2)
-
Brecht Sanders
-
Richard W.M. Jones