From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwBwU-0007dY-Td for qemu-devel@nongnu.org; Thu, 06 Apr 2017 14:15:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwBwR-0001Gu-PV for qemu-devel@nongnu.org; Thu, 06 Apr 2017 14:15:34 -0400 Received: from [195.159.176.226] (port=57444 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwBwR-0001GX-Ig for qemu-devel@nongnu.org; Thu, 06 Apr 2017 14:15:31 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cwBw9-0004Bg-1X for qemu-devel@nongnu.org; Thu, 06 Apr 2017 20:15:13 +0200 From: =?UTF-8?Q?Rainer_M=c3=bcller?= Date: Thu, 6 Apr 2017 20:15:19 +0200 Message-ID: References: <1933406e-2576-e687-3545-a72f3b999310@redhat.com> <7c4d6c25-3b1c-61ec-1eda-6c5e7cee8755@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit In-Reply-To: Subject: Re: [Qemu-devel] Fix build break during configuration on musl-libc based Linux systems. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 2017-02-17 17:57, Peter Maydell wrote: > On 17 February 2017 at 11:20, Paolo Bonzini wrote: >> >> >> On 17/02/2017 11:18, Peter Maydell wrote: >>> Defining _XOPEN_SOURCE is easy enough, and I think we should >>> do it unconditionally. We should check what effect this has >>> on the BSD hosts though I guess. (You could argue that we >>> should be defining _XOPEN_SOURCE anyway for the benefit of >>> the non-glibc BSD/Solaris/etc platforms.) >> >> Sounds good, then I think we should define it to 700 just like glibc does. > > Unfortunately this idea turns out to break OSX compiles, > because on OSX saying _XOPEN_SOURCE=anything disables > all the non-X/Open APIs (which you get by default, and > some of which like mkdtemp we use). A bit late to this thread, but the original problem was also reported for Mac OS X with --enable-curses in MacPorts. The build fails with the same symptoms as in the original report. https://trac.macports.org/ticket/53929 As you identified, the problem is that ncurses expects the define _XOPEN_SOURCE >= 500 to enable the wide-char function declarations. The solution to retain access to non-standard API on Mac OS X would be to also define _DARWIN_C_SOURCE which enables extensions. $ cat foo.c #include int main() { mkdtemp("/tmp/test-XXXXXX"); } $ cc -D_XOPEN_SOURCE=500 -c foo.c foo.c:4:5: warning: implicit declaration of function 'mkdtemp' is invalid in C99 [-Wimplicit-function-declaration] mkdtemp("/tmp/test-XXXXXX"); ^ 1 warning generated. $ cc -D_XOPEN_SOURCE=500 -D_DARWIN_C_SOURCE -c foo.c $ A quick test on current master with configure patched to define QEMU_CFLAGS="-D_XOPEN_SOURCE=500 -D_DARWIN_C_SOURCE $QEMU_CFLAGS" compiled fine for both a default configure and with --enable-curses. Rainer