On 6 April 2017 at 19:36, Peter Maydell <peter.mayd...@linaro.org> wrote: > On 6 April 2017 at 19:15, Rainer Müller <rai...@codingfarm.de> wrote: >> A bit late to this thread, but the original problem was also reported >> for Mac OS X with --enable-curses in MacPorts. The build fails with the >> same symptoms as in the original report. >> >> https://trac.macports.org/ticket/53929 >> >> As you identified, the problem is that ncurses expects the define >> _XOPEN_SOURCE >= 500 to enable the wide-char function declarations. >> >> The solution to retain access to non-standard API on Mac OS X would be >> to also define _DARWIN_C_SOURCE which enables extensions. > > Thanks for the report. I have a feeling that fixing this bug > got lost somewhere -- there was a long thread about it but I > don't think an actual patch ever came out of it :-(
I've got back to looking at this, and it turns out that the situation is a complete mess. In particular, on OSX if you define _XOPEN_SOURCE=600 then it causes _POSIX_C_SOURCE to be set such that the getpagesize() prototype is not provided, and even if you set _DARWIN_C_SOURCE this does not override that. Similarly, on FreeBSD if you define _XOPEN_SOURCE then it doesn't provide any APIs that aren't in that standard and there is no provided mechanism at all to say "and also the FreeBSD APIs" please. My conclusion from this is that we must not set _XOPEN_SOURCE, but instead have to tell ncurses directly that we definitely want the widechar prototypes, by defining NCURSES_WIDECHAR. Since ncurses 20111030 this is sufficient I think; if you're still using an older ncurses then you'll need to upgrade it (older ncurses ignore NCURSES_WIDECHAR and only pay attention to _XOPEN_SOURCE_EXTENDED, etc). thanks -- PMM