Re: New compile failure on OSX: CLOCK_REALTIME undeclared

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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+).

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]