From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz05b-0007rh-Px for Qemu-devel@nongnu.org; Tue, 25 Oct 2016 07:40:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bz05Z-0008SY-6t for Qemu-devel@nongnu.org; Tue, 25 Oct 2016 07:40:19 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:34531) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bz05Y-0008SK-Vx for Qemu-devel@nongnu.org; Tue, 25 Oct 2016 07:40:17 -0400 Received: by mail-wm0-x22b.google.com with SMTP id d128so3043279wmf.1 for ; Tue, 25 Oct 2016 04:40:16 -0700 (PDT) Sender: Paolo Bonzini References: <1EF56314-1CA2-4C7B-81FB-7B8F3AEF47B8@livius.net> From: Paolo Bonzini Message-ID: Date: Tue, 25 Oct 2016 13:40:11 +0200 MIME-Version: 1.0 In-Reply-To: <1EF56314-1CA2-4C7B-81FB-7B8F3AEF47B8@livius.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] macOS 10.12 Sierra, Xcode 8 & clock_gettime() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liviu Ionescu , qemu-devel On 25/10/2016 11:43, Liviu Ionescu wrote: > 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()`. I think you need to use -mmacosx-version-min=10.10 or something like that, using the configure flag --extra-cflags. Paolo