Re: arm-eabi fails in libc/sys/arm/: No rule to make target 'lib_a-trap.o', needed by 'lib.a'.

Richard Earnshaw <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>

On 01/02/2022 04:49, Mike Frysinger wrote:
> On 31 Jan 2022 16:08, Richard Earnshaw wrote:
>> This patch seems to have broken arm newlib builds (at least, when not
>> using libgloss).  I'm seeing:
>>
>> make[5]: Entering directory
>> '/work/rearnsha/scratch/nightly/arm/master/arm-eabi/
>> newlib/libc/sys/arm'
>>     CC       lib_a-access.o
>>     CC       lib_a-aeabi_atexit.o
>> make[5]: *** No rule to make target 'lib_a-trap.o', needed by 'lib.a'. Stop.
>>
>> And indeed, the Makefile in that directory now lacks anything to build
>> lib_a-trap.o from trap.S.  Something explicit is needed because of the
>> non-standard file rename that we use.
> 
> this patch series is unrelated.  this is due to a previous patch of mine:
> newlib: delete (most) redundant lib_a_CCASFLAGS=$(AM_CCASFLAGS)
> 

Ah, sorry, I was struggling to identify the exact patch and thought I'd 
found the right one.


> this is because i think newlib was relying on automake behavior that is
> undocumented or unintended.  that said, i'm not sure why this Makefile.am
> is written the way it is.  it'd be a lot simpler like:
> 
> --- a/newlib/libc/sys/arm/Makefile.am
> +++ b/newlib/libc/sys/arm/Makefile.am
> @@ -6,16 +6,10 @@ AM_CCASFLAGS = $(AM_CPPFLAGS)
>   
>   noinst_LIBRARIES = lib.a
>   
> +lib_a_SOURCES = access.c aeabi_atexit.c
>   if MAY_SUPPLY_SYSCALLS
> -extra_objs = $(lpfx)libcfunc.o $(lpfx)trap.o $(lpfx)syscalls.o
> -else
> -extra_objs =
> +lib_a_SOURCES += libcfunc.c trap.S syscalls.c
>   endif
> -
> -lib_a_SOURCES = access.c aeabi_atexit.c
> -lib_a_LIBADD = $(extra_objs)
> -EXTRA_lib_a_SOURCES = trap.S syscalls.c libcfunc.c
> -lib_a_DEPENDENCIES = $(extra_objs)
>   lib_a_CFLAGS = $(AM_CFLAGS)
>   
>   if MAY_SUPPLY_SYSCALLS

This seems to work although one small difference is that instead of 
building libc_a-trap.o it now builds trap.o.  I'm not sure if that 
really matters, though.

R.

> 
> maybe Jeff can remember why it was written this way since it comes from:
> 
> commit 313f13497935d2831e76f9b8b61ccc762dc1cc65
> Author: Jeff Johnston <[email protected]>
> Date:   Sat Feb 8 04:30:58 2003 +0000
> 
>      2003-02-07  Jeff Johnston  <[email protected]>
> 
>              * acinclude.m4 (--disable-newlib-supplied-syscalls): New configuration
>              option to allow disabling of syscalls being supplied in newlib.
>              * aclocal.m4: Regenerated.
>              * configure: Ditto.
>              * configure.host: Add support of new configuration option and add
>              -D__NO_SYSCALLS__ if newlib supplied syscalls are disabled.
>              * doc/aclocal.m4: Regenerated.
>              * doc/configure: Ditto.
>              * libc/*aclocal.m4: Ditto.
>              * libc/*configure: Ditto.
>              * libm/*aclocal.m4: Ditto.
>              * libm/*configure: Ditto.
>              * libc/sys/arm/Makefile.am: Don't build syscalls.o if new option
>              is disabled.
> -mike
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.