qemu-devel
[Top][All Lists]
Advanced

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

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


From: Liviu Ionescu
Subject: [Qemu-devel] macOS 10.12 Sierra, Xcode 8 & clock_gettime()
Date: Tue, 25 Oct 2016 12:43:50 +0300

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




reply via email to

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