Skip to contentSkip to conversation

perf build: Allow using compiler wrappers with CLANG

PATCH In review Ilya Leoshkevich 2 participants 2 messages Aug 5, 2025 – Aug 15, 2025 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf build: Allow using compiler wrappers with CLANG

It is useful to specify CLANG="ccache clang" in order to speed up builds. Unfortunately perf's compiler detection logic does not like this:

Makefile.config:704: Warning: Disabled BPF skeletons as clang (ccache clang) is missing

We don't need to know the full path to $(CLANG), so using get-executable is not necessary. Fix by trying to run $(CLANG) --version instead.

---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -1
index 5a5832ee7b53..4bc11db5aa4d 100644
@@ -700,7 +700,7 @@ ifeq ($(BUILD_BPF_SKEL),1)
   else ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
     $(warning Warning: Disabled BPF skeletons as libbpf is required)
     BUILD_BPF_SKEL := 0
-  else ifeq ($(call get-executable,$(CLANG)),)
+  else ifneq ($(shell $(CLANG) --version >/dev/null 2>&1; echo $$?),0)
     $(warning Warning: Disabled BPF skeletons as clang ($(CLANG)) is missing)
     BUILD_BPF_SKEL := 0
   else
Signature · 1 line
2.50.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Ilya Leoshkevich

It is useful to specify CLANG="ccache clang" in order to speed up builds. Unfortunately perf's compiler detection logic does not like this:

Makefile.config:704: Warning: Disabled BPF skeletons as clang (ccache clang) is missing

We don't need to know the full path to $(CLANG), so using get-executable is not necessary. Fix by trying to run $(CLANG) --version instead.

Thanks,
Namhyung

Quoted 20 lines
---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -1
index 5a5832ee7b53..4bc11db5aa4d 100644
@@ -700,7 +700,7 @@ ifeq ($(BUILD_BPF_SKEL),1)
   else ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
     $(warning Warning: Disabled BPF skeletons as libbpf is required)
     BUILD_BPF_SKEL := 0
-  else ifeq ($(call get-executable,$(CLANG)),)
+  else ifneq ($(shell $(CLANG) --version >/dev/null 2>&1; echo $$?),0)
     $(warning Warning: Disabled BPF skeletons as clang ($(CLANG)) is missing)
     BUILD_BPF_SKEL := 0
   else
Signature · 1 line
2.50.1