On Mon, Nov 08, 2010 at 12:07:57PM -0700, Eric Blake wrote:
> On 11/07/2010 01:35 AM, Justin Clift wrote:
> > Hi Eric,
> > 
> > When running 'make check' on OSX (git head) it's erroring out with:
> > 
> >   eventtest.c: In function 'finishJob':
> >   eventtest.c:216: warning: implicit declaration of function 'clock_gettime'
> >   eventtest.c:216: warning: nested extern declaration of 'clock_gettime' 
> > [-Wnested-externs]
> >   eventtest.c:216: error: 'CLOCK_REALTIME' undeclared (first use in this 
> > function)
> >   eventtest.c:216: error: (Each undeclared identifier is reported only once
> >   eventtest.c:216: error: for each function it appears in.)
> >   make[3]: *** [eventtest.o] Error 1
> >   make[2]: *** [check-am] Error 2
> >   make[1]: *** [check-recursive] Error 1
> >   make: *** [check-recursive] Error 1
> >   $
> > 
> > Looks like the CLOCK_REALTIME is a glibc Linux thing.  It's in 
> > /usr/include/time/bits.h on
> > a F13 box.
> 
> CLOCK_REALTIME is optional in C99, but required by POSIX:
> http://www.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html#tag_13_76
> 
> However, gnulib doesn't yet work around this deficiency:
> http://www.gnu.org/software/gnulib/manual/gnulib.html#clock_005fgettime
> 
>  Portability problems not fixed by Gnulib:
> 
>      * This function is missing on some platforms: MacOS X 10.3, IRIX
> 5.3, Solaris 2.4, mingw, Interix 3.5, BeOS.
> 
> > 
> > Any idea if gnulib can be used to get around this?
> 
> It might be possible, if we can come up with a portable way to get a
> decent substitution of reasonable time on all of those platforms.  Right
> now, the gnulib clock-time module is GPL, and merely checks whether
> clock_{get,set}time are available, and if so, in what library (although
> since the module only consists of a single .m4 file, it should be
> trivial to relicense it to LGPLv2+).

Hmm, I was going to suggest disabling the test case on OS-X,
but with the virsh console streams stuff, the code being
tested is now used outside of libvirtd.

Easier is to just re-write eventtest.c to use gettimeofday()
instead of clock_gettime

Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Reply via email to