diff mbox series

[uclibc-ng-devel] Makerules: fix out-of-tree build error "Argument list too long"

Message ID 20240424115128.2417287-1-jcmvbkbc@gmail.com
State Accepted
Headers show
Series [uclibc-ng-devel] Makerules: fix out-of-tree build error "Argument list too long" | expand

Commit Message

Max Filippov April 24, 2024, 11:51 a.m. UTC
Make rule that announces and makes static libc archive can generate
command line that is too long when a full path O= option is used. That
breaks the build with the following message:

  make: /bin/sh: Argument list too long

Use make $(file) construct to generate file list file and use that file
as $(AR) argument instead.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 Makerules | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Waldemar Brodkorb April 24, 2024, 4:17 p.m. UTC | #1
Hi Max,
Max Filippov wrote,

> Make rule that announces and makes static libc archive can generate
> command line that is too long when a full path O= option is used. That
> breaks the build with the following message:
> 
>   make: /bin/sh: Argument list too long
> 
> Use make $(file) construct to generate file list file and use that file
> as $(AR) argument instead.
> 
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

Thanks, commited and pushed,
 best regards
  Waldemar Brodkorb
diff mbox series

Patch

diff --git a/Makerules b/Makerules
index fe8a7916e657..96f2a71ec49a 100644
--- a/Makerules
+++ b/Makerules
@@ -276,7 +276,7 @@  cmd_compile.mi= $(cmd_compile.m:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS)
 cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@)) $(sort $(foreach d,$(^:$(top_srcdir)=),$(collect_multi_flags)))
 cmd_strip     = $(STRIPTOOL) $(STRIP_FLAGS) $^
 cmd_t_strip   = $(STRIPTOOL) $(STRIP_FLAGS) $@
-cmd_ar        = $(AR) $(ARFLAGS) $@ $(call objects_with_syms,,$^)
+cmd_ar        = $(AR) $(ARFLAGS) $@ @$@.list
 
 define do_ln
 	@$(disp_ln)
@@ -317,6 +317,7 @@  hcompile.u= @$(disp_hcompile.u); $(cmd_hcompile.u)
 hcompile.o= @$(disp_hcompile.o); $(cmd_hcompile.o)
 
 define do_ar
+	@$(file >$@.list,$(call objects_with_syms,,$^))
 	@$(disp_ar) ; $(cmd_ar)
 	@$(do_t_strip)
 endef