newlib 1.10.0 vs Linux string.h difference

Joel Sherrill <>
Thu Aug 22 10:07:00 GMT 2002


Eric Norum ran across a problem some libstdc++-v3 code in gcc 3.2
which compiles native but doesn't with newlib because of a minor
difference in the two string.h implementations.  I don't know whether
this is a bug in newlib or not and wanted comments:

The file:

#include <string.h>

int f(char *c1) {
  char *c;

These are all with GCC 3.2 on RedHat 7.3.

bash-2.05$ /opt/gcc-3.2/bin/gcc -c j.c
bash-2.05$ /opt/gcc-3.2/bin/gcc -ansi -c j.c
bash-2.05$ mips-rtems-gcc -c
bash-2.05$ mips-rtems-gcc -ansi -c In function `int f(char*)': `strdup' undeclared (first use this function) (Each undeclared identifier is reported only once for each
function it 
   appears in.)

Notice that when you turn on -ansi, strdup() no longer has
a prototype from newlib because it is wrapped in a __STRICT_ANSI__

Any suggestions on how to address this. 

Joel Sherrill, Ph.D.             Director of Research & Development                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

More information about the Newlib mailing list