[Buildroot] [PATCH] package/lshw: fix the build with glibc without NLS

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Fri Jul 14 19:40:32 UTC 2017


Hello,

On Fri, 14 Jul 2017 00:10:39 +0200, Romain Naour wrote:

> > ifeq ($(BR2_SYSTEM_ENABLE_NLS),)
> > LSHW_CFLAGS += -DNONLS
> > endif  
> 
> Indeed, that's the first thing I removed during investigation.
> 
> I find misleading that BR2_SYSTEM_ENABLE_NLS not set does not mean NONLS for lshw.

I think that's OK. For lshw, NONLS really means "there is absolutely no
gettext functions provided by the C library", which is never the case
in the context of Buildroot.

Can you send an updated patch that simply removes the -DNONLS ?

> I'm wondering if lshw build fine with a toolchain with wchar but without locale
> (ok it's a corner case).
> 
> See src/lshw.cc:#ifndef NONLS
> 
> #ifndef NONLS
> #include <locale.h>
> #endif
> 
> ...
> 
> #ifndef NONLS
>   setlocale (LC_ALL, "");

Not a problem I believe. From libc/misc/locale/Makefile.in in uClibc-ng:

# multi source locale.c
CSRC-y := setlocale.c localeconv.c _locale_init.c nl_langinfo.c
CSRC-$(UCLIBC_HAS_LOCALE) += newlocale.c __locale_mbrtowc_l.c
CSRC-$(UCLIBC_HAS_XLOCALE) += nl_langinfo_l.c duplocale.c freelocale.c \
        uselocale.c __curlocale.c

Hence, it seems like a uClibc-ng built with UCLIBC_HAS_LOCALE disabled
will still have a setlocale() function.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com



More information about the buildroot mailing list