qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] macOS 10.12 Sierra, Xcode 8 & clock_gettime()


From: Paolo Bonzini
Subject: Re: [Qemu-devel] macOS 10.12 Sierra, Xcode 8 & clock_gettime()
Date: Tue, 25 Oct 2016 15:48:50 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0


On 25/10/2016 15:36, Liviu Ionescu wrote:
> I tried this, and I also tried "export MACOSX_DEPLOYMENT_TARGET=10.11", but 
> they did not help.
> 
> in this case, the decision to refer to `clock_gettime()` is made by `#ifdef 
> CLOCK_MONOTONIC`, which seems to be always defined in <time.h> on 10.12.
> 
> if you want to test this, you can use:
> 
> cat <<EOF >/tmp/cg.c
> #include <time.h>
> 
> #if defined(CLOCK_MONOTONIC)
> #error CLOCK_MONOTONIC is defined
> #endif
> EOF
> 
> gcc /tmp/cg.c
> 
> gcc -mmacosx-version-min=10.11 /tmp/cg.c
> 
> MACOSX_DEPLOYMENT_TARGET=10.11; gcc /tmp/cg.c
> 
> ...
> 
> 
> if you find a combination of compiler options to prevent the error, then 
> adding it to --extra-cflags might help.

Perhaps you can add a configure test for clock_gettime, and define a
symbol CONFIG_HAVE_CLOCK_GETTIME if clock_gettime exists.

If needed, include the appropriate attribute in the test:

#include <time.h>
#if defined __clang__ && defined __APPLE__
__attribute__((availability(macos,strict,introduced=10.12)))
int clock_gettime(clockid_t clk_id, struct timespec *tp);
#endif

Then change QEMU to use clock_gettime() only

#if defined CONFIG_HAVE_CLOCK_GETTIME && defined CLOCK_MONOTONIC

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]