Bug 234049

Summary: devel/ncurses: bogus CFLAGS break build of editors/nano
Product: Ports & Packages Reporter: Daniel Eisele <daniel_eisele>
Component: Individual Port(s)Assignee: Steve Wills <swills>
Status: Closed FIXED    
Severity: Affects Some People CC: danilo, dickey, fbbug, jcfyecrayz, swills, w.schwarzenfeld
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223578
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214484
Attachments:
Description Flags
Updated patch which fixes the problem none

Description Daniel Eisele 2018-12-16 03:37:34 UTC
The recent versions of devel/ncurses break the build editors/nano, because the configure script adds bogus options to CFLAGS.

This had already been patched out (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223578), but the patch was removed again with this commit: https://svnweb.freebsd.org/ports?view=revision&revision=486883

The reason for the removal of the patch might have been, that the relevant part of the configure script got changed upstream (they added a midnightbsd option).

That means that the patch probably has to be updated before it can be reintroduced.

The editors/nano build fails, because the ncurses CFLAGS force an old C header version, which makes the type "max_align_t" unavailable.
Comment 1 Étienne Simon 2018-12-22 19:57:53 UTC
This also affect sysutils/htop, see https://github.com/hishamhm/htop/issues/870
Comment 2 Daniel Eisele 2018-12-23 00:47:35 UTC
Created attachment 200380 [details]
Updated patch which fixes the problem

(In reply to Étienne Simon from comment #1)
Thanks for linking the htop issue, this segfault looks even nastier to track down than the nano build error.

A few more details about the CFLAGS:
* thy come from the configure file (line 8789)
* they get stored in "/usr/local/libdata/pkgconfig/ncursesw.pc"
* they are queried with "pkg-config --cflags ncursesw"

I've attached an updated version of the old patch,
but it would probably be better to get this fixed upstream.

The patch excludes DragonFly and MidnightBSD,
is this the right way to go here?
Comment 3 Daniel Eisele 2018-12-23 02:48:58 UTC
I sent this to the ncurses mailing list:
http://lists.gnu.org/archive/html/bug-ncurses/2018-12/msg00031.html
Comment 4 Thomas E. Dickey 2018-12-30 02:06:45 UTC
What's needed is a suggested patch which references a release version of FreeBSD
with whatever turns on the header features needed to compile ncurses, xterm
lynx.  That chunk of configure script is used in more than one program.
Comment 5 Thomas E. Dickey 2018-12-30 11:50:09 UTC
I see that FreeBSD 12 is available for download.  I'll put together an
update for configure script which takes that into account.
Comment 6 John Hein 2018-12-31 18:48:30 UTC
There's some history of this issue affecting other ports, too.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214484

In that case, the port was modified to use pkg-config --cflags-only-I (instead of pkg-config --cflags) to avoid pulling in the -D flags.

It's hard to define flags like -D_POSIX_C_SOURCE=XXX specially for the headers in a particular package (e.g., ncurses) in such a way that they might not interfere with headers of a different package that might want a different value for XXX.
Comment 7 John Hein 2018-12-31 18:53:36 UTC
(In reply to John Hein from comment #6)
> It's hard to define flags like -D_POSIX_C_SOURCE=XXX specially for the headers in a particular package (e.g., ncurses) in such a way that they might not interfere with headers of a different package that might want a different value for XXX.

For portability, one might argue you should support multiple versions of XXX in one's library.  But that can be tedious, error prone, and a maintenance burden.
Comment 8 John Hein 2018-12-31 18:58:53 UTC
(In reply to John Hein from comment #7)
See also this thread:

http://lists.gnu.org/archive/html/bug-ncurses/2016-11/threads.html
Comment 9 John Hein 2018-12-31 19:00:00 UTC
(In reply to John Hein from comment #8)
More specifically:

http://lists.gnu.org/archive/html/bug-ncurses/2016-11/msg00012.html
Comment 10 commit-hook freebsd_committer freebsd_triage 2018-12-31 23:56:05 UTC
A commit references this bug:

Author: swills
Date: Mon Dec 31 23:55:56 UTC 2018
New revision: 488848
URL: https://svnweb.freebsd.org/changeset/ports/488848

Log:
  devel/ncurses: update to 6.1.20181229

  While here:

  * Fix bogus CFLAGS by putting back configure patch [1]
  * Add MANPAGES option [2]

  PR:		234049 [1]
  PR:		186249 [2]
  Submitted by:	Daniel Eisele <daniel_eisele@gmx.de> [1]
  Submitted by:	Zsolt Udvari <uzsolt@uzsolt.hu> [2]

Changes:
  head/devel/ncurses/Makefile
  head/devel/ncurses/distinfo
  head/devel/ncurses/files/
  head/devel/ncurses/files/patch-configure
  head/devel/ncurses/pkg-plist
Comment 11 Steve Wills freebsd_committer freebsd_triage 2019-01-01 00:19:21 UTC
Committed, thanks for the explanation.
Comment 12 Daniel Eisele 2019-01-18 20:04:11 UTC
Patch can be removed again, problem was solved with ncurses version 20190105.