[libvirt] PATCH: Fix Windows / mingw32 build

Daniel Veillard veillard at redhat.com
Tue Jan 6 14:41:49 UTC 2009


On Tue, Jan 06, 2009 at 12:48:00PM +0000, Daniel P. Berrange wrote:
> There are a number of problems breaking the windows / mingw
> build currently.
> 
>  - Use of 'close' without importing unistd.h
>  - Use of non-existant localtime_r

  oops :-)

>  - ERROR macro from logging.h clashes with a symbol imported
>    from windows.h

  oh, crap, okay we need a namespaced one

> So this patch does
> 
>  - Adds the missing unistd.h include
>  - Uses localtime() if localtime_r() is missing (as checked from
>    configure)
>  - Adds a VIR_ prefix onto all logging macros, keeping
>    DEBUG() around because its just used in sooooo many
>    places
> 
> The use of localtime() on Windows is OK, because the MicroSoft
> implementation of this uses thread-local storage:
> 
>   http://msdn.microsoft.com/en-us/library/a442x3ye.aspx
> 
> And all other OS we care about have localtime_r
> 
> Finally I fix a few compile warnings, so that Mingw can now be
> built  with --enable-compile-warnings=error to detect these 
> problems more quickly in future.

  Patch looks fine. But I spotted we still use strerror, I though
this had to be discarded because it wasn't thread-safe ?

  +1

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list