| Message ID | 20250522-clang-toolchain-v3-5-16cfc6d9891b@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series | clang: Add clang C/C++ toolchain | expand |
On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote: > This ensures that binutils-ranlib or llvm-ranlib > behaves same as gcc-ranlib > > Signed-off-by: Khem Raj <raj.khem@gmail.com> > --- > meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb > index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644 > --- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb > +++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb > @@ -51,6 +51,11 @@ 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 which expands $@ shell array, > +# but it will fail if RANLIB was set to <cross>-ranlib or > +# <cross>-llvm-ranlib has same behaviour > +RANLIB:append:toolchain-clang = " $@" > + > do_install() { > oe_runmake install INSTALLROOT=${D} > install -d ${D}${sysconfdir}/init.d/ > The people on the patch review calls are struggling to understand the issue here. Could you explain this a bit more in the comment so we can understand it? Does this imply there is a missing piece on the commandline in the makefiles (or whatever) of tcf-agent which should really be fixed instead? Cheers, Richard
On 5/29/25 2:20 AM, Richard Purdie wrote: > On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote: >> This ensures that binutils-ranlib or llvm-ranlib >> behaves same as gcc-ranlib >> >> Signed-off-by: Khem Raj <raj.khem@gmail.com> >> --- >> meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb >> index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644 >> --- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb >> +++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb >> @@ -51,6 +51,11 @@ 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 which expands $@ shell array, >> +# but it will fail if RANLIB was set to <cross>-ranlib or >> +# <cross>-llvm-ranlib has same behaviour >> +RANLIB:append:toolchain-clang = " $@" >> + >> do_install() { >> oe_runmake install INSTALLROOT=${D} >> install -d ${D}${sysconfdir}/init.d/ >> > > The people on the patch review calls are struggling to understand the > issue here. Could you explain this a bit more in the comment so we can > understand it? > > Does this imply there is a missing piece on the commandline in the > makefiles (or whatever) of tcf-agent which should really be fixed > instead? I can explain it a bit more. tcf-agent calls RANLIB 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 it silenlty does nothing and exits with return code 0, however, calling 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. tcf-agent seems to add $@ for solaris and osx, I guess someone saw the problem on default ranlib on these platforms but not on linux where gcc-ar is used commonly. [1] https://gitlab.eclipse.org/eclipse/tcf/tcf.agent/-/blob/master/agent/Makefile?ref_type=heads#L53 > > Cheers, > > Richard
On Thu, 2025-05-29 at 10:59 -0700, Khem Raj wrote: > > > On 5/29/25 2:20 AM, Richard Purdie wrote: > > On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote: > > > This ensures that binutils-ranlib or llvm-ranlib > > > behaves same as gcc-ranlib > > > > > > Signed-off-by: Khem Raj <raj.khem@gmail.com> > > > --- > > > meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb > > > index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644 > > > --- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb > > > +++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb > > > @@ -51,6 +51,11 @@ 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 which expands $@ shell array, > > > +# but it will fail if RANLIB was set to <cross>-ranlib or > > > +# <cross>-llvm-ranlib has same behaviour > > > +RANLIB:append:toolchain-clang = " $@" > > > + > > > do_install() { > > > oe_runmake install INSTALLROOT=${D} > > > install -d ${D}${sysconfdir}/init.d/ > > > > > > > The people on the patch review calls are struggling to understand the > > issue here. Could you explain this a bit more in the comment so we can > > understand it? > > > > Does this imply there is a missing piece on the commandline in the > > makefiles (or whatever) of tcf-agent which should really be fixed > > instead? > > I can explain it a bit more. tcf-agent calls RANLIB 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 it silenlty > does nothing and exits with return code 0, however, calling 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. > > tcf-agent seems to add $@ for solaris and osx, I guess someone saw the > problem on default ranlib on these platforms but not on linux where > gcc-ar is used commonly. > > [1] > https://gitlab.eclipse.org/eclipse/tcf/tcf.agent/-/blob/master/agent/Makefile?ref_type=heads#L53 Can we open something with tcf agent to add this on linux then? I'm just worried this workaround is fairly fragile and likely to cause us problems in future. In some ways I'd rather patch tcf agent for this issue as that would at least be clearer. If we have an open upstream ticket or patch, then we can probably just append the variable for now. Cheers, Richard
On Thu, May 29, 2025 at 1:15 PM Richard Purdie <richard.purdie@linuxfoundation.org> wrote: > > On Thu, 2025-05-29 at 10:59 -0700, Khem Raj wrote: > > > > > > On 5/29/25 2:20 AM, Richard Purdie wrote: > > > On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote: > > > > This ensures that binutils-ranlib or llvm-ranlib > > > > behaves same as gcc-ranlib > > > > > > > > Signed-off-by: Khem Raj <raj.khem@gmail.com> > > > > --- > > > > meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++ > > > > 1 file changed, 5 insertions(+) > > > > > > > > diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb > > > > index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644 > > > > --- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb > > > > +++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb > > > > @@ -51,6 +51,11 @@ 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 which expands $@ shell array, > > > > +# but it will fail if RANLIB was set to <cross>-ranlib or > > > > +# <cross>-llvm-ranlib has same behaviour > > > > +RANLIB:append:toolchain-clang = " $@" > > > > + > > > > do_install() { > > > > oe_runmake install INSTALLROOT=${D} > > > > install -d ${D}${sysconfdir}/init.d/ > > > > > > > > > > The people on the patch review calls are struggling to understand the > > > issue here. Could you explain this a bit more in the comment so we can > > > understand it? > > > > > > Does this imply there is a missing piece on the commandline in the > > > makefiles (or whatever) of tcf-agent which should really be fixed > > > instead? > > > > I can explain it a bit more. tcf-agent calls RANLIB 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 it silenlty > > does nothing and exits with return code 0, however, calling 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. > > > > tcf-agent seems to add $@ for solaris and osx, I guess someone saw the > > problem on default ranlib on these platforms but not on linux where > > gcc-ar is used commonly. > > > > [1] > > https://gitlab.eclipse.org/eclipse/tcf/tcf.agent/-/blob/master/agent/Makefile?ref_type=heads#L53 > > Can we open something with tcf agent to add this on linux then? I'm > just worried this workaround is fairly fragile and likely to cause us > problems in future. In some ways I'd rather patch tcf agent for this > issue as that would at least be clearer. > > If we have an open upstream ticket or patch, then we can probably just > append the variable for now. I think upstream expects the environment to set it with the parameter option added, or not set it at all which then makes it an empty string. In any case I have send a PR for it already https://gitlab.eclipse.org/eclipse/tcf/tcf.agent/-/merge_requests/7 > > Cheers, > > Richard >
diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644 --- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb @@ -51,6 +51,11 @@ 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 which expands $@ shell array, +# but it will fail if RANLIB was set to <cross>-ranlib or +# <cross>-llvm-ranlib has same behaviour +RANLIB:append:toolchain-clang = " $@" + do_install() { oe_runmake install INSTALLROOT=${D} install -d ${D}${sysconfdir}/init.d/
This ensures that binutils-ranlib or llvm-ranlib behaves same as gcc-ranlib Signed-off-by: Khem Raj <raj.khem@gmail.com> --- meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++ 1 file changed, 5 insertions(+)