[uClibc] Fail to build libstdc++v3 against uClibc w/ xlocale

Carl Miller chaz at energoncube.net
Wed Dec 17 21:18:33 UTC 2003


Hi, crew.  I've been working on adding uClibc support to Dan Kegel's
crosstool, which is used by a lot of people who track the crossgcc
mailing list (crossgcc at sources.redhat.com).  I'm almost there.  But
in the process, I've found two issues with uClibc that needed solving
along the way, so I thought I'd offer patches for them.  Here's the
first one:

If uClibc is configured for extended locale support (__UCLIBC_HAS_XLOCALE__),
recent gcc can't build libstdc++v3.  It will complain about __ctype_b,
__ctype_toupper, and __ctype_tolower not being defined.  This is because
uClibc is reporting itself as GLIBC_2.2 API, which has those three symbols.
However, with extended locale support, those three symbols disappear, and
are instead replaced by __ctype_b_loc, __ctype_toupper_loc, and
__ctype_tolower_loc.  This is consistent with the GLIBC_2.3 API.  Solution:
if extended locale support is enabled, report GLIBC_2.3 API, otherwise
report GLIBC_2.2 API.  This allows libstdc++v3 to build properly against
a uClibc configured either way.

I'm working from the released uClibc 0.9.23, so I apologize if this issue
has been addressed already in the latest CVS; I didn't check there.  Also,
I don't know if declaring GLIBC_2.3 API will have adverse affects elsewhere.
Someone who understands those issues better than I should vet this patch
before putting it into the main tree.  But I can say that with this patch,
I've built gcc's libstdc++v3 against uClibc's configured both with and
without extended locale, and it works fine both ways.


                              ------Carl


===================================================================
RCS file: /home/cvs/tools/uClibc-0.9.23/include/features.h,v
retrieving revision 1.1.1.1
diff -d -u -r1.1.1.1 features.h
--- uClibc-0.9.23/include/features.h	4 Dec 2003 01:27:58 -0000	1.1.1.1
+++ uClibc-0.9.23/include/features.h	16 Dec 2003 20:10:19 -0000
@@ -267,6 +267,11 @@
 #define	__UCLIBC_SUBLEVEL__	12
 #endif
 
+/* Load up the current set of uClibc supported features */
+#define __need_uClibc_config_h
+#include <bits/uClibc_config.h>
+#undef __need_uClibc_config_h
+
 /*  There is an unwholesomely huge amount of code out there that depends on the
  *  presence of GNU libc header files.  We have GNU libc header files.  So here
  *  we commit a horrible sin.  At this point, we _lie_ and claim to be GNU libc
@@ -277,7 +282,11 @@
 #if !defined __FORCE_NOGLIBC && (!defined _LIBC || defined __FORCE_GLIBC)
 #   define __GNU_LIBRARY__ 6
 #   define __GLIBC__       2
+#  ifdef __UCLIBC_HAS_XLOCALE__
+#   define __GLIBC_MINOR__ 3
+#  else
 #   define __GLIBC_MINOR__ 2
+#  endif
 #endif	
 
 /* Convenience macros to test the versions of glibc and gcc.
@@ -333,11 +342,6 @@
 # include <gnu/stubs.h>
 #endif
 
-/* Load up the current set of uClibc supported features */
-#define __need_uClibc_config_h
-#include <bits/uClibc_config.h>
-#undef __need_uClibc_config_h
-
 /* Make sure users large file options agree with uClibc's configuration. */
 #ifndef __UCLIBC_HAS_LFS__
 



More information about the uClibc mailing list