NetBSD Problem Report #51899

From www@NetBSD.org  Fri Jan 20 03:59:29 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 03CE47A16E
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 20 Jan 2017 03:59:29 +0000 (UTC)
Message-Id: <20170120035927.D130D7A284@mollari.NetBSD.org>
Date: Fri, 20 Jan 2017 03:59:27 +0000 (UTC)
From: js-pkgsrc@heap.zone
Reply-To: js-pkgsrc@heap.zone
To: gnats-bugs@NetBSD.org
Subject: Fix for building qemu on Darwin
X-Send-Pr-Version: www-1.0

>Number:         51899
>Category:       pkg
>Synopsis:       Fix for building qemu on Darwin
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 20 04:00:00 +0000 2017
>Closed-Date:    Mon Feb 27 05:24:08 +0000 2017
>Last-Modified:  Mon Feb 27 05:24:08 +0000 2017
>Originator:     Jonathan Schleifer
>Release:        HEAD
>Organization:
>Environment:
>Description:
qemu seems to use the system's curses.h, even when building NetBSD's ncursesw. However, for wide support, -D_XOPEN_SOURCE_EXTENDED is needed by Darwin's curses.h.
>How-To-Repeat:

>Fix:
diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile
index b3a12c4e064..292e1154b62 100644
--- a/emulators/qemu/Makefile
+++ b/emulators/qemu/Makefile
@@ -45,6 +45,8 @@ CONFIGURE_ARGS+=	--enable-curses
 CONFIGURE_ARGS+=	--disable-opengl
 CONFIGURE_ENV+=		mansuffix=/${PKGMANDIR}

+CONFIGURE_ARGS.Darwin+=	--extra-cflags=-D_XOPEN_SOURCE_EXTENDED
+
 .if defined(PKGSRC_USE_SSP)
 # do not add flags to everything
 PKGSRC_USE_SSP=		no

>Release-Note:

>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51899: Fix for building qemu on Darwin
Date: Fri, 20 Jan 2017 16:33:02 +0000

 On Fri, Jan 20, 2017 at 04:00:00AM +0000, js-pkgsrc@heap.zone wrote:
  > qemu seems to use the system's curses.h, even when building
  > NetBSD's ncursesw. However, for wide support,
  > -D_XOPEN_SOURCE_EXTENDED is needed by Darwin's curses.h.

 It's critical that it use the curses.h corresponding to the curses
 library it links to, so if it's using the system curses.h but the
 packaging thinks it's using ncurses from pkgsrc, it needs to be
 patched to behave itself.

 -- 
 David A. Holland
 dholland@netbsd.org

