ncurses: fix wide-char enabled compilation for noMMU targets
PATCH 1/1 ncurses: fix wide-char enabled compilation for noMMU targets
For noMMU targets -D_XOPEN_SOURCE_EXTENDED must be explicitely passed to the preprocessor to allow cchar_t usage.
Fixes:
http://autobuild.buildroot.net/results/5bb34ff490c70eea5e4fb497e5228ca1319fffdc/
http://autobuild.buildroot.net/results/8ba1410ed3ffb4954ccc4b7c3996d1839d677bef/
http://autobuild.buildroot.net/results/26ee52ad549b7ef75c9ce4b2eae94f9312cea775/
--- package/ncurses/Config.in | 2 -- package/ncurses/ncurses.mk | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-)
package/ncurses/Config.in +0 -2
@@ -13,8 +13,6 @@ if BR2_PACKAGE_NCURSES config BR2_PACKAGE_NCURSES_WCHAR bool "enable wide char support" depends on BR2_USE_WCHAR - # Build broken @ curses.priv.h with bad declarations - depends on !(BR2_bfin && BR2_BINFMT_FLAT) help Enable wide char & UTF-8 support in ncurses libraries
package/ncurses/ncurses.mk +4 -0
@@ -57,8 +57,12 @@ NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_FORM) += form ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y) NCURSES_CONF_OPTS += --enable-widec +# for noMMU we need to set it explicitely, fixes cchar_t problem +NCURSES_CPPFLAGS += -D_XOPEN_SOURCE_EXTENDED NCURSES_LIB_SUFFIX = w +NCURSES_CONF_ENV += CPPFLAGS="$(NCURSES_CPPFLAGS)" + define NCURSES_LINK_LIBS_STATIC for lib in $(NCURSES_LIBS-y:%=lib%); do \ ln -sf $${lib}$(NCURSES_LIB_SUFFIX).a \
Signature · 1 line
1.7.10.4
PATCH 1/1 ncurses: fix wide-char enabled compilation for noMMU targets
Quoted 38 lines · Waldemar Brodkorb
For noMMU targets -D_XOPEN_SOURCE_EXTENDED must be explicitely passed to the preprocessor to allow
cchar_tusage.Fixes:
http://autobuild.buildroot.net/results/5bb34ff490c70eea5e4fb497e5228ca1319fffdc/
http://autobuild.buildroot.net/results/8ba1410ed3ffb4954ccc4b7c3996d1839d677bef/
http://autobuild.buildroot.net/results/26ee52ad549b7ef75c9ce4b2eae94f9312cea775/Signed-off-by Waldemar Brodkorb <[email protected]>---
package/ncurses/Config.in | 2 -- package/ncurses/ncurses.mk | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-)package/ncurses/Config.in +0
-0@@ -13,8 +13,6 @@ if BR2_PACKAGE_NCURSESconfig
BR2_PACKAGE_NCURSES_WCHAR
bool "enable wide char support"
depends onBR2_USE_WCHARpackage/ncurses/Config.in +0
-2- # Build broken @ curses.priv.h with bad declarations - depends on !(BR2_bfin && BR2_BINFMT_FLAT)help
Enable wide char & UTF-8 support in ncurses librariespackage/ncurses/ncurses.mk +0
-0@@ -57,8 +57,12 @@ NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_FORM) += form ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
NCURSES_CONF_OPTS+= --enable-widec
package/ncurses/ncurses.mk NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_FORM) += form · line 61
Quoted 2 lines
package/ncurses/ncurses.mk +2
-0+# for noMMU we need to set it explicitely, fixes cchar_t problem +NCURSES_CPPFLAGS += -D_XOPEN_SOURCE_EXTENDED
May be you need to define NCURSES_WIDECHAR=1 instead
Quoted 7 lines
NCURSES_LIB_SUFFIX= wpackage/ncurses/ncurses.mk +2
-0+NCURSES_CONF_ENV += CPPFLAGS="$(NCURSES_CPPFLAGS)" +define
NCURSES_LINK_LIBS_STATICfor lib in $(NCURSES_LIBS-y:%=lib%); do \ ln -sf $${lib}$(NCURSES_LIB_SUFFIX).a \
Quoted 7 lines
--
1.7.10.4_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160803/f5361583/attachment.asc>
PATCH 1/1 ncurses: fix wide-char enabled compilation for noMMU targets
Hello,
Quoted 6 lines · Khem Raj
package/ncurses/ncurses.mk NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_FORM) += form · line 61
Quoted 4 lines
ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
NCURSES_CONF_OPTS+= --enable-widecpackage/ncurses/ncurses.mk +2
-0+# for noMMU we need to set it explicitely, fixes cchar_t problem +NCURSES_CPPFLAGS += -D_XOPEN_SOURCE_EXTENDEDMay be you need to define NCURSES_WIDECHAR=1 instead
Cannot work (at least without patching) : it gets undef'ed by ncurses:
#undef NCURSES_WIDECHAR
#if defined(_XOPEN_SOURCE_EXTENDED) || defined(_XPG5) #define NCURSES_WIDECHAR
#endif
But this test from ncurses is weird. My understanding of the feature macros like _XOPEN_SOURCE_EXTENDED is that they should be *defined* by the program/library that wants to use the specific features hidden behind this macro. This is what
https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
explains.
So why is ncurses *testing* this?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 ncurses: fix wide-char enabled compilation for noMMU targets
In reply to Waldemar BrodkorbWaldemar, All,
On 2016-07-31 10:28 +0200, Waldemar Brodkorb spake thusly:
Quoted 32 lines
For noMMU targets -D_XOPEN_SOURCE_EXTENDED must be explicitely passed to the preprocessor to allow
cchar_tusage.Fixes:
http://autobuild.buildroot.net/results/5bb34ff490c70eea5e4fb497e5228ca1319fffdc/
http://autobuild.buildroot.net/results/8ba1410ed3ffb4954ccc4b7c3996d1839d677bef/
http://autobuild.buildroot.net/results/26ee52ad549b7ef75c9ce4b2eae94f9312cea775/Signed-off-by Waldemar Brodkorb <[email protected]>--- package/ncurses/Config.in | 2 -- package/ncurses/ncurses.mk | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-)package/ncurses/Config.in +0
-2@@ -13,8 +13,6 @@ if BR2_PACKAGE_NCURSES config BR2_PACKAGE_NCURSES_WCHAR bool "enable wide char support" depends on BR2_USE_WCHAR - # Build broken @ curses.priv.h with bad declarations - depends on !(BR2_bfin && BR2_BINFMT_FLAT) help Enable wide char & UTF-8 support in ncurses librariespackage/ncurses/ncurses.mk +0
-0
package/ncurses/ncurses.mk NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_FORM) += form · line 61
Quoted 5 lines
package/ncurses/ncurses.mk +2
-0@@ -57,8 +57,12 @@ NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_FORM) += form ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y) NCURSES_CONF_OPTS += --enable-widec +# for noMMU we need to set it explicitely, fixes cchar_t problem +NCURSES_CPPFLAGS += -D_XOPEN_SOURCE_EXTENDED
As noticed by Thomas, I don't think this is the correct solution.
If you look at configure.in, you'll see they have a test to decide whether _XOPEN_SOURCE_EXTENDED is needed or not. For targets with an MMU, this test is checked, while it is not for a noMMU target. (Yes, for an MMU platform, the test concludes that defining it is not needed.)
I think the correct solution would be to see why this test does not pass for noMMU.
Adn the reason it does not is that it decides to add -D_XOPEN_SOURCE=500 to CPPFLAGS when calling CF_XOPEN_SOURCE(500) (line 697 in configure.in)
The function checks for ${host_os} for various well-known values. One interesting well-known value is (sxerpt from aclocal.m4):
6504 case $host_os in #(vi
[...]
6534 linux*|gnu*|mint*|k*bsd*-gnu) #(vi
6535 CF_GNU_SOURCE
6536 ;;
[...]
6561 *)
6562 AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
[...]
6587 esacSee the value on line 6534? It is only about 'linux*'. But then when you look at how we call ./configure:
./configure \
--target=m68k-buildroot-uclinux-uclibc \
--host=m68k-buildroot-uclinux-uclibc \
[...]So, host_os=uclinux-uclibc and then it does not match 'linux*' and then CF_XOPEN_SOURCE falls back to the generic case, which checks wrong for uclinux.
So, the coirrect solution would seem to be to fix CF_XOPEN_SOURCE to also include 'uclinux*' in the case, above.
And indeed, doing so does fix the build. ;-)
I'll send a patch shortly (after I clean up all my dirty traces in configure...). In the meantime, I've marked your patch as rejected in patchwork.
Thanks for triggering this investigation on my side! ;-)
Regards,
Yann E. MORIN.
Quoted 14 lines
package/ncurses/ncurses.mk +2
-0NCURSES_LIB_SUFFIX = w +NCURSES_CONF_ENV += CPPFLAGS="$(NCURSES_CPPFLAGS)" + define NCURSES_LINK_LIBS_STATIC for lib in $(NCURSES_LIBS-y:%=lib%); do \ ln -sf $${lib}$(NCURSES_LIB_SUFFIX).a \Signature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'