qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Liviu Ionescu <ilg@livius.net>
Cc: qemu-devel <Qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] macOS 10.12 Sierra, Xcode 8 & clock_gettime()
Date: Tue, 25 Oct 2016 15:48:50 +0200	[thread overview]
Message-ID: <71a7fb29-89ce-58cc-3ae7-77ab793dbd35@redhat.com> (raw)
In-Reply-To: <7E519923-A7CF-4E43-A67D-D614FF161F1E@livius.net>



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	other threads:[~2016-10-25 13:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25  9:43 [Qemu-devel] macOS 10.12 Sierra, Xcode 8 & clock_gettime() Liviu Ionescu
2016-10-25 10:02 ` Peter Maydell
2016-10-25 10:34   ` Liviu Ionescu
2016-10-25 13:40   ` Liviu Ionescu
2016-10-25 11:40 ` Paolo Bonzini
2016-10-25 13:36   ` Liviu Ionescu
2016-10-25 13:48     ` Paolo Bonzini [this message]
2016-10-25 14:12       ` Liviu Ionescu
2016-10-25 14:21         ` Paolo Bonzini
2016-10-25 14:37           ` Liviu Ionescu
2016-10-25 14:38             ` Paolo Bonzini
     [not found] <mailman.12713.1477406219.22738.qemu-devel@nongnu.org>
2016-10-26 14:32 ` G 3
2016-10-26 15:15   ` Liviu Ionescu
2016-10-26 15:32     ` G 3
2016-10-26 15:39       ` Liviu Ionescu
2016-10-26 16:03         ` G 3

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71a7fb29-89ce-58cc-3ae7-77ab793dbd35@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Qemu-devel@nongnu.org \
    --cc=ilg@livius.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).