Re: [Libvir] MinGW patch
Hi, Rich I have 2 questions about MinGW fixes. (It has already committed, sorry for delaying) 1)src/storage_driver.c patch I think storage_driver.c is not compiled on MinGW. So It should remove HAVE_PWD_H in src/storage_driver.c http://git.et.redhat.com/?p=libvirt.git;a=blobdiff;f=src/storage_driver.c;h=7f1ce0cdc99041ca6fa2ea84aaa9dc5f7764083d;hp=d0e38f66d3051fc2765a67ba932c3b11b2eafdaf;hb=ed8ae56bdc5e5e04ddca6a8839c53b3323783a8f;hpb=26dbf951a3e584b0efe649821ecc9c8b7c956605 2)src/util.c patch I think sys/wait.h(waitpid) has not supported on MinGW. So I think it should add check (HAVE_SYS_WAIT_H) on waitpid() to avoid compilation warnings. How do you think? Thanks Atsushi SAKAI Richard W.M. Jones [EMAIL PROTECTED] wrote: I got about 95% of the way towards compiling on MinGW using the MinGW cross-compiler from http://mirzam.it.vu.nl/mingw/. Attached are some fairly non-controversial patches which fix some of the problems I found. Build notes follow below. Rich. -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [Libvir] MinGW patch
On Mon, Apr 21, 2008 at 03:56:39PM +0900, Atsushi SAKAI wrote: Hi, Rich I have 2 questions about MinGW fixes. (It has already committed, sorry for delaying) 1)src/storage_driver.c patch I think storage_driver.c is not compiled on MinGW. So It should remove HAVE_PWD_H in src/storage_driver.c Sure, but I left this one in because there may be other platforms which lack pwd.h which would need this. In theory every header of this type should be defended with #ifdef .. #endif 2)src/util.c patch I think sys/wait.h(waitpid) has not supported on MinGW. So I think it should add check (HAVE_SYS_WAIT_H) on waitpid() to avoid compilation warnings. OK thanks. This compiles for me, but I agree that if a version of MinGW doesn't support waitpid we should either find an alternate way or find some way to comment that out. Do you have any suggested Windows/MinGW patches? FWIW it looks like I'm going to use the cross-compiler approach to build libvirt for Windows in future because I don't have the time or energy to maintain a running copy of Windows itself. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [Libvir] MinGW patch
Hi, Rich Richard W.M. Jones [EMAIL PROTECTED] wrote: 2)src/util.c patch I think sys/wait.h(waitpid) has not supported on MinGW. So I think it should add check (HAVE_SYS_WAIT_H) on waitpid() to avoid compilation warnings. OK thanks. This compiles for me, but I agree that if a version of MinGW doesn't support waitpid we should either find an alternate way or find some way to comment that out. Do you have any suggested Windows/MinGW patches? I think following patch seems good (but not tested yet by me.) http://cvsweb.xfree86.org/cvsweb/cvs/windows-NT/waitpid.c?rev=HEAD FWIW it looks like I'm going to use the cross-compiler approach to build libvirt for Windows in future because I don't have the time or energy to maintain a running copy of Windows itself. I also hope to unite the development environment. Thanks Atsushi SAKAI -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [Libvir] MinGW patch
On Mon, Apr 21, 2008 at 07:28:29PM +0900, Atsushi SAKAI wrote: I think following patch seems good (but not tested yet by me.) http://cvsweb.xfree86.org/cvsweb/cvs/windows-NT/waitpid.c?rev=HEAD Yes, that looks good. Gnulib actually contains a wait-process module which basically implements that in the same way (using _cwait on Win32[1]): http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/wait-process.c;h=97bc57fe5f19e1df178f93699dce5c283e801c4b;hb=HEAD Rich. [1] http://msdn2.microsoft.com/en-us/library/zb9ehy71(VS.80).aspx -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[Libvir] MinGW patch
I got about 95% of the way towards compiling on MinGW using the MinGW cross-compiler from http://mirzam.it.vu.nl/mingw/. Attached are some fairly non-controversial patches which fix some of the problems I found. Build notes follow below. Rich. -- Install the MinGW cross-compiler. Compile and install the following packages: (1) libgpg-error (2) libgcrypt (3) gnutls (4) libxml2 (5) PortableXDR I'm building into a local area. Most of them will compile straight with: CFLAGS=-I$HOME/win32/include \ LDFLAGS=-L$HOME/win32/lib \ ./configure --host=i386-mingw32 --prefix=$HOME/win32 make make install GnuTLS (3) is troublesome. I ended up using version 1.6.3, upgrading the gnulib packages in the gl/ subdirectory, and doing a bit of bug-fixing on the Makefile.am files (mainly just making sure my custom LDFLAGS gets through everywhere). Then build libvirt + attached patch: PKG_CONFIG_PATH=$HOME/win32/lib/pkgconfig \ CFLAGS=-I$HOME/win32/include \ LDFLAGS=-L$HOME/win32/lib \ ./configure --host=i386-mingw32 --prefix=$HOME/win32 \ --without-xen --without-qemu --without-libvirtd \ --without-sasl --without-python make [Currently it fails when linking virsh because of the usual weirdness in libtool] -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top Index: configure.in === RCS file: /data/cvs/libvirt/configure.in,v retrieving revision 1.139 diff -u -r1.139 configure.in --- configure.in8 Apr 2008 16:45:57 - 1.139 +++ configure.in17 Apr 2008 18:55:05 - @@ -81,6 +81,13 @@ [test x$ac_cv_path_RPCGEN != xno $ac_cv_path_RPCGEN -t /dev/null /dev/null 21]) +dnl pthread? +AC_CHECK_HEADER(pthread.h, + AC_CHECK_LIB(pthread,pthread_join,[ + AC_DEFINE([HAVE_LIBPTHREAD],[],[Define if pthread (-lpthread)]) + AC_DEFINE([HAVE_PTHREAD_H],[],[Define if pthread.h]) + ])) + dnl Miscellaneous external programs. AC_PATH_PROG(RM, rm, /bin/rm) AC_PATH_PROG(MV, mv, /bin/mv) @@ -301,7 +308,7 @@ if test x$with_libxml = xno ; then AC_MSG_CHECKING(for libxml2 libraries = $LIBXML_REQUIRED) AC_MSG_ERROR(libxml2 = $LIBXML_REQUIRED is required for libvirt) -elif test x$with_libxml = x -a x$PKG_CONFIG = x ; then +elif test x$with_libxml = x -a x$PKG_CONFIG != x ; then PKG_CHECK_MODULES(LIBXML, libxml-2.0 = $LIBXML_REQUIRED, [LIBXML_FOUND=yes], [LIBXML_FOUND=no]) fi if test $LIBXML_FOUND = no ; then @@ -356,7 +363,8 @@ AC_CHECK_LIB(gnutls, gnutls_handshake, [], [AC_MSG_ERROR( - [You must install the GnuTLS library in order to compile and run libvirt])]) + [You must install the GnuTLS library in order to compile and run libvirt])], +[-lgcrypt]) GNUTLS_LIBS=$LIBS LIBS=$old_libs fi Index: src/Makefile.am === RCS file: /data/cvs/libvirt/src/Makefile.am,v retrieving revision 1.76 diff -u -r1.76 Makefile.am --- src/Makefile.am 10 Apr 2008 07:30:53 - 1.76 +++ src/Makefile.am 17 Apr 2008 18:55:15 - @@ -61,17 +61,21 @@ openvz_driver.c openvz_driver.h \ lxc_driver.c lxc_driver.h \ lxc_conf.c lxc_conf.h \ - lxc_container.c lxc_container.h \ + lxc_container.c lxc_container.h \ nodeinfo.h nodeinfo.c \ - storage_conf.h storage_conf.c \ - storage_driver.h storage_driver.c \ - storage_backend.h storage_backend.c \ - storage_backend_fs.h storage_backend_fs.c \ util.c util.h SERVER_SOURCES = \ ../qemud/remote_protocol.c ../qemud/remote_protocol.h +if WITH_LIBVIRTD + +CLIENT_SOURCES += \ + storage_conf.h storage_conf.c \ + storage_driver.h storage_driver.c \ + storage_backend.h storage_backend.c \ + storage_backend_fs.h storage_backend_fs.c + if WITH_STORAGE_LVM CLIENT_SOURCES += storage_backend_logical.h storage_backend_logical.c else @@ -90,7 +94,7 @@ EXTRA_DIST += storage_backend_disk.h storage_backend_disk.c endif - +endif libvirt_la_SOURCES = $(CLIENT_SOURCES) $(SERVER_SOURCES) @@ -130,12 +134,14 @@ virsh_CFLAGS = $(COVERAGE_CFLAGS) $(READLINE_CFLAGS) if WITH_STORAGE_DISK +if WITH_LIBVIRTD
Re: [Libvir] MinGW patch
On Thu, Apr 17, 2008 at 08:04:59PM +0100, Richard W.M. Jones wrote: I got about 95% of the way towards compiling on MinGW using the MinGW cross-compiler from http://mirzam.it.vu.nl/mingw/. Attached are some fairly non-controversial patches which fix some of the problems I found. Build notes follow below. This all looks reasonable to me. Dan. -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [Libvir] MinGW patch
On Thu, Apr 17, 2008 at 08:04:59PM +0100, Richard W.M. Jones wrote: I got about 95% of the way towards compiling on MinGW using the MinGW cross-compiler from http://mirzam.it.vu.nl/mingw/. Attached are some fairly non-controversial patches which fix some of the problems I found. Build notes follow below. Fine by me. +1 For the pthread stuff, it's a shame we really went though all of that in libxml2, too bad we can't reuse it. For the doc, IMHO add a win32 directory and put what you have there in a mingw directory, people will find it more easilly than when looking up in doc/ or on the web (doesn't prevent adding it there too :-) thanks ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ [EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [Libvir] MinGW patch
Richard W.M. Jones [EMAIL PROTECTED] wrote: I got about 95% of the way towards compiling on MinGW using the MinGW cross-compiler from http://mirzam.it.vu.nl/mingw/. Attached are some fairly non-controversial patches which fix some of the problems I found. Build notes follow below. ... Index: src/hash.c === RCS file: /data/cvs/libvirt/src/hash.c,v retrieving revision 1.36 diff -u -r1.36 hash.c --- src/hash.c10 Apr 2008 16:53:29 - 1.36 +++ src/hash.c17 Apr 2008 18:55:16 - @@ -25,7 +25,10 @@ #include libxml/threads.h #include internal.h #include hash.h + +#if HAVE_PTHREAD_H #include pthread.h +#endif Hi Rich, Looks good. You might want to define-away the pthread_* functions instead. With definitions something like this (untested) you can remove all of those in-function #if directives. #if HAVE_PTHREAD_H # include pthread.h #else # define pthread_mutex_init(a, b) /* empty */ # define pthread_mutex_lock(a) /* empty */ # define pthread_mutex_unlock(a) /* empty */ # define pthread_mutex_destroy(a) /* empty */ #endif #define MAX_HASH_LEN 8 @@ -713,7 +716,9 @@ if (ret-storageVols == NULL) goto failed; +#if HAVE_LIBPTHREAD pthread_mutex_init(ret-lock, NULL); +#endif ret-refs = 1; return(ret); @@ -729,7 +734,9 @@ if (ret-storageVols != NULL) virHashFree(ret-storageVols, (virHashDeallocator) virStorageVolFreeName); +#if HAVE_LIBPTHREAD pthread_mutex_destroy(ret-lock); +#endif free(ret); } return(NULL); @@ -762,8 +769,10 @@ free(conn-name); +#if HAVE_LIBPTHREAD pthread_mutex_unlock(conn-lock); pthread_mutex_destroy(conn-lock); +#endif free(conn); } @@ -784,7 +793,9 @@ virHashError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__); return(-1); } +#if HAVE_LIBPTHREAD pthread_mutex_lock(conn-lock); +#endif DEBUG(unref connection %p %s %d, conn, conn-name, conn-refs); conn-refs--; refs = conn-refs; @@ -793,7 +804,9 @@ /* Already unlocked mutex */ return (0); } +#if HAVE_LIBPTHREAD pthread_mutex_unlock(conn-lock); +#endif return (refs); } @@ -818,7 +831,9 @@ virHashError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__); return(NULL); } +#if HAVE_LIBPTHREAD pthread_mutex_lock(conn-lock); +#endif /* TODO search by UUID first as they are better differenciators */ @@ -849,11 +864,15 @@ conn-refs++; } ret-refs++; +#if HAVE_LIBPTHREAD pthread_mutex_unlock(conn-lock); +#endif return(ret); error: +#if HAVE_LIBPTHREAD pthread_mutex_unlock(conn-lock); +#endif ... -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list