Error Building Newlib for arm-none-eabi

R0b0t1 r030t1@gmail.com
Thu Feb 22 11:06:00 GMT 2018


On Wed, Feb 21, 2018 at 5:35 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> When you have mysterious parser errors, the first thing to do is to repeat
> the failing compilation command (which I don't see anywhere in this
> thread) but with -save-temps.  Then you can look at the actual
> macro-expanded code seen by the compiler at the point where the failure
> occurs.  Then you need to trace things back to establish how that sequence
> of tokens arose through some sequence of macro expansions in the newlib
> source code, so that you can either report a problem reduced down to a
> particular macro definition or combination thereof, or identify a problem
> with your build environment causing a nonsensical combination of headers
> (for example) to be used.
>

Thanks, I found -save-temps but it took me a while to successfully get
it inserted into the build system. Here is the result:

char *

# 97 "../../../../../../source/newlib-3.0.0/newlib/libc/stdio/gets.c" 3 4
__gets_chk(
# 97 "../../../../../../source/newlib-3.0.0/newlib/libc/stdio/gets.c"
char *buf
# 97 "../../../../../../source/newlib-3.0.0/newlib/libc/stdio/gets.c" 3 4
, __builtin_object_size(
# 97 "../../../../../../source/newlib-3.0.0/newlib/libc/stdio/gets.c"
char *buf
# 97 "../../../../../../source/newlib-3.0.0/newlib/libc/stdio/gets.c" 3 4
, 2 > 1))

# 98 "../../../../../../source/newlib-3.0.0/newlib/libc/stdio/gets.c"
{
  return _gets_r (
# 99 "../../../../../../source/newlib-3.0.0/newlib/libc/stdio/gets.c" 3 4
                 _impure_ptr
# 99 "../../../../../../source/newlib-3.0.0/newlib/libc/stdio/gets.c"
                       , buf);
}


It was pointed out to me elsewhere that it looks like the function's
name is being replaced as if _FORTIFY_SOURCE were set. This would also
explain why other stdio functions fail.

My apologies for not providing the command, it is:

arm-none-eabi-cc -save-temps
-B/home/R0b0t1/devel/toolgen/build/newlib-3.0.0/arm-none-eabi/newlib/
-isystem /home/R0b0t1/devel/toolgen/build/newlib-3.0.0/arm-none-eabi/newlib/targ-include
-isystem /home/R0b0t1/devel/toolgen/source/newlib-3.0.0/newlib/libc/include
-B/home/R0b0t1/devel/toolgen/build/newlib-3.0.0/arm-none-eabi/libgloss/arm
-L/home/R0b0t1/devel/toolgen/build/newlib-3.0.0/arm-none-eabi/libgloss/libnosys
-L/home/R0b0t1/devel/toolgen/source/newlib-3.0.0/libgloss/arm
-DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\"
-DPACKAGE_VERSION=\"3.0.0\" -DPACKAGE_STRING=\"newlib\ 3.0.0\"
-DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I.
-I../../../../../../source/newlib-3.0.0/newlib/libc/stdio
-D__NO_SYSCALLS__ -fno-builtin      -g -O2 -c -o lib_a-gets.o `test -f
'gets.c' || echo
'../../../../../../source/newlib-3.0.0/newlib/libc/stdio/'`gets.c

It is not clear to me where _FORTIFY_SOURCE is being pulled in.

Cheers,
     R0b0t1



More information about the Newlib mailing list