Trying to cross-compile gcc-3.4.6 using uClibc CVS HEAD produces this error: monetary_members.cc: In member function `void std::moneypunct<_CharT, _Intl>::_M_initialize_moneypunct(int*, const char*) [with _CharT = wchar_t, bool _Intl = true]': monetary_members.cc:412: error: `__global_locale' was not declared in this scope monetary_members.cc: In member function `void std::moneypunct<_CharT, _Intl>::_M_initialize_moneypunct(int*, const char*) [with _CharT = wchar_t, bool _Intl = false]': monetary_members.cc:570: error: `__global_locale' was not declared in this scope Using uClibc 0.9.30 everything is ok. gcc-3.4.6 is patched using this: http://cvs.tuxbox.org/cgi-bin/viewcvs.cgi/tuxbox/cdk/Patches/gcc-uclibc.diff?view=markup which is based on http://sources.busybox.net/index.py/trunk/buildroot/toolchain/gcc/4.2.4/200-uclibc-locale.patch?view=markup Revoking all of these SVN commits from HEAD lets gcc-3.4.6 compile: ------------------------------------------------------------------------ r24572 | vda | 2008-12-28 13:06:04 +0100 (So, 28. Dez 2008) | 3 lines fix another corner case in unifdef ------------------------------------------------------------------------ r24570 | vda | 2008-12-28 12:48:01 +0100 (So, 28. Dez 2008) | 4 lines patch up unifdef to recognize and remove "#if defined _LIBC && something" blocks too (and similar) ------------------------------------------------------------------------ r24565 | vda | 2008-12-27 12:01:17 +0100 (Sa, 27. Dez 2008) | 3 lines Help unifdef to remove private parts of headers I do not know which commit exactly is responsible for the compile error and I do not have the knowledge to further debug this.
Created attachment 23 [details] diff of uClibc_locale.h shows removed code Attached you will find the diff of uClibc-generated include/bits/uClibc_locale.h As you can see the unpatched uClibc SVN HEAD removes a lot of lines from this file, including extern struct __uclibc_locale_struct * __global_locale; work_uclibc_head/image/cdkroot/include/bits/uClibc_locale.h is the file produced by unpatched uClibc SVN HEAD work_uclibc/image/cdkroot/include/bits/uClibc_locale.h is the file produced by uClibc SVN HEAD, with commits 24565-24572 removed
Created attachment 25 [details] uClibc .config
Created attachment 29 [details] The patch which *possibly* fixes it Please try it and let me know whether it works.
Using latest SVN HEAD now produces this error message: monetary_members.cc: In member function `void std::moneypunct<_CharT, _Intl>::_M_initialize_moneypunct(int*, const char*) [with _CharT = wchar_t, bool _Intl = true]': monetary_members.cc:412: error: invalid use of undefined type `struct __uclibc_locale_struct' /root/tuxbox/work_uclibc/image/cdk/powerpc-tuxbox-linux-uclibc/include/bits/uClibc_locale.h:93: error: forward declaration of `struct __uclibc_locale_struct' monetary_members.cc:413: error: invalid use of undefined type `struct __uclibc_locale_struct' /root/tuxbox/work_uclibc/image/cdk/powerpc-tuxbox-linux-uclibc/include/bits/uClibc_locale.h:93: error: forward declaration of `struct __uclibc_locale_struct' monetary_members.cc: In member function `void std::moneypunct<_CharT, _Intl>::_M_initialize_moneypunct(int*, const char*) [with _CharT = wchar_t, bool _Intl = false]': monetary_members.cc:570: error: invalid use of undefined type `struct __uclibc_locale_struct' /root/tuxbox/work_uclibc/image/cdk/powerpc-tuxbox-linux-uclibc/include/bits/uClibc_locale.h:93: error: forward declaration of `struct __uclibc_locale_struct' monetary_members.cc:571: error: invalid use of undefined type `struct __uclibc_locale_struct' /root/tuxbox/work_uclibc/image/cdk/powerpc-tuxbox-linux-uclibc/include/bits/uClibc_locale.h:93: error: forward declaration of `struct __uclibc_locale_struct'
The solution which works here is to copy the original libc/sysdeps/linux/common/bits/uClibc_locale.h to $PREFIX/include/bits
Another bug shows up later in the compile process: In file included from /root/tuxbox/work_uclibc2/compile/cdk/build_gcc/powerpc-tuxbox-linux-uclibc/nof/libstdc++-v3/include/csignal:49, from /root/tuxbox/work_uclibc2/compile/cdk/gcc-3.4.6/libstdc++-v3/include/stdc++.h:42: /root/tuxbox/work_uclibc2/image/cdk/powerpc-tuxbox-linux-uclibc/include/signal.h:372:24: ucontext.h: No such file or directory In file included from /root/tuxbox/work_uclibc2/compile/cdk/build_gcc/powerpc-tuxbox-linux-uclibc/nof/libstdc++-v3/include/csignal:49, from /root/tuxbox/work_uclibc2/compile/cdk/gcc-3.4.6/libstdc++-v3/include/stdc++.h:42: /root/tuxbox/work_uclibc2/image/cdk/powerpc-tuxbox-linux-uclibc/include/signal.h:372:24: ucontext.h: No such file or directory The reason is this patch: http://sources.busybox.net/index.py/trunk/uClibc/Makefile.in?r1=24405&r2=24595&diff_format=h I am compiling uClibc with UCLIBC_SUSV3_LEGACY disabled in this case. Removing these lines from signal.h fixes the compile problem: # ifdef __USE_XOPEN /* This will define `ucontext_t' and `mcontext_t'. */ # include <ucontext.h> # endif but it may have side-effects I am not aware of.
Ok. You patched the gcc. The error happens here: +#ifdef __UCLIBC_MJN3_ONLY__ +#warning fix this... should be monetary +#endif +#ifdef __UCLIBC__ +# ifdef __UCLIBC_HAS_XLOCALE__ + _M_data->_M_decimal_point = __cloc->decimal_point_wc; + _M_data->_M_thousands_sep = __cloc->thousands_sep_wc; +# else + _M_data->_M_decimal_point = __global_locale->decimal_point_wc; + _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc; +# endif +#else I have no idea why this patch attempts to use uclibc internals. It is not supposed to ever do it. I will revert my "fix". Please work with patch author to stop using uclibc internals.
I meant that error happens in that place in the libstdc++-v3/config/locale/uclibc/monetary_members.cc This file is created by the patch you applied to gcc tree.
> I am compiling uClibc with UCLIBC_SUSV3_LEGACY disabled in this case. Perhaps you need to enable it then
(In reply to comment #7) > Please work with patch author to stop using uclibc internals. Hi, who maintains the patch which can be found on your SVN in the buildroot section? Or in other words, will the buildroot suffer from the same problem with uClibc SVN HEAD and <= gcc-4.2.4? In regard to signal.h I reactivated UCLIBC_SUSV3_LEGACY (mainly because I am too lazy to port usleep() to nanosleep(), but thats another topic), but I think other software will suffer from the same problem, a header is included which is not present.
I guess you need to talk to buildroot project: http://buildroot.uclibc.org/ http://buildroot.uclibc.org/lists.html
For the record, this patch fixes the problem: http://lists.uclibc.org/pipermail/uclibc/2009-February/041918.html I know this patch will not make it into CVS, but it works;)
I think that this works as expected with the 0.9.30.1 release. Note that the (c++) locale support for any supported gcc version needs a re-implementation based off generic support. This is a known TODO at the time of this writing, sensible, tested patches welcome.
A clean reimplementation in gcc is in order for everything > 0.9.30.