From: Yuji Yamano <yyamano@kt.rim.or.jp>
To: js-pkgsrc@heap.zone, gnats-bugs@NetBSD.org
Cc: dholland-pbugs@netbsd.org
Subject: Re: pkg/51899: Fix for building qemu on Darwin
Date: Thu, 26 Jan 2017 20:24:40 +0900 (JST)

 > qemu seems to use the system's curses.h, even when building NetBSD's
 > ncursesw. However, for wide support, -D_XOPEN_SOURCE_EXTENDED is
 > needed by Darwin's curses.h.

 qemu's configure script tests pkgsrc's ncursesw, but it fails because
 _XOPEN_SOURCE_EXTENDED is not defined. Unlike NetBSD's curses, pkgsrc's 
 ncurses and Darwin's curses (actually ncurses) require _XOPEN_SOURCE_EXTENDED
 to support wide-character.

 From emulators/qemu/work/qemu-2.8.0/config.log:

 clang -m64 -mcx16 -DOS_OBJECT_USE_OBJC=0 -arch x86_64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes
  -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wno-string-plus-in
 t -Wno-initializer-overrides -Wendif-labels -Wno-shift-negative-value -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wforma
 t-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/opt/pkg/
 include -v -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -m64 -framework CoreFoundation -framework IOKit -arch x86_64 -g -L/opt/pkg/lib -L/usr/lib -L/opt/X11/lib -D_DARWIN_C_SOURCE -I/opt/pkg/include/ncursesw
 Apple LLVM version 7.3.0 (clang-703.0.31)
 Target: x86_64-apple-darwin15.3.0
 Thread model: posix
 InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
  -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage
  -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free
  -disable-llvm-verifier -main-file-name qemu-conf.c -mrelocation-model
  pic -pic-level 2 -mthread-model posix -mdisable-fp-elim
  -relaxed-aliasing -masm-verbose -munwind-tables -target-cpu core2
  -target-feature +cx16 -target-linker-version 264.3.102 -v
  -dwarf-column-info -debug-info-kind=standalone -dwarf-version=2
  -resource-dir
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.3.0
  -D OS_OBJECT_USE_OBJC=0 -D _GNU_SOURCE -D _FILE_OFFSET_BITS=64 -D
  _LARGEFILE_SOURCE -I /pkgsrc/emulators/qemu/work/.buildlink/include
  -D _DARWIN_C_SOURCE -I
  /pkgsrc/emulators/qemu/work/.buildlink/include/ncursesw
  -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings
  -Wmissing-prototypes -Wno-string-plus-int -Wno-initializer-overrides
  -Wendif-labels -Wno-shift-negative-value -Wmissing-include-dirs
  -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k
  -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits
  -fconst-strings -fdebug-compilation-dir
  /pkgsrc/emulators/qemu/work/qemu-2.8.0 -ferror-limit 19
  -fmessage-length 0 -fwrapv -stack-protector 2 -fblocks
  -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature
  -fmax-type-align=16 -fno-common -fdiagnostics-show-option -o
  /var/folders/gc/b9cgjszn1v30w4w5rmq0jshr0000gn/T/qemu-conf-75e4b6.o
  -x c config-temp/qemu-conf.c
 clang -cc1 version 7.3.0 (clang-703.0.31) default target x86_64-apple-darwin15.3.0
 #include "..." search starts here:
 #include <...> search starts here:
  /pkgsrc/emulators/qemu/work/.buildlink/include
  /pkgsrc/emulators/qemu/work/.buildlink/include/ncursesw
  /usr/local/include
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.3.0/include
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
  /usr/include
  /System/Library/Frameworks (framework directory)
  /Library/Frameworks (framework directory)
 End of search list.
 config-temp/qemu-conf.c:8:3: warning: implicit declaration of function 'addwstr' is invalid in C99 [-Wimplicit-function-declaration]
   addwstr(L"wide chars\n");
   ^
 config-temp/qemu-conf.c:9:3: warning: implicit declaration of function 'addnwstr' is invalid in C99 [-Wimplicit-function-declaration]
   addnwstr(&wch, 1);
   ^
 config-temp/qemu-conf.c:10:3: warning: implicit declaration of function 'add_wch' is invalid in C99 [-Wimplicit-function-declaration]
   add_wch(WACS_DEGREE);
   ^
 config-temp/qemu-conf.c:10:11: error: use of undeclared identifier 'WACS_DEGREE'
   add_wch(WACS_DEGREE);


 From /usr/pkg/include/ncursesw/curses.h:

 #ifndef NCURSES_WIDECHAR
 #if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500))
 #define NCURSES_WIDECHAR 1
 #else
 #define NCURSES_WIDECHAR 0
 #endif
 #endif /* NCURSES_WIDECHAR */

 [snip]

 #if NCURSES_WIDECHAR

 [snip]

 #define WACS_DEGREE     NCURSES_WACS('f') /* degree symbol */


 From /usr/include/curses.h on NetBSD 7.0:

 #if !defined(HAVE_WCHAR) && !defined(DISABLE_WCHAR)
 #define HAVE_WCHAR 1
 #endif

 [snip]

 #ifdef HAVE_WCHAR

 [snip]

 #define WACS_DEGREE     (&_wacs_char[(unsigned char)'f'])

From: coypu@SDF.ORG
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/51899: Fix for building qemu on Darwin
Date: Fri, 27 Jan 2017 20:32:53 +0000

 looks like ncurses/builtin.mk has:
 builtin.mk:BUILDLINK_CPPFLAGS.ncursesw+=	-D_XOPEN_SOURCE_EXTENDED=1
 but buildlink3.mk does not.

From: Yuji Yamano <yyamano@kt.rim.or.jp>
To: js-pkgsrc@heap.zone, gnats-bugs@NetBSD.org
Cc: dholland-pbugs@netbsd.org, coypu@SDF.ORG
Subject: Re: pkg/51899: Fix for building qemu on Darwin
Date: Tue, 31 Jan 2017 14:08:32 +0900 (JST)

 Jonathan,

 Could you try the attached patch?

 I think I finally found the root cause. 
 _XOPEN_SOURCE_EXTENDED is exported via CFLAGS by the pkgsrc framework,
 but qemu doesn't support CFLAGS. We need to use --extra-cflags instead.

 Index: Makefile
 ===================================================================
 RCS file: /cvsroot/pkgsrc/emulators/qemu/Makefile,v
 retrieving revision 1.163
 diff -u -r1.163 Makefile
 --- Makefile	17 Jan 2017 09:10:11 -0000	1.163
 +++ Makefile	31 Jan 2017 05:01:32 -0000
 @@ -43,6 +43,7 @@
  CONFIGURE_ARGS+=	--enable-curses
  #HF#CONFIGURE_ARGS+=	--disable-fdt			# HF: build on OS X
  CONFIGURE_ARGS+=	--disable-opengl
 +CONFIGURE_ARGS+=	--extra-cflags="${CFLAGS}"	
  CONFIGURE_ENV+=		mansuffix=/${PKGMANDIR}

  .if defined(PKGSRC_USE_SSP)

