other/8307: libstdc++ fails to compile because of fixincludes headers

gonz@ratloop.com gonz@ratloop.com
Mon Oct 21 22:26:00 GMT 2002

>Number:         8307
>Category:       other
>Synopsis:       libstdc++ fails to compile because of fixincludes headers
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 21 22:26:00 PDT 2002
>Originator:     Pete Gonzalez
>Release:        GCC 3.2 / NewLib 1.10.0 / Binutils 2.12.1
Cross compiler from i686-pc-cygwin for target arm-agb-elf
This bug has been reported before in various forms:


The occurs because build-gcc/gcc/include/stdlib.h is being used instead of the real "stdlib.h" from NewLib.  The "fixed" header file is missing many definitions which libstdc++-v3/include/cstdlib is looking for.  The problem can be fixed by deleting the aforementioned file, which is created by the "fixincludes" script.

I poked around in inclhack.def, but was unable to figure out where stdlib.h is coming from; it clearly is not derived from the NewLib version.  Maybe fixincludes is doing a search+replace on the wrong file?  I've attached a copy of the erroneous stdlib.h for reference.
Unfortunately it would be difficult to reproduce the exact compiler environment.
1. Run "make"
2. When compilation of libstdc++ fails, delete build-gcc/gcc/include/stdlib.h
3. Resume "make"
Content-Type: text/plain; name="stdlib.h"
Content-Disposition: inline; filename="stdlib.h"

#ifndef __stdlib_h
#define __stdlib_h

#define __need_size_t
#include <stddef.h>

#if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || defined (__STRICT_ANSI__)
#ifndef abort
extern void abort (void);
extern int abs (int);
extern int atexit (void (*) (void));
extern double atof (const char *);
extern int atoi (const char *);
extern long int atol (const char *);
extern void * bsearch (const void *, const void *, __SIZE_TYPE__, __SIZE_TYPE__, int (*) (const void *, const void *));
extern void * calloc (__SIZE_TYPE__, __SIZE_TYPE__);
extern void exit (int);
extern void free (void *);
extern char * getenv (const char *);
extern long int labs (long int);
extern void * malloc (__SIZE_TYPE__);
extern int putenv (char *);
extern void qsort (void *, __SIZE_TYPE__, __SIZE_TYPE__, int (*) (const void *, const void *));
extern int rand (void);
extern void * realloc (void *, __SIZE_TYPE__);
extern void srand (unsigned int);
extern double strtod (const char *, char **);
extern long int strtol (const char *, char **, int);
extern long unsigned int strtoul (const char *, char **, int);
extern int system (const char *);
#endif /* defined(__USE_FIXED_PROTOTYPES__) || ... */
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#endif /* __stdlib_h */

More information about the Gcc-bugs mailing list