Bug 214484

Summary: emulators/qemu-sbruno: build error if devel/ncurses is installed
Product: Ports & Packages Reporter: John Hein <jcfyecrayz>
Component: Individual Port(s)Assignee: freebsd-ports-bugs mailing list <ports-bugs>
Status: Closed FIXED    
Severity: Affects Some People CC: ler, sbruno, w.schwarzenfeld
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=234049
Description Flags
[patch] remove unnecessary ncurses -D flags
[patch] remove unnecessary ncurses -D flags [v2] jcfyecrayz: maintainer-approval? (sbruno)

Description John Hein 2016-11-13 17:48:03 UTC
When building bsd-user/freebsd/os-proc.c, you get this error if the ncurses port is installed:

/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-ec807d10/bsd-user/freebsd/os-proc.c:307:33: error:
      use of undeclared identifier 'O_CLOEXEC'
        fd = open(p, O_RDONLY | O_CLOEXEC);
1 error generated.
gmake[3]: *** [/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-ec807d10/rules.mak:60: bsd-user/freebsd/os-proc.o] Error 1

'pkg-config --cflags ncurses' gives:
-I/usr/local/include -I/usr/local/include/ncurses -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600

Either -D_POSIX_C_SOURCE=200112L or -D_XOPEN_SOURCE=600
prevent O_CLOEXEC from being defined in fcntl.h

The [forthcoming] patch avoids adding the ncurses -D flags.  It also removes an obsolete part of post-patch that is not required given the current qemu source (which has -lelf in configure now).

I've also opened an inquiry upstream with ncurses to see if those -D flags can't just be removed from its pkg-config files.

In the mean time, a local patch for the qemu port might be useful to avoid build errors for people who have ncurses installed.

p.s. this only occurs in the most recent qemu-sbruno update - before that 'configure' didn't invoke "pkg-config --cflags ncurses".
Comment 1 John Hein 2016-11-13 17:52:37 UTC
Created attachment 176961 [details]
[patch] remove unnecessary ncurses -D flags
Comment 2 Sean Bruno freebsd_committer 2016-11-13 18:22:13 UTC
(In reply to John Hein from comment #1)
Heh ... thanks!  Many people noted this and it really confused me.
Comment 3 Sean Bruno freebsd_committer 2016-11-13 18:22:27 UTC
*** Bug 214461 has been marked as a duplicate of this bug. ***
Comment 4 John Hein 2016-11-13 19:43:05 UTC
Created attachment 176965 [details]
[patch] remove unnecessary ncurses -D flags [v2]

Correct mechanical error in patch.
Comment 5 commit-hook freebsd_committer 2016-11-14 02:59:54 UTC
A commit references this bug:

Author: sbruno
Date: Mon Nov 14 02:58:58 UTC 2016
New revision: 426079
URL: https://svnweb.freebsd.org/changeset/ports/426079

  Fix build with devel/ncurses installed.

  PR:	214484
  Submitted by:	John Hein <z7dr6ut7gs@snkmail.com>