Skip to contentSkip to conversation

bluez: Disable invalid-pp-token warning with clang

PATCH Superseded Khem Raj 2 participants 4 messages Jun 3, 2025 – Jun 5, 2025

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v5 1/2 bluez: Disable invalid-pp-token warning with clang

We add FIRMWARE_DIR via CFLAGS using escapes for string and clang option parser flags it

<command line>:4:23: warning: missing terminating '"' character [-Winvalid-pp-token]
4 | #define FIRMWARE_DIR \"/usr/lib/firmware\"
| ^

emitting this warning during configure means some tests fail wrongly. e.g. test for enable -fPIC -DPIC, which results in textrels in libbbluetooth.so

This warning can be disabled, the string is correctly passed to sources in the end, so its spurious

---
v5: Rebase

 meta/recipes-connectivity/bluez5/bluez5.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-connectivity/bluez5/bluez5.inc +1 -0
index 7bae968094f..5835662f7a6 100644
@@ -84,6 +84,7 @@ EXTRA_OECONF = "\
 "
 
 CFLAGS += "-DFIRMWARE_DIR=\\"${nonarch_base_libdir}/firmware\\""
+CFLAGS:append:toolchain-clang = " -Wno-invalid-pp-token"
 
 # bluez5 builds a large number of useful utilities but does not
 # install them.  Specify which ones we want put into ${PN}-noinst-tools.
author
#1 lore raw

PATCH v5 2/2 tcf-agent: Add $@ to RANLIB

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

---
v5: Rebase

 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 6 ++++++
 1 file changed, 6 insertions(+)
meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +6 -0
index 235936288ba..0aea4b88505 100644
@@ -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/
#2 lore raw

Re: [OE-core] [PATCH v5 2/2] tcf-agent: Add $@ to RANLIB

Quoted 5 lines · Khem Raj via lists.openembedded.org

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

As you’ve sent a patch, can we apply that (which will disappear when its merged) instead of an assignment in the recipe that will possibly be forgotten about and left forever?

Ross

author
#3 lore raw

Re: [OE-core] [PATCH v5 2/2] tcf-agent: Add $@ to RANLIB

Quoted 9 lines · Ross Burton
Quoted 5 lines · Khem Raj via lists.openembedded.org

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

As you’ve sent a patch, can we apply that (which will disappear when its merged) instead of an assignment in the recipe that will possibly be forgotten about and left forever?

That patch will not fix our problem because we override RANLIB in OE, the patch bring default RANLIB to work on linux platforms like others. e.g. if we did not override
RANLIB then the patches won't be needed but we do. Maybe one option is to undefine RANLIB in OE build environment for this recipe and apply the patch in this case it will work, but we will not be enforcing our toolchain policy anymore for this recipe.

Quoted 2 lines

Ross