From: Jonathan Schleifer <js-pkgsrc@heap.zone>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/51899: Fix for building qemu on Darwin
Date: Fri, 3 Feb 2017 02:03:00 +0100

 Yuji, that doesn't seems to help. And as I get

 => Full dependency ncursesw>=6.0: found ncursesw-6.0nb2

 shouldn't it use pkgsrc's curses anyway?

From: Yuji Yamano <yyamano@kt.rim.or.jp>
To: gnats-bugs@NetBSD.org, js-pkgsrc@heap.zone
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/51899: Fix for building qemu on Darwin
Date: Fri, 03 Feb 2017 13:43:53 +0900 (JST)

 On Fri,  3 Feb 2017 02:20:01 +0000 (UTC), Jonathan Schleifer <js-pkgsrc@heap.zone> wrote:

 >  Yuji, that doesn't seems to help. And as I get

 Hmm, could you send qemu/work/qemu-2.8.0/config.log to me?

 >  => Full dependency ncursesw>=6.0: found ncursesw-6.0nb2
 >  
 >  shouldn't it use pkgsrc's curses anyway?

 qemu requires curses that supports wide character, but there is no way 
 to confirm if builtin library support it. So pkgsrc framework uses 
 pkgsrc's one. See mk/curses.builtin.mk for more details.

 # AFAIK there is no way of working out if a system curses library has wide
 # character support. So be safe and say no unless we know for sure.
 .  if !empty(USE_CURSES:Mwide)
 .    if ${OPSYS} == "NetBSD"
 .      if !empty(MACHINE_PLATFORM:MNetBSD-[0-4].*-*)
 USE_BUILTIN.curses=     no
 .      endif
 .    else
 USE_BUILTIN.curses=     no
 .    endif
 .  endif
 .endif

 -- 
 Yuji Yamano

From: "Adam Ciarcinski" <adam@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51899 CVS commit: pkgsrc/emulators/qemu
Date: Mon, 27 Feb 2017 05:19:29 +0000

 Module Name:	pkgsrc
 Committed By:	adam
 Date:		Mon Feb 27 05:19:29 UTC 2017

 Modified Files:
 	pkgsrc/emulators/qemu: Makefile PLIST distinfo options.mk
 	pkgsrc/emulators/qemu/patches: patch-configure
 Added Files:
 	pkgsrc/emulators/qemu/patches:
 	    patch-disas_libvixl_vixl_a64_disasm-a64.cc
 	    patch-disas_libvixl_vixl_utils.h

 Log Message:
 Revision 2 changes:
 * Fixed building with C++.
 * Fixed building on Darwin (PR 51899).
 * Added GTK3 as an option.
 * Switched from SDL-1 to SDL-2.
 * Depend and enable support for: lzo, jemalloc, snappy, png, curl, jpeg.


 To generate a diff of this commit:
 cvs rdiff -u -r1.164 -r1.165 pkgsrc/emulators/qemu/Makefile
 cvs rdiff -u -r1.48 -r1.49 pkgsrc/emulators/qemu/PLIST
 cvs rdiff -u -r1.120 -r1.121 pkgsrc/emulators/qemu/distinfo
 cvs rdiff -u -r1.2 -r1.3 pkgsrc/emulators/qemu/options.mk
 cvs rdiff -u -r1.16 -r1.17 pkgsrc/emulators/qemu/patches/patch-configure
 cvs rdiff -u -r0 -r1.1 \
     pkgsrc/emulators/qemu/patches/patch-disas_libvixl_vixl_a64_disasm-a64.cc \
     pkgsrc/emulators/qemu/patches/patch-disas_libvixl_vixl_utils.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: adam@NetBSD.org
State-Changed-When: Mon, 27 Feb 2017 05:24:08 +0000
State-Changed-Why:
Fixed with 2.8.0nb2.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.