[Libvir] [PATCH] A few more Windows / MinGW fixups

Richard W.M. Jones rjones at redhat.com
Fri Jan 4 12:57:16 UTC 2008

A few fairly miscellaneous fixups for Windows (MinGW) which fix shared 
library builds and fix error handling for sockets.

(1) XDR functions on MinGW come from a library called 'libxdr', not 

(2) To build a DLL under MinGW we need to pass the -no-undefined flag to 
the linker.

(3) Socket compatibility header file replaces <winsock2.h> inclusion. 
This just defines a portable 'socket_errno()' function which returns 
errno in the normal case, or WSAGetLastError() in the Windows case.

(4) Use socket_errno() instead of errno in a few cases (but only when 
the code can be compiled under Windows, ie. only in the remote client case).

Example -- a dynamically linked virsh.exe (linked to libvirt-0.dll) 
accessing a remote libvirtd:

$ src/.libs/virsh.exe -c test+tcp:// list
  Id Name                 State
   1 test                 running

If you want to compile this under Windows, you will need:

(a) MinGW & MSYS (select the "candidate" versions of MinGW tools if you 
are using Vista or W2K8, since otherwise nothing works because of a 
known bug).

(b) Install gcc 4 experimental package from MinGW site.  It's called 
gcc-sjlj for reasons which escape me.

(c) Install GnuTLS binary from 
http://www.gnu.org/software/gnutls/download.html.  I'm using GnuTLS 
Windows binary 1.6.3 and I had to hand-hack the *.la files in that 
distribution because they contain incorrect paths.

(d) Compile and install latest libxml2 from http://xmlsoft.org/.  I'm 
using 2.6.30.

(e) Compile and install my XDR package for Windows 

(f) ./configure --without-xen --without-qemu --without-sasl 

(g) make


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-mingw.patch
Type: text/x-patch
Size: 9516 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080104/b557ab69/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080104/b557ab69/attachment-0003.bin>

More information about the libvir-list mailing list