When building bsd-user/freebsd/os-proc.c, you get this error if the ncurses port is installed:
use of undeclared identifier 'O_CLOEXEC'
fd = open(p, O_RDONLY | O_CLOEXEC);
1 error generated.
gmake: *** [/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".
Created attachment 176961 [details]
[patch] remove unnecessary ncurses -D flags
(In reply to John Hein from comment #1)
Heh ... thanks! Many people noted this and it really confused me.
*** Bug 214461 has been marked as a duplicate of this bug. ***
Created attachment 176965 [details]
[patch] remove unnecessary ncurses -D flags [v2]
Correct mechanical error in patch.
A commit references this bug:
Date: Mon Nov 14 02:58:58 UTC 2016
New revision: 426079
Fix build with devel/ncurses installed.
Submitted by: John Hein <firstname.lastname@example.org>