toolchain: uClibc: fix compile with full language support enabled (fixes #13095)
authorFelix Fietkau <nbd@openwrt.org>
Sun, 30 Nov 2014 22:22:24 +0000 (22:22 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 30 Nov 2014 22:22:24 +0000 (22:22 +0000)
When building with CONFIG_BUILD_NLS=y, uClibc fails to compile with following
message (or similar, according to https://dev.openwrt.org/ticket/13095):

-snip-
...
Warning: adding UNDEFINED entry for ar_AE
Warning: adding UNDEFINED entry for am_ET
Warning: adding UNDEFINED entry for af_ZA
grep "^#define" extra/locale/locale_tables.h > extra/locale/lt_defines.h
grep "^#define __lc" extra/locale/locale_collate.h >> extra/locale/lt_defines.h
gcc extra/locale/gen_wctype.c  -o extra/locale/gen_wctype    -Os -Wall  -D__UCLIBC_GEN_LOCALE -I./
extra/locale/gen_wctype.c: In function 'main':
extra/locale/gen_wctype.c:684:2: warning: #warning fix the upper bound on the upper/lower tables... save 200 bytes or so [-Wcpp]
for locale in  en_US en_GB; do \
                extra/locale/gen_wctype  $locale > extra/locale/wctables.h || \
                extra/locale/gen_wctype  $locale.UTF-8 > extra/locale/wctables.h || \
                extra/locale/gen_wctype  $locale.iso8859-1 > extra/locale/wctables.h && break; \
        done
make[4]: *** [extra/locale/wctables.h] Error 1
-snap-

This seems to also depend on the host system used, e.g. running a fresh
checkout on a Debian 7.6 system triggered this error, while running the
very same stuff on an Ubuntu 12.10 Quantal Quetzal does not trigger it.

This is the configuration I used:

-snip-
buildbot@buildbot:~/openwrt-nls.git$ scripts/diffconfig.sh
CONFIG_TARGET_ar71xx=y
CONFIG_TARGET_ar71xx_generic=y
CONFIG_TARGET_ar71xx_generic_Default=y
CONFIG_DEVEL=y
CONFIG_BUILD_NLS=y
CONFIG_DOWNLOAD_FOLDER="/srv/downloads/downloads"
-snap-

In the ticket mentioned above, a patch is referenced which solves this issue.

Note, that this issue is also present on 14.07.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
SVN-Revision: 43446

toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch [new file with mode: 0644]

diff --git a/toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch b/toolchain/uClibc/patches-0.9.33.2/991-gen_wctype.patch
new file mode 100644 (file)
index 0000000..b3db8cf
--- /dev/null
@@ -0,0 +1,183 @@
+--- a/extra/locale/gen_wctype.c
++++ b/extra/locale/gen_wctype.c
+@@ -227,11 +227,12 @@
+                       ++verbose;
+                       continue;
+               }
+-              if (!setlocale(LC_CTYPE, *argv)) {
++      /* setlocale might be just a stub */
++      /*      if (!setlocale(LC_CTYPE, *argv)) {
+                       verbose_msg("setlocale(LC_CTYPE,%s) failed!  Skipping this locale...\n", *argv);
+                       continue;
+               }
+-
++      */
+               if (!(totitle = wctrans("totitle"))) {
+                       verbose_msg("no totitle transformation.\n");
+               }
+@@ -306,43 +307,43 @@
+ #endif
+ #if 0
+                               if (c < 256) {
+-                                      unsigned int glibc;
++                                      unsigned int curr_stdclib;
+-                                      glibc = 0;
+-                                      if (isalnum(c)) ++glibc; glibc <<= 1;
+-                                      if (isalpha(c)) ++glibc; glibc <<= 1;
+-                                      if (isblank(c)) ++glibc; glibc <<= 1;
+-                                      if (iscntrl(c)) ++glibc; glibc <<= 1;
+-                                      if (isdigit(c)) ++glibc; glibc <<= 1;
+-                                      if (isgraph(c)) ++glibc; glibc <<= 1;
+-                                      if (islower(c)) ++glibc; glibc <<= 1;
+-                                      if (isprint(c)) ++glibc; glibc <<= 1;
+-                                      if (ispunct(c)) ++glibc; glibc <<= 1;
+-                                      if (isspace(c)) ++glibc; glibc <<= 1;
+-                                      if (isupper(c)) ++glibc; glibc <<= 1;
+-                                      if (isxdigit(c)) ++glibc;
+-                                      verbose_msg("%#8x : ctype %#4x\n", c, glibc);
++                                      curr_stdclib = 0;
++                                      if (isalnum(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (isalpha(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (isblank(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iscntrl(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (isdigit(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (isgraph(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (islower(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (isprint(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (ispunct(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (isspace(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (isupper(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (isxdigit(c)) ++curr_stdclib;
++                                      verbose_msg("%#8x : ctype %#4x\n", c, curr_stdclib);
+                               }
+ #endif
+ #if 1
+                               /* Paranoid checking... */
+                               {
+-                                      unsigned int glibc;
++                                      unsigned int curr_stdclib;
+                                       unsigned int mine;
+-                                      glibc = 0;
+-                                      if (iswalnum(c)) ++glibc; glibc <<= 1;
+-                                      if (iswalpha(c)) ++glibc; glibc <<= 1;
+-                                      if (iswblank(c)) ++glibc; glibc <<= 1;
+-                                      if (iswcntrl(c)) ++glibc; glibc <<= 1;
+-                                      if (iswdigit(c)) ++glibc; glibc <<= 1;
+-                                      if (iswgraph(c)) ++glibc; glibc <<= 1;
+-                                      if (iswlower(c)) ++glibc; glibc <<= 1;
+-                                      if (iswprint(c)) ++glibc; glibc <<= 1;
+-                                      if (iswpunct(c)) ++glibc; glibc <<= 1;
+-                                      if (iswspace(c)) ++glibc; glibc <<= 1;
+-                                      if (iswupper(c)) ++glibc; glibc <<= 1;
+-                                      if (iswxdigit(c)) ++glibc;
++                                      curr_stdclib = 0;
++                                      if (iswalnum(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iswalpha(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iswblank(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iswcntrl(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iswdigit(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iswgraph(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iswlower(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iswprint(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iswpunct(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iswspace(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iswupper(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                                      if (iswxdigit(c)) ++curr_stdclib;
+                                       mine = 0;
+                                       if (mywalnum(d,c)) ++mine; mine <<= 1;
+@@ -358,15 +359,15 @@
+                                       if (mywupper(d,c)) ++mine; mine <<= 1;
+                                       if (mywxdigit(d,c)) ++mine;
+-                                      if (glibc != mine) {
+-                                              verbose_msg("%#8x : glibc %#4x != %#4x mine  %u\n", c, glibc, mine, d);
++                                      if (curr_stdclib != mine) {
++                                              verbose_msg("%#8x : curr_stdclib %#4x != %#4x mine  %u\n", c, curr_stdclib, mine, d);
+                                               return EXIT_FAILURE;
+                                       }
+ #if 0
+                                       if (iswctype(c,is_comb) || iswctype(c,is_comb3)) {
+ /*                                            if (!iswpunct(c)) { */
+                                                       verbose_msg("%#8x : %d %d %#4x\n",
+-                                                                 c, iswctype(c,is_comb),iswctype(c,is_comb3), glibc);
++                                                                 c, iswctype(c,is_comb),iswctype(c,is_comb3), curr_stdclib);
+ /*                                            } */
+                                       }
+ #endif
+@@ -553,7 +554,7 @@
+               for (c = 0; c <= 0x10ffffUL; c++)
+ #endif
+               {
+-                      unsigned int glibc;
++                      unsigned int curr_stdclib;
+                       unsigned int mine;
+                       unsigned int upper, lower;
+@@ -568,19 +569,19 @@
+                       }
+ #endif
+ #endif
+-                      glibc = 0;
+-                      if (iswalnum(c)) ++glibc; glibc <<= 1;
+-                      if (iswalpha(c)) ++glibc; glibc <<= 1;
+-                      if (iswblank(c)) ++glibc; glibc <<= 1;
+-                      if (iswcntrl(c)) ++glibc; glibc <<= 1;
+-                      if (iswdigit(c)) ++glibc; glibc <<= 1;
+-                      if (iswgraph(c)) ++glibc; glibc <<= 1;
+-                      if (iswlower(c)) ++glibc; glibc <<= 1;
+-                      if (iswprint(c)) ++glibc; glibc <<= 1;
+-                      if (iswpunct(c)) ++glibc; glibc <<= 1;
+-                      if (iswspace(c)) ++glibc; glibc <<= 1;
+-                      if (iswupper(c)) ++glibc; glibc <<= 1;
+-                      if (iswxdigit(c)) ++glibc;
++                      curr_stdclib = 0;
++                      if (iswalnum(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                      if (iswalpha(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                      if (iswblank(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                      if (iswcntrl(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                      if (iswdigit(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                      if (iswgraph(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                      if (iswlower(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                      if (iswprint(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                      if (iswpunct(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                      if (iswspace(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                      if (iswupper(c)) ++curr_stdclib; curr_stdclib <<= 1;
++                      if (iswxdigit(c)) ++curr_stdclib;
+                       {
+                               unsigned int u;
+@@ -630,8 +631,8 @@
+                               if (mywupper(d,c)) ++mine; mine <<= 1;
+                               if (mywxdigit(d,c)) ++mine;
+-                              if (glibc != mine) {
+-                                      verbose_msg("%#8x : glibc %#4x != %#4x mine %d\n", c, glibc, mine, d);
++                              if (curr_stdclib != mine) {
++                                      verbose_msg("%#8x : curr_stdclib %#4x != %#4x mine %d\n", c, curr_stdclib, mine, d);
+                                       if (c < 0x30000UL) {
+                                               verbose_msg("sc=%#x u=%#x n=%#x i0=%#x i1=%#x\n", sc, u, n, i0, i1);
+                                       }
+@@ -655,17 +656,17 @@
+                               }
+                               if (towupper(c) != upper) {
+-                                      verbose_msg("%#8x : towupper glibc %#4x != %#4x mine\n",
++                                      verbose_msg("%#8x : towupper curr_stdclib %#4x != %#4x mine\n",
+                                                  c, towupper(c), upper);
+                               }
+                               if (towlower(c) != lower) {
+-                                      verbose_msg("%#8x : towlower glibc %#4x != %#4x mine   i0 = %d\n",
++                                      verbose_msg("%#8x : towlower curr_stdclib %#4x != %#4x mine   i0 = %d\n",
+                                                  c, towlower(c), lower, i0);
+                               }
+                               if (totitle && ((tt = towctrans(c, totitle)) != upper)) {
+-                                      verbose_msg("%#8x : totitle glibc %#4lx != %#4x mine   i0 = %d\n",
++                                      verbose_msg("%#8x : totitle curr_stdclib %#4lx != %#4x mine   i0 = %d\n",
+                                                  c, tt, upper, i0);
+                               }
+                       }