On Thu, Feb 24, 2011 at 11:01 AM, Filippo ARCIDIACONO
<[email protected]> wrote:
>
> You don't need any patches to make locale support working on uClibc,
> You need only the locale installed on your host as Rob suggested, this
> Allow you to build locale data into the uClibc depending on uClibc
> cunfiguration.
> You can choose to build all locale (see extra/locale/LOCALES) or a
> subset removing the unneded one, reducing the size of the uclibc.
> Alternatively you can to enable UCLIBC_BUILD_MINIMAL_LOCALE
> (only UTF-8 and ISO-8859-1).
> Hope this can help you.
I suppose you misunderstood me. It's not a surprise, since my english
is not so good. It was also may be confusing due you always have
*glibc host* by hand. I'll try to explain in more detail.
Before: I had uclibc, which has been built with "UCLIBC_HAS_LOCALE is not set".
Then: I got bad "?" symbols in Kbuild's make menuconfig. Researching
the source of this problem, I found that this is not ncurses' bug, nor
even Kbuild's bug. It was due I have no locales support in my standard
C library (which *is uclibc*, and *not glibc*, and yes, on host, i.e.
on the system where I'm building, not only on the target system - i.e.
system I'm building for; again: in my case, host and target are the
same - it's uclibc on the same architecture).
But... uClibc cannot be bootstrapped with locales support (from the
existing uclibc system without locales support), at least without some
kind of patching. First: it has stub 'setlocale' function. Let's dive
into ./libc/misc/locale/locale.c :
#ifndef __UCLIBC_HAS_LOCALE__
#define __LOCALE_C_ONLY
#endif /* __UCLIBC_HAS_LOCALE__ */
#ifdef __LOCALE_C_ONLY
link_warning(setlocale,"REMINDER: The 'setlocale' function supports
only C|POSIX locales.")
static const char C_string[] = "C";
char *setlocale(int category, register const char *locale)
{
return ( (((unsigned int)(category)) <= LC_ALL)
&& ( (!locale) /* Request for locale
category string. */
|| (!*locale) /*
Implementation-defined default is C. */
|| ((*locale == 'C') && !locale[1])
|| (!strcmp(locale, "POSIX"))) )
? (char *) C_string /* Always in C/POSIX locale. */
: NULL;
}
#else /* ---------------------------------------------- __LOCALE_C_ONLY */
But, to get locales-aware uclibc, you will eventually build and then
run (directing the output to the .h file) ./extra/locale/gen_wc8bit.c
and gen_wctype.c, which do rely on setlocale:
if (!setlocale(LC_CTYPE, "en_US.UTF-8")) {
FILE *fp = popen("locale -a", "r");
if (!fp)
goto locale_failure;
locale_failure:
printf("could not find a UTF8 locale ... please enable
en_US.UTF-8\n");
return EXIT_FAILURE;
Plus, uclibc doesn't have 'locale' command. For me, even now, when I
got locales-aware uclibc (symbols are now correct). It just simply
doesn't build (no .o files in ./extra/locale/programs).
Hope you got my issue now.
--Douglas
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc