From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXoqZ-0000CE-2D for qemu-devel@nongnu.org; Wed, 09 Apr 2014 05:31:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXoqS-0000vf-6w for qemu-devel@nongnu.org; Wed, 09 Apr 2014 05:31:06 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.189.228]:59852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXoqS-0000ui-1C for qemu-devel@nongnu.org; Wed, 09 Apr 2014 05:31:00 -0400 Date: Wed, 9 Apr 2014 02:29:58 -0700 From: "Noonan, Steven" Message-ID: <20140409092956.GA10358@amazon.com> References: <1396023542-19667-1-git-send-email-pbonzini@redhat.com> <20140408204714.GA3225@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH for-2.0] configure: add option to disable -fstack-protector flags List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Laurent Desnogues , Paolo Bonzini , Steven Noonan , QEMU Developers , Anthony Liguori On Wed, Apr 09, 2014 at 08:40:50AM +0100, Peter Maydell wrote: > On 8 April 2014 21:47, Noonan, Steven wrote: > > On Tue, Apr 08, 2014 at 09:37:27PM +0100, Peter Maydell wrote: > >> This is bad because we have that framework argument as part of our > >> linker flags. Effectively this means that clang won't warn about the > >> argument at link time but will warn for every .c->.o compile (as well > >> as ending up with no stack protection). > > > > So -framework is designed to transparently add the appropriate -I and > > -L/-l flags, pointing to the insides of a .framework bundle. > > > > To me, the -framework arguments belong in CFLAGS and LIBS, but not > > LDFLAGS. In the context of QEMU's configure script, I think it'd be > > QEMU_INCLUDES and LIBS. > > Unfortunately, putting "-framework CoreFoundation" in CFLAGS > produces a different warning: > > manooth$ clang -o /tmp/zz9.o -Werror -fstack-protector -c /tmp/zz9.c > -framework CoreFoundation > clang: error: -framework CoreFoundation: 'linker' input unused > > which would seem to imply that you shouldn't be passing it on > the .c->.o compile command line. I think it's a warning being turned into an error with -Werror. In any case, it's rightfully complaining, I'd forgotten that '-framework' was link-only. It's been a while since I built anything serious outside of command-line apps on Macs. There are a few relevant command-line arguments that need to be utilized correctly, though some might not matter in your case: -mmacosx-version-min= -isysroot -F -framework The -mmacosx-version-min and -isysroot arguments only are significant if you intend to redistribute the binary, as they determine what Mac OS X SDK you're targeting. For compile command lines, you would need -F arguments to help it resolve the framework paths (excluding paths for system-provided frameworks, such as CoreFoundation). Any #include directives for framework headers would be written as e.g. #include Then for the link command line, you use the same -F arguments to set up the framework search paths, then add -framework for linkage. So in your case all you probably need is to drop the -framework arguments from CFLAGS and plop them into LIBS, and you're probably good to go.