diff mbox series

[v4,1/3] tcf-agent: Add $@ to RANLIB

Message ID 20250529210239.2070257-1-raj.khem@gmail.com
State New
Headers show
Series [v4,1/3] tcf-agent: Add $@ to RANLIB | expand

Commit Message

Khem Raj May 29, 2025, 9:02 p.m. UTC
tcf-agent calls RANLIB ( if defined ) after calling AR to
create the archive [1], when RANLIB is set to gcc-ranlib this goes
unnoticed, since calling gcc-ranlib without any arguments silenlty
does nothing and exits with return code 0, however, calling binutils
ranlib or llvm-ranlib does demand library name as commandline option
and since it is not there it exits with code 1

aarch64-poky-linux-musl-llvm-ranlib
OVERVIEW: LLVM ranlib

Generate an index for archives

USAGE: aarch64-poky-linux-musl-llvm-ranlib archive...

OPTIONS:
   -h --help             - Display available options
   -V --version          - Display the version of this program
   -D                    - Use zero for timestamps and uids/gids (default)
   -U                    - Use actual timestamps and uids/gids
   -X{32|64|32_64|any}   - Specify which archive symbol tables should be
generated if they do not already exist (AIX OS only)
aarch64-poky-linux-musl-llvm-ranlib: error: an archive name must be
specified
make: *** [Makefile:53: obj/GNU/Linux/a64/Debug/libtcf.a] Error 1

When we add $@, to RANLIB then it becomes the make variable,
$@ - An automatic Makefile variable that expands to the target name (the
file being built)

so the makefile target now rightly adds the .a filename to RANLIB call.

Sent a patch upstream to add RANLIB for linux [2]

[1] https://gitlab.eclipse.org/eclipse/tcf/tcf.agent/-/blob/master/agent/Makefile?ref_type=heads#L53
[2] https://gitlab.eclipse.org/eclipse/tcf/tcf.agent/-/merge_requests/7

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
index 235936288ba..0aea4b88505 100644
--- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
+++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
@@ -51,6 +51,12 @@  CFLAGS:append:riscv64 = " ${LCL_STOP_SERVICES}"
 CFLAGS:append:riscv32 = " ${LCL_STOP_SERVICES}"
 CFLAGS:append:loongarch64 = " ${LCL_STOP_SERVICES}"
 
+# This works with gcc-ranlib wrapper only because it exists without error if nothing
+# is passed as argument but binutils ranlib and llvm ranlib do not and expect an input
+# passing $@ ensures that Makefile default target which is the archive name in tcf makefiles
+# is passed to RANLIB, ensures that whichever ranlib is used, the behavior is identical
+RANLIB:append = " $@"
+
 do_install() {
 	oe_runmake install INSTALLROOT=${D}
 	install -d ${D}${sysconfdir}/init.d/