This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
sys-include/newlib.h
- From: "Jon Beniston" <jon at beniston dot com>
- To: <newlib at sourceware dot org>
- Date: Fri, 9 Dec 2016 15:42:29 -0000
- Subject: sys-include/newlib.h
- Authentication-results: sourceware.org; auth=none
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