On 17/02/2017 10:17, Laszlo Ersek wrote: > Of course, *if* that other C library, and the Curses implementation, > claim compatibility with glibc as far as _GNU_SOURCE goes, *then* I > fully agree with you. (IOW, it depends on the condition that you > formulated above, "if musl wants to support _GNU_SOURCE".)
They at least try, since their features.h supports it. > Same for ncurses -- do they aim at SUSv2 conformance, or do they intend > to consider _GNU_SOURCE specifically? Well, ncurses is a GNU project so I suppose they mostly care about whatever Autoconf does. And indeed Autoconf does have some special casing for -D_XOPEN_SOURCE=500: AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], [ac_cv_should_define__xopen_source], [ac_cv_should_define__xopen_source=no AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ #include <wchar.h> mbstate_t x;]])], [], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[ #define _XOPEN_SOURCE 500 #include <wchar.h> mbstate_t x;]])], [ac_cv_should_define__xopen_source=yes])])]) test $ac_cv_should_define__xopen_source = yes && AC_DEFINE([_XOPEN_SOURCE], [500]) If musl needs _XOPEN_SOURCE for wchar.h, then it would be worth working around in QEMU. If it's just happening with ncurses, however, it'd be a musl bug, which should be fixed in musl or worked around in ncurses. Chad, can you check whether the programs below fails with musl: /* First program */ #define _GNU_SOURCE #include <wchar.h> mbstate_t x; /* Second program */ #include <wchar.h> mbstate_t x; /* Third program */ #define _XOPEN_SOURCE 500 #include <wchar.h> mbstate_t x; Just compile them with "gcc foo.c -O2". Thanks, Paolo