All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] macOS 10.12 Sierra, Xcode 8 & clock_gettime()
@ 2016-10-25  9:43 Liviu Ionescu
  2016-10-25 10:02 ` Peter Maydell
  2016-10-25 11:40 ` Paolo Bonzini
  0 siblings, 2 replies; 16+ messages in thread
From: Liviu Ionescu @ 2016-10-25  9:43 UTC (permalink / raw)
  To: qemu-devel

In Xcode 8 (more or less mandatory after upgrading to Sierra), Apple added support for `clock_gettime(CLOCK_MONOTONIC, &ts)`, which is not bad in itself.

Unfortunately, with this addition, a QEMU built on 10.12 runs **only** on 10.12; on previous versions it fails with something like:

```
$ ./qemu-system-gnuarmeclipse --version
dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
Referenced from: /Applications/GNU ARM Eclipse/QEMU/2.6.0-201610170917-dev/bin/./qemu-system-gnuarmeclipse (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
```

The explanation is simple, for previous versions `_clock_gettime` is not available in the system library. 

Apple does some tricks with macros in `time.h` to specify that the definitions were introduced in 10.12, but QEMU uses only `#ifdef CLOCK_MONOTONIC` to select the use of `clock_gettime()`.

Until a more elaborate solution will be considered, my workaround was to replace `#ifdef CLOCK_MONOTONIC` with `#if defined(CLOCK_MONOTONIC) && !defined(__APPLE__)` and so avoid references to `clock_gettime()`.


Regards,

Liviu

^ permalink raw reply	[flat|nested] 16+ messages in thread
[parent not found: <mailman.12713.1477406219.22738.qemu-devel@nongnu.org>]

end of thread, other threads:[~2016-10-26 16:04 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.