locales woes

Yann E. MORIN yann.morin.1998 at free.fr
Sun Apr 20 16:34:15 UTC 2014


Hello!

While building postgresql with uClibc, we have locales-related build
failures. Here is a small test-case (by Peter) that breaks on uClibc,
but works on glibc:

    ---8<--- test.c ---8<---
    #include <locale.h>
    #include <ctype.h>

    int f(int c, locale_t l)
    {
        return isdigit_l(c, l);
    }
    ---8<---

    $ gcc -Wall -D_GNU_SOURCE -c test.c
    [OK]

    $ i686-buildroot-linux-uclibc-gcc -Wall -D_GNU_SOURCE -c test.c
    test.c: In function ‘f’:
    test.c:5:9: error: dereferencing pointer to incomplete type
    test.c:6:1: warning: control reaches end of non-void function [-Wreturn-type]

What happens is that:
    sysroot/usr/include/locale.h:
        typedef __locale_t locale_t;

    sysroot/usr/include/bits/uClibc_locale.h:
        typedef struct __uclibc_locale_struct *__locale_t;

But struct __uclibc_locale_struct is never defined:

    $ grep -r '__uclibc_locale_struct' sysroot/
    sysroot/usr/include/bits/uClibc_locale.h:struct __uclibc_locale_struct;
    sysroot/usr/include/bits/uClibc_locale.h:typedef struct __uclibc_locale_struct *__locale_t;

So, no actual definition of struct __uclibc_locale_struct, so incomplete
type is being derefenced. :-(


Here are the locales-related options from .config:

    $ grep LOCALE .config
    UCLIBC_HAS_LOCALE=y
    # UCLIBC_BUILD_ALL_LOCALE is not set
    UCLIBC_BUILD_MINIMAL_LOCALE=y
    # UCLIBC_PREGENERATED_LOCALE_DATA is not set
    UCLIBC_BUILD_MINIMAL_LOCALES="en_US"
    UCLIBC_HAS_XLOCALE=y

Any idea?

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'


More information about the uClibc mailing list