qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>, patches@linaro.org
Subject: [Qemu-devel] [PATCH 1/2] configure: Define OS_OBJECT_USE_OBJC=0 for MacOSX builds
Date: Sat, 11 Aug 2012 22:34:39 +0100	[thread overview]
Message-ID: <1344720880-26881-2-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1344720880-26881-1-git-send-email-peter.maydell@linaro.org>

MacOSX 10.8 ("Mountain Lion") defaults to trying to use automated
reference counting on certain objects.  This means that the system
header files will use some Objective C syntax constructs even when
compiling pure C, which confuses mainline gcc. Suppress this by
setting OS_OBJECT_USE_OBJC=0. This avoids a compile error like this:

In file included from
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:5:0,
                 from /usr/include/os/object.h:74,
                 from /usr/include/dispatch/dispatch.h:48,
                 from /System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:56,
                 from block/raw-posix.c:35:
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:409:1: error: stray ‘@’ in program
[with a large number of further run-on errors]

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 configure | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure b/configure
index f0dbc03..be4a2bb 100755
--- a/configure
+++ b/configure
@@ -452,6 +452,9 @@ Darwin)
   audio_possible_drivers="coreaudio sdl fmod"
   LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
   libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
+  # Disable attempts to use ObjectiveC features in os/object.h since they
+  # won't work when we're compiling with gcc as a C compiler.
+  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
 ;;
 SunOS)
   solaris="yes"
-- 
1.7.11.4

  reply	other threads:[~2012-08-11 21:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-11 21:34 [Qemu-devel] [PATCH 0/2] Fix compilation on MacOS X 10.8 ("Mountain Lion") Peter Maydell
2012-08-11 21:34 ` Peter Maydell [this message]
2012-08-11 21:34 ` [Qemu-devel] [PATCH 2/2] Support using a different compiler for Objective-C files Peter Maydell
2012-08-15 14:47   ` Andreas Färber
2012-08-15 14:55     ` Peter Maydell
2012-08-15 16:05       ` Andreas Färber

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=1344720880-26881-2-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=afaerber@suse.de \
    --cc=patches@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).