sys-include/newlib.h
Jon Beniston
jon@beniston.com
Fri Dec 9 15:42:00 GMT 2016
Hi,
I'm compiling newlib 2.4.0 with gcc 6.1 configured as a cross compiler. In
order for some gcc libc support to be built, I need to configure with
--with-headers=/path/newlib/libc/include/
This results in the .h files from that directory being copied to
target/sys-include. GCC's built in search path searches target/sys-include
before target/include. This results in a bit of a problem when compiling C++
code, as target/sys-include/newlib.h differs from target/include/newlib.h
target/sys-include/newlib.h is an otherwise empty file that just says:
/* dummy file for external tools to use. Real file is created by
newlib configuration. */
Whereas target/include/newlib.h includes the newlib configuration macros,
such as:
#define _HAVE_LONG_DOUBLE 1
This causes an error "'::strtold' has not been declared" when compiling C++
code, as the prototype for this function in stdlib.h, depends on this macro:
#ifdef _HAVE_LONG_DOUBLE
extern long double strtold (const char *__restrict, char **__restrict);
#endif /* _HAVE_LONG_DOUBLE */
Which is not defined as target/sys-include/newlib.h is included instead of
target/include/newlib.h
The same applies to _newlib_version.h too.
And ideas on the best way to resolve this? Is it a gcc or newlib problem or
user error?
Thanks,
Jon
More information about the Newlib
mailing list