[uClibc] problem with string.h strerror_r

Erich Buri buri at z17.net
Sun Nov 7 23:17:25 UTC 2004


Hello,

I try to compile the Common C++ library 
http://sourceforge.net/projects/cplusplus/ using uClibc for arm.
(Built a gcc-3.3.x-Toolchain from a tar-ball from cvs)

Unfortunatly I can not build it because it complains about an in the 
definition of strerror_r in string.h.

Now, since I found this comment there:

/* uClibc Note: glibc's strerror_r is different from that specified in 
SUSv3.
  * So we try to compensate based on feature macros. */

I thought that maybe one on this list could help me out. I don't know 
much about these header files and this macro-kung-fu.

What could I do? Did anybody have the same problem before? The library 
compiled fine with glibc, although x86 but I think it's not a matter of 
plattform.

Maybe it's not a good idea to use Common C++ at all. I wanted to use 
this Library because of the convenient Thread class. Maybe anybody knows 
an other library that provides such an easy to use Thread class?

On the other hand I think it would be nice if people would be able to 
use this library with uClibc.

Here's what I did:

I configure it using:
(PATH=/home/buri/uclibc/gcc-3.3.x/toolchain_arm/arm-linux-uclibc/bin:/home/buri/bin:/usr/local/bin:...)

cd commoncpp2-1.2.5/
./configure --prefix=$TARGET_PREFIX --build=i386 --host=arm-linux 
--without-compression --without-libxml2 --with-gnu-ld

...
...
...

make

if /bin/sh ../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. 
-I../include    -I../src -DCCXX_EXPORT_LIBRARY  -I../include -g -O2 
-I/home/buri/uclibc/gcc-3.3.x/toolchain_arm/arm-linux/include 
-D_GNU_SOURCE -MT thread.lo -MD -MP -MF ".deps/thread.Tpo" -c -o 
thread.lo thread.cpp; \
then mv -f ".deps/thread.Tpo" ".deps/thread.Plo"; else rm -f 
".deps/thread.Tpo"; exit 1; fi
  g++ -DHAVE_CONFIG_H -I. -I. -I../include -I../src 
-DCCXX_EXPORT_LIBRARY -I../include -g -O2 
-I/home/buri/uclibc/gcc-3.3.x/toolchain_arm/arm-linux/include 
-D_GNU_SOURCE -MT thread.lo -MD -MP -MF .deps/thread.Tpo -c thread.cpp 
-o thread.o
In file included from 
/home/buri/uclibc/gcc-3.3.x/toolchain_arm/arm-linux-uclibc/lib/../arm-linux-uclibc/sys-include/sys/un.h:38,
                  from ../include/cc++/config.h:731,
                  from thread.cpp:41:
/home/buri/uclibc/gcc-3.3.x/toolchain_arm/arm-linux-uclibc/lib/../arm-linux-uclibc/sys-include/string.h:273: 
error: parse
    error before `char'
make: *** [thread.lo] Error 1

Apparently it's about the reentrent strerror_r:

------- string.h -------------

/* Reentrant version of `strerror'.  If a temporary buffer is required, at
    most BUFLEN bytes of BUF will be used.  */
/* extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) 
__THROW; */

/* uClibc Note: glibc's strerror_r is different from that specified in 
SUSv3.
  * So we try to compensate based on feature macros. */
extern char *_glibc_strerror_r (int __errnum, char *__buf, size_t 
__buflen) __THROW;
extern int _susv3_strerror_r (int __errnum, char *__buf, size_t buflen) 
__THROW;

#if defined(__USE_XOPEN2K) && !defined(__USE_GNU)
# ifdef __REDIRECT
extern int __REDIRECT (strerror_r,
                        (int __errnum, char *__buf, size_t buflen) __THROW,
                        _susv3_strerror_r);
# else
#  define strerror_r _susv3_strerror_r
# endif
#else  /* defined(__USE_XOPEN2K) && !defined(__USE_GNU) */
# ifdef __REDIRECT
extern char *__REDIRECT (strerror_r,
                          (int __errnum, char *__buf, size_t buflen) 
__THROW,
                          _glibc_strerror_r);
# else
#  define strerror_r _glibc_strerror_r
# endif
#endif /* defined(__USE_XOPEN2K) && !defined(__USE_GNU) */
#endif
------- string.h -------------


Thank for any help, being able to compile this library could save me a 
lot of time since I just wanted to port this application, not rewrite it.

regards
Erich Buri



More information about the uClibc mailing list