Bug 214484 - emulators/qemu-sbruno: build error if devel/ncurses is installed
Summary: emulators/qemu-sbruno: build error if devel/ncurses is installed
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
: 214461 (view as bug list)
Depends on:
Reported: 2016-11-13 17:48 UTC by John Hein
Modified: 2019-06-15 08:28 UTC (History)
3 users (show)

See Also:

[patch] remove unnecessary ncurses -D flags (1.92 KB, patch)
2016-11-13 17:52 UTC, John Hein
no flags Details | Diff
[patch] remove unnecessary ncurses -D flags [v2] (1.89 KB, patch)
2016-11-13 19:43 UTC, John Hein
jcfyecrayz: maintainer-approval? (sbruno)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>