[uClibc]strange error (undefined reference to stderr)

Manuel Novoa III mjn3 at uclibc.org
Sun Jul 22 15:45:20 UTC 2001


On Sun, Jul 22, 2001 at 01:38:54PM +0200, Oliver Dawid wrote:
> hi,
> 
> what does this mean? stderr is defined and i can use it but from libgcc.a
> it is not possible? maybe, its not my day today ...
> 
> --snip---
> gcc -rdynamic -s -Wl,-rpath,./lib/ -o sbl sbl.o misc.o beeps.o \
> cut-n-paste.o inskey_lnx.o brl_load.o spk.o libspeech.a scr.o scrdev.o \
> scr_vcsa.o  -L. -lspeech -ldl
> /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/libgcc.a(_eh.o): In
> function `__eh_rtime_match':
> /home/od/gcc-2.95.3/gcc/./libgcc2.c(.text+0x43d): undefined reference to
> `stderr'
> collect2: ld returned 1 exit status
> ---snip---
> 
> any idea?

The linker is looking for the symbol "stderr".
ANSI/ISO mandates that stderr be a macro.
glibc (which in your case is what libgcc.a is probably linked against) does

extern FILE *stderr;
#define stderr stderr

while uClibc (currently) does

extern FILE *_stderr;
#define stderr _stderr

Hence, uClibc has a "_stderr" symbol instead of "stderr".

In this case, you can either hack the uClibc sources or just assign a global
in one of your source files (after undefining stderr first of course):

#undef stderr
FILE *stderr = _stderr;

Be aware though that other hidden incompatilbilty problems may result from
linking against libgcc.a.  We've been fortunate up to this point that things
usually work, but the libgcc.a issue does need to be addressed at some point.

Manuel





More information about the uClibc mailing list