This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Newlib fails to compile on arm64
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: Ajay Garg <ajaygargnsit at gmail dot com>, newlib at sourceware dot org
- Cc: nd at arm dot com
- Date: Mon, 18 Jun 2018 11:32:25 +0100
- Subject: Re: Newlib fails to compile on arm64
- Nodisclaimer: True
- References: <CAHP4M8UVUzTNCn9Mc4sC6hfz7mWCCaUnteVpiN0+vUwCtP0uAQ@mail.gmail.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 16/06/18 04:38, Ajay Garg wrote:
Hi All.
I did the following :
##########################################################
git clone git://sourceware.org/git/newlib-cygwin.git
cd newlib-cygwin/newlib
./configure
make
##########################################################
However, the compilation fails to complete.
Upon seeing the logs somewhat before, errors of the following type are seen :
##########################################################
/newlib-cygwin/newlib/libc/include/ssp/ssp.h:47:52: error: expected
declaration specifiers or '...' before numeric constant
#define __ssp_bos0(ptr) __builtin_object_size(ptr, 0)
##########################################################
What am I missing?
newlib is broken with -D_FORTIFY_SOURCE
stdio.h has macros like:
#define gets(str) \
__gets_chk(str, __ssp_bos(str))
and gets.c does not protect the definition against macro expansion:
char *
gets (char *buf)
{
...
and for some reason ubuntu gcc -O2 turns -D_FORTIFY_SOURCE=2 on.
i think CC='gcc -D_FORTIFY_SOURCE=0' should work.