Discussion:
Newlib fails to compile on arm64
Ajay Garg
2018-06-16 03:38:47 UTC
Permalink
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?


Thanks and Regards,
Ajay
Szabolcs Nagy
2018-06-18 10:32:25 UTC
Permalink
Post by Ajay Garg
Hi All.
##########################################################
git clone git://sourceware.org/git/newlib-cygwin.git
cd newlib-cygwin/newlib
./configure
make
##########################################################
However, the compilation fails to complete.
##########################################################
/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.
Ajay Garg
2018-06-18 17:11:05 UTC
Permalink
Thanks Szabolcs, that worked.

Thanks and Regards,
Ajay
Post by Szabolcs Nagy
Post by Ajay Garg
Hi All.
##########################################################
git clone git://sourceware.org/git/newlib-cygwin.git
cd newlib-cygwin/newlib
./configure
make
##########################################################
However, the compilation fails to complete.
##########################################################
/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
#define gets(str) \
__gets_chk(str, __ssp_bos(str))
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.
Loading...