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