解决uClibc交叉编译错误

2018-07-06  本文已影响0人  hades2013

编译出错

# [extra/locale/locale_mmap.h:46: error: '__LOCALE_DATA_WCctype_II_LEN' undeclared here (not in a function)](https://stackoverflow.com/questions/11963280/extra-locale-locale-mmap-h46-error-locale-data-wcctype-ii-len-undeclared)

[Ask](https://stackoverflow.com/questions/ask)

找原因,发现同样的错误

https://stackoverflow.com/questions/11963280/extra-locale-locale-mmap-h46-error-locale-data-wcctype-ii-len-undeclared/28906427#28906427

按照解决方法处理,结果还是出错。

然后要到了错误原因和patch文件
错误原因如下:
https://dev.archive.openwrt.org/ticket/13095
patch文件如下:

http://ftp.osuosl.org/pub/manulix/scripts/build-scripts/PPFILES/ppfiles-uclibc/gen_wctype.patch

patch文件

--- 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);
                }
            }

因为uClibc的版本不同,打patch可能出错,可根据patch与gen_wctype.c文件的对比来修改gen_wctype.c文件,这样就能解决了!

上一篇下一篇

猜你喜欢

热点阅读