Re: Build failure bft for trace-cmd and libtraceevent

Steven Rostedt <[email protected]> Sun, 8 Feb 2026 17:22:34 -0500
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <20260208172234.3a181553@robin>
On Sun, 8 Feb 2026 23:14:32 +0100
Giulio Benetti <[email protected]> wrote:

> Oh, ok. I=E2=80=99m going to follow that commit and add btf option to dis=
able btf to trace-cmd too.
> At the moment it only checks for libtraceevent version and that won=E2=80=
=99t be sufficient.

I don't think you need to change trace-cmd. We can just make the
tep_btf_print_args() just print the arguments passed in if it is not
supported, and have the list_args just fail.

Here's an update to the libtraceevent Makefile to do this. Will need
something similar for the meson build.

-- Steve

diff --git a/Makefile b/Makefile
index e1a10a02a560..bd88a981d373 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,13 @@ $(call allow-override,PKG_CONFIG,pkg-config)
 $(call allow-override,LD_SO_CONF_PATH,/etc/ld.so.conf.d/)
 $(call allow-override,LDCONFIG,ldconfig)
=20
+# Set compile option CFLAGS
+ifdef EXTRA_CFLAGS
+  CFLAGS ?=3D $(EXTRA_CFLAGS)
+else
+  CFLAGS ?=3D -g -Wall
+endif
+
 EXT =3D -std=3Dgnu99
 INSTALL =3D install
=20
@@ -37,6 +44,20 @@ INSTALL =3D install
 DESTDIR ?=3D
 DESTDIR_SQ =3D '$(subst ','\'',$(DESTDIR))'
=20
+test-build =3D $(if $(shell sh -c 'echo "$(1)" | tee /tmp/t.c| \
+	$(CC) -o /dev/null -x c - > /dev/null 2>&1 && echo y'), $2)
+
+define BTF_LATEST_SOURCE
+#include <linux/btf.h>
+int main(void) { return BTF_KIND_ENUM64; }
+endef
+
+BTF_OK :=3D $(call test-build,$(BTF_LATEST_SOURCE),y)
+
+ifneq ($(strip $(BTF_OK)), y)
+CFLAGS +=3D -DNO_BTF
+endif
+
 LP64 :=3D $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
 ifeq ($(LP64), 1)
   libdir_relative_temp =3D lib64
@@ -123,13 +144,6 @@ INCLUDES =3D -I. -I $(srctree)/include -I $(EP_HEADERS=
_DIR) $(CONFIG_INCLUDES)
=20
 export LIBTRACEEVENT_STATIC LIBTRACEEVENT_SHARED EP_HEADERS_DIR
=20
-# Set compile option CFLAGS
-ifdef EXTRA_CFLAGS
-  CFLAGS :=3D $(EXTRA_CFLAGS)
-else
-  CFLAGS :=3D -g -Wall
-endif
-
 LIBS ?=3D -ldl
 export LIBS
=20