Skip to contentSkip to conversation

package/libtraceevent: new package

PATCH Andreas Ziegler 2 participants 5 messages Feb 5, 2023 – Feb 20, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Maxime,

libtraceevent and libtracefs are libraries, thus should be positioned under "Target packages" -> "Libraries".

Introducing a "Debugging, profiling and benchmark" category here would probably be appropriate.

Tested successfully on x86_64 hardware.

Kind regards,
Andreas

Quoted 57 lines · Maxime Chevallier

Introduce the libtraceevent library, that used to be bundled with the trace-cmd tool. This library is now used by several tools and libraries such as trace-cmd, libtracefs and rtla.

This package tries to install libraries in /usr/local/lib by default, hence the redefinition of the "prefix" variable, so that the library gets installed in "/usr/lib" instead.

The same applies to the pkgconfig handling of the proved Makefile, which installs the .pc files in the /usr/local area by default, hence the redefinition of the pkgconfig_dir to either the correct directory within the staging area, or to empty value for the target to avoid installing the .pc in that case.

---
 DEVELOPERS                             |  3 +++
 package/Config.in                      |  1 +
 package/libtraceevent/Config.in        |  9 +++++++
 package/libtraceevent/libtraceevent.mk | 33 ++++++++++++++++++++++++++
 4 files changed, 46 insertions(+)
 create mode 100644 package/libtraceevent/Config.in
 create mode 100644 package/libtraceevent/libtraceevent.mk
DEVELOPERS +3 -0
index 706ee80ece..fcf05e0aa0 100644
@@ -2106,6 +2106,9 @@ F:	package/postgresql/
 F:	package/protozero/
 F:	package/timescaledb/
 
+N:	Maxime Chevallier <[email protected]>
+F:	package/libtraceevent/
+
 N:	Michael Durrant <[email protected]>
 F:	board/arcturus/
 F:	configs/arcturus_ucp1020_defconfig
package/Config.in +1 -0
index 83fddf316f..2f0e6dcb18 100644
@@ -117,6 +117,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/kyua/Config.in"
 	source "package/latencytop/Config.in"
 	source "package/libbpf/Config.in"
+	source "package/libtraceevent/Config.in"
 	source "package/lmbench/Config.in"
 	source "package/lsof/Config.in"
 	source "package/ltp-testsuite/Config.in"
package/libtraceevent/Config.in new file +0 -0
new file mode 100644
index 0000000000..d351e3b4de

package/libtraceevent/Config.in line 9

Quoted 9 lines
package/libtraceevent/Config.in new file +9 -0
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_LIBTRACEEVENT
+	bool "libtraceevent"
+	help
+	  libtraceevent is a library that interfaces with the ftrace
+	  subsystem in the linux kernel.
+	  It used to be bundled directly in the trace-cmd
+	  tool, but it was eventually extracted so that it can be used
+	  by multiple other tools and libraries, such as libtracefs and
+	  rtla.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hello Andreas,

Quoted 4 lines · On Sun, 05 Feb 2023 09:20:15 +0100 Andreas Ziegler <[email protected]> wrote:

Hi Maxime,

libtraceevent and libtracefs are libraries, thus should be positioned under "Target packages" -> "Libraries".

Oops my bad, I should have put them there indeed.

Quoted 2 lines

Introducing a "Debugging, profiling and benchmark" category here would probably be appropriate.

Good idea !

Quoted 1 line

Tested successfully on x86_64 hardware.

Thanks a lot ! I'll respin with the proposed changes then.

Best regards,

Maxime

Quoted 69 lines

Kind regards,
Andreas

Quoted 65 lines · Maxime Chevallier

Introduce the libtraceevent library, that used to be bundled with the trace-cmd tool. This library is now used by several tools and libraries such as trace-cmd, libtracefs and rtla.

This package tries to install libraries in /usr/local/lib by default, hence the redefinition of the "prefix" variable, so that the library gets installed in "/usr/lib" instead.

The same applies to the pkgconfig handling of the proved Makefile, which
installs the .pc files in the /usr/local area by default, hence the redefinition of the pkgconfig_dir to either the correct directory within the
staging area, or to empty value for the target to avoid installing the .pc
in that case.

---
 DEVELOPERS                             |  3 +++
 package/Config.in                      |  1 +
 package/libtraceevent/Config.in        |  9 +++++++
 package/libtraceevent/libtraceevent.mk | 33
++++++++++++++++++++++++++ 4 files changed, 46 insertions(+)
 create mode 100644 package/libtraceevent/Config.in
 create mode 100644 package/libtraceevent/libtraceevent.mk
DEVELOPERS +3 -0
index 706ee80ece..fcf05e0aa0 100644
@@ -2106,6 +2106,9 @@ F:	package/postgresql/
 F:	package/protozero/
 F:	package/timescaledb/
 
+N:	Maxime Chevallier <[email protected]>
+F:	package/libtraceevent/
+
 N:	Michael Durrant <[email protected]>
 F:	board/arcturus/
 F:	configs/arcturus_ucp1020_defconfig
package/Config.in +1 -0
index 83fddf316f..2f0e6dcb18 100644
@@ -117,6 +117,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/kyua/Config.in"
 	source "package/latencytop/Config.in"
 	source "package/libbpf/Config.in"
+	source "package/libtraceevent/Config.in"
 	source "package/lmbench/Config.in"
 	source "package/lsof/Config.in"
 	source "package/ltp-testsuite/Config.in"
package/libtraceevent/Config.in new file +4 -0
new file mode 100644
index 0000000000..d351e3b4de
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_LIBTRACEEVENT
+	bool "libtraceevent"
+	help
+	  libtraceevent is a library that interfaces with the
Quoted 8 lines

package/libtraceevent/Config.in

Quoted 8 lines

ftrace

package/libtraceevent/Config.in new file +3 -0
+	  subsystem in the linux kernel.
+	  It used to be bundled directly in the trace-cmd
+	  tool, but it was eventually extracted so that it can be

used

package/libtraceevent/Config.in new file +1 -0
+	  by multiple other tools and libraries, such as

libtracefs and

package/libtraceevent/Config.in new file +1 -0
+	  rtla.  

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Re: [Buildroot] [PATCH 3/4] package/linux-tools: add rtla

In reply to a message not in the archive

Hi Maxime,

I was able to build RTLA after some adaptions, see below.

Quoted 39 lines · Maxime Chevallier

The RealTime Linux Analysis tool includes a set of commands that relies on the osnoise and timerlat tracers from the ftrace kernel subsystem, allowing to analyze the lantency sources coming from the hardware and the kernel itself.

This tool was introduced in v5.17, and relies on libtracefs and libtraceevent, although libtraceevent itself is already a dependency for libtracefs.

---
 DEVELOPERS                                |  1 +
 package/linux-tools/Config.in             | 10 +++++++
 package/linux-tools/linux-tool-rtla.mk.in | 32 +++++++++++++++++++++++
 3 files changed, 43 insertions(+)
 create mode 100644 package/linux-tools/linux-tool-rtla.mk.in
DEVELOPERS +1 -0
index fe7194f817..8f459c796a 100644
@@ -2109,6 +2109,7 @@ F:	package/timescaledb/
 N:	Maxime Chevallier <[email protected]>
 F:	package/libtraceevent/
 F:	package/libtracefs
+F:	package/linux-tools/linux-tool-rtla.mk.in
 
 N:	Michael Durrant <[email protected]>
 F:	board/arcturus/
package/linux-tools/Config.in +0 -0
index 8a0b6d5802..186392b816 100644
@@ -102,6 +102,16 @@ config 

BR2_PACKAGE_LINUX_TOOLS_PERF_NEEDS_HOST_PYTHON3

endif

package/linux-tools/Config.in

Quoted 2 lines
package/linux-tools/Config.in +2 -0
+config BR2_PACKAGE_LINUX_TOOLS_RTLA
+	bool "rtla"

Since a version dependency exists, you might add:
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_17

Quoted 17 lines
package/linux-tools/Config.in +8 -0
+	select BR2_PACKAGE_LINUX_TOOLS
+	select BR2_PACKAGE_LIBTRACEFS
+	help
+	  Linux 5.17 and later has 2 new tracers, osnoise and timerlat.
+	  There tracers allow performing latency analysis, for which
+	  the rtla tool provides wrapper commands to visualize and
+	  extrace latency traces and reports.
+
 config BR2_PACKAGE_LINUX_TOOLS_SELFTESTS
 	bool"selftests"
 	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # bash
package/linux-tools/linux-tool-rtla.mk.in new file +0 -0
new file mode 100644
index 0000000000..a736e3b785

package/linux-tools/linux-tool-rtla.mk.in line 9

Quoted 9 lines
package/linux-tools/linux-tool-rtla.mk.in new file +9 -0
@@ -0,0 +1,32 @@
+################################################################################
+#
+# rtla
+#
+################################################################################
+
+LINUX_TOOLS += rtla
+
+RTLA_DEPENDENCIES = host-pkgconf libtracefs

RTLA needs some kernel features; better to include them here, saves time experimenting:

# linux kernel needs FTRACE, TIMERLAT_TRACER, HIST_TRIGGERS for RTLA to work
ifeq ($(BR2_PACKAGE_LINUX_TOOLS_RTLA),y)
define RTLA_LINUX_CONFIG_FIXUPS
	$(call KCONFIG_ENABLE_OPT,CONFIG_FTRACE)
	$(call KCONFIG_ENABLE_OPT,CONFIG_TIMERLAT_TRACER)
	$(call KCONFIG_ENABLE_OPT,CONFIG_HIST_TRIGGERS)
endef
endif

package/linux-tools/linux-tool-rtla.mk.in line 14

Quoted 5 lines
package/linux-tools/linux-tool-rtla.mk.in new file +5 -0
+RTLA_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
+	CC=$(TARGET_CC) \
+	LDFLAGS="$(TARGET_LDFLAGS)" \
+	PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
+

The RTLA Makefile unconditionally compiles with stack smashing protection; linking fails on builds configured without this feature:

# adapted from linux-tool-tmon.mk.in
ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
define RTLA_DISABLE_STACK_PROTECTOR
	$(SED) 's/-fstack-protector.* //' 
$(LINUX_DIR)/tools/tracing/rtla/Makefile
endef
endif

package/linux-tools/linux-tool-rtla.mk.in

Quoted 9 lines
package/linux-tools/linux-tool-rtla.mk.in new file +2 -0
+define RTLA_BUILD_CMDS
+	$(Q)if ! grep install $(LINUX_DIR)/tools/tracing/rtla/Makefile 
Quoted 1 line

/dev/null 2>&1 ; then \

package/linux-tools/linux-tool-rtla.mk.in new file +1 -0
+		echo "Your kernel version is too old and does not implement the rtla 

tool." ; \

package/linux-tools/linux-tool-rtla.mk.in new file +4 -0
+		echo "At least kernel 5.17 must be used." ; \
+		exit 1 ; \
+	fi
+
	$(RTLA_DISABLE_STACK_PROTECTOR)

package/linux-tools/linux-tool-rtla.mk.in

Quoted 11 lines
package/linux-tools/linux-tool-rtla.mk.in new file +11 -0
+	$(TARGET_MAKE_ENV) \
+	$(MAKE) $(RTLA_MAKE_OPTS) \
+	-C $(LINUX_DIR)/tools/tracing rtla
+endef
+
+define RTLA_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/tracing \
+	$(RTLA_MAKE_OPTS) \
+	DESTDIR=$(TARGET_DIR) \
+	rtla_install
+endef

rtla_install fails with:
Makefile:34: *** NOTICE: rst2man required to generate man pages. Stop. because it tries to build and install man pages also. Better to use a custom install command:

# The rtla_install target tries to create and install manpages,

# which terminates with an error and cannot be disabled
define RTLA_INSTALL_TARGET_CMDS
	$(INSTALL) -m 0755 -D $(LINUX_DIR)/tools/tracing/rtla/rtla \
		$(TARGET_DIR)/usr/bin/rtla
endef

Kind regards,
Andreas

Quoted 2 lines

--
2.39.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH 3/4] package/linux-tools: add rtla

Hello Andreas,

Quoted 3 lines · On Sun, 05 Feb 2023 09:22:56 +0100 Andreas Ziegler <[email protected]> wrote:

Hi Maxime,

I was able to build RTLA after some adaptions, see below.

Thanks for the effort, I appreciate !

Quoted 40 lines · Maxime Chevallier
Quoted 39 lines

The RealTime Linux Analysis tool includes a set of commands that relies on the osnoise and timerlat tracers from the ftrace kernel subsystem, allowing to analyze the lantency sources coming from the hardware and the kernel itself.

This tool was introduced in v5.17, and relies on libtracefs and libtraceevent, although libtraceevent itself is already a dependency for
libtracefs.

---
 DEVELOPERS                                |  1 +
 package/linux-tools/Config.in             | 10 +++++++
 package/linux-tools/linux-tool-rtla.mk.in | 32
+++++++++++++++++++++++ 3 files changed, 43 insertions(+)
 create mode 100644 package/linux-tools/linux-tool-rtla.mk.in
DEVELOPERS +1 -0
index fe7194f817..8f459c796a 100644
@@ -2109,6 +2109,7 @@ F:	package/timescaledb/
 N:	Maxime Chevallier <[email protected]>
 F:	package/libtraceevent/
 F:	package/libtracefs
+F:	package/linux-tools/linux-tool-rtla.mk.in
 
 N:	Michael Durrant <[email protected]>
 F:	board/arcturus/
package/linux-tools/Config.in +0 -0
index 8a0b6d5802..186392b816 100644
@@ -102,6 +102,16 @@ config 

BR2_PACKAGE_LINUX_TOOLS_PERF_NEEDS_HOST_PYTHON3

Quoted 7 lines

package/linux-tools/Config.in

Quoted 4 lines

endif

package/linux-tools/Config.in +2 -0
+config BR2_PACKAGE_LINUX_TOOLS_RTLA
+	bool "rtla"  

Since a version dependency exists, you might add:
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_17

Good call !

Quoted 33 lines
Quoted 20 lines
package/linux-tools/Config.in +4 -0
+	select BR2_PACKAGE_LINUX_TOOLS
+	select BR2_PACKAGE_LIBTRACEFS
+	help
+	  Linux 5.17 and later has 2 new tracers, osnoise and

timerlat.

package/linux-tools/Config.in +1 -0
+	  There tracers allow performing latency analysis, for

which

package/linux-tools/Config.in +3 -0
+	  the rtla tool provides wrapper commands to visualize and
+	  extrace latency traces and reports.
+
 config BR2_PACKAGE_LINUX_TOOLS_SELFTESTS
 	bool"selftests"
 	depends on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS # bash
package/linux-tools/linux-tool-rtla.mk.in new file +0 -0
new file mode 100644
index 0000000000..a736e3b785

package/linux-tools/linux-tool-rtla.mk.in line 9

Quoted 9 lines
package/linux-tools/linux-tool-rtla.mk.in new file +9 -0
@@ -0,0 +1,32 @@
+################################################################################
+#
+# rtla
+#
+################################################################################
+
+LINUX_TOOLS += rtla
+
+RTLA_DEPENDENCIES = host-pkgconf libtracefs  

RTLA needs some kernel features; better to include them here, saves time experimenting:

Quoted 9 lines
# linux kernel needs FTRACE, TIMERLAT_TRACER, HIST_TRIGGERS for RTLA
to work
ifeq ($(BR2_PACKAGE_LINUX_TOOLS_RTLA),y)
define RTLA_LINUX_CONFIG_FIXUPS
	$(call KCONFIG_ENABLE_OPT,CONFIG_FTRACE)
	$(call KCONFIG_ENABLE_OPT,CONFIG_TIMERLAT_TRACER)
	$(call KCONFIG_ENABLE_OPT,CONFIG_HIST_TRIGGERS)
endef
endif

Oh I wasn't aware that we could enable kernel options that way. I'll include them in the v2, along with CONFIG_OSNOISE_TRACER that is also required.

Quoted 9 lines

package/linux-tools/linux-tool-rtla.mk.in line 14

Quoted 5 lines
package/linux-tools/linux-tool-rtla.mk.in new file +5 -0
+RTLA_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
+	CC=$(TARGET_CC) \
+	LDFLAGS="$(TARGET_LDFLAGS)" \
+	PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
+  

The RTLA Makefile unconditionally compiles with stack smashing protection; linking fails on builds configured without this feature:

Quoted 7 lines
# adapted from linux-tool-tmon.mk.in
ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
define RTLA_DISABLE_STACK_PROTECTOR
	$(SED) 's/-fstack-protector.* //' 
$(LINUX_DIR)/tools/tracing/rtla/Makefile
endef
endif

Good catch too, I didn't see that.

Quoted 30 lines

package/linux-tools/linux-tool-rtla.mk.in

Quoted 10 lines
package/linux-tools/linux-tool-rtla.mk.in new file +2 -0
+define RTLA_BUILD_CMDS
+	$(Q)if ! grep install

$(LINUX_DIR)/tools/tracing/rtla/Makefile

Quoted 1 line

/dev/null 2>&1 ; then \

package/linux-tools/linux-tool-rtla.mk.in new file +1 -0
+		echo "Your kernel version is too old and does not

implement the rtla tool." ; \

package/linux-tools/linux-tool-rtla.mk.in new file +4 -0
+		echo "At least kernel 5.17 must be used." ; \
+		exit 1 ; \
+	fi
+  
	$(RTLA_DISABLE_STACK_PROTECTOR)

package/linux-tools/linux-tool-rtla.mk.in

Quoted 11 lines
package/linux-tools/linux-tool-rtla.mk.in new file +11 -0
+	$(TARGET_MAKE_ENV) \
+	$(MAKE) $(RTLA_MAKE_OPTS) \
+	-C $(LINUX_DIR)/tools/tracing rtla
+endef
+
+define RTLA_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/tracing \
+	$(RTLA_MAKE_OPTS) \
+	DESTDIR=$(TARGET_DIR) \
+	rtla_install
+endef  

rtla_install fails with:
Makefile:34: *** NOTICE: rst2man required to generate man pages. Stop. because it tries to build and install man pages also. Better to use a custom install command:

Quoted 6 lines

# The rtla_install target tries to create and install manpages,

# which terminates with an error and cannot be disabled
define RTLA_INSTALL_TARGET_CMDS
	$(INSTALL) -m 0755 -D $(LINUX_DIR)/tools/tracing/rtla/rtla \
		$(TARGET_DIR)/usr/bin/rtla
endef

Ok makes sense as well :)

Thanks a lot for the review, tests and fixes !

Maxime

Quoted 5 lines

Kind regards,
Andreas

Quoted 2 lines

--
2.39.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

Re: [Buildroot] [PATCH 3/4] package/linux-tools: add rtla

Hi Maxime, *

Quoted 10 lines · Maxime Chevallier

Hello Andreas,

Quoted 3 lines · On Sun, 05 Feb 2023 09:22:56 +0100 Andreas Ziegler <[email protected]> wrote:

Hi Maxime,

I was able to build RTLA after some adaptions, see below.

Thanks for the effort, I appreciate !

You are welcome :-)

There is one more thing that might be improved:

On an aarch64 build, using an internal musl toolchain, I encountered the following build issue:

In file included from src/trace.h:2,

                 from src/osnoise.h:2,
                 from src/rtla.c:11:

/home/data/buildroot.rpi64/host/bin/../aarch64-buildroot-linux-musl/sysroot/usr/include/tracefs/tracefs.h:50:35: error: unknown type name ‘cpu_set_t’
50 | cpu_set_t *set, size_t
set_size);
| ^~~~~~~~~
(...)
src/osnoise_top.c: In function ‘osnoise_top_main’:
src/osnoise_top.c:618:26: warning: implicit declaration of function ‘tracefs_iterate_raw_events’; did you mean ‘tracefs_system_events’? [-Wimplicit-function-declaration]

  618 |                 retval = tracefs_iterate_raw_events(trace->tep,
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                          tracefs_system_events

(...)

It seems that both libraries are compiled with _GNU_SOURCE

$ grep _GNU_SOURCE ../libtracefs-1.6.4/Makefile
override CFLAGS += -D_GNU_SOURCE $(LIBTRACEEVENT_INCLUDES) $(INCLUDES)
$ grep _GNU_SOURCE ../libtraceevent-1.7.1/Makefile
override CFLAGS += $(udis86-flags) -D_GNU_SOURCE

but rtla defines it inconsistently

$ grep _GNU_SOURCE tools/tracing/rtla/Makefile
$ grep _GNU_SOURCE tools/tracing/rtla/src/*.[ch]
tools/tracing/rtla/src/trace.c:#define _GNU_SOURCE

thereby missing some definitions from <sched.h>

Proposed fix below.

<cut>

Quoted 30 lines
Quoted 20 lines
Quoted 7 lines
package/linux-tools/linux-tool-rtla.mk.in new file +0 -0
new file mode 100644
index 0000000000..a736e3b785

package/linux-tools/linux-tool-rtla.mk.in line 9

Quoted 9 lines
package/linux-tools/linux-tool-rtla.mk.in new file +9 -0
@@ -0,0 +1,32 @@
+################################################################################
+#
+# rtla
+#
+################################################################################
+
+LINUX_TOOLS += rtla
+
+RTLA_DEPENDENCIES = host-pkgconf libtracefs

RTLA needs some kernel features; better to include them here, saves time experimenting:

Quoted 9 lines
# linux kernel needs FTRACE, TIMERLAT_TRACER, HIST_TRIGGERS for RTLA
to work
ifeq ($(BR2_PACKAGE_LINUX_TOOLS_RTLA),y)
define RTLA_LINUX_CONFIG_FIXUPS
	$(call KCONFIG_ENABLE_OPT,CONFIG_FTRACE)
	$(call KCONFIG_ENABLE_OPT,CONFIG_TIMERLAT_TRACER)
	$(call KCONFIG_ENABLE_OPT,CONFIG_HIST_TRIGGERS)
endef
endif
Quoted 6 lines

Oh I wasn't aware that we could enable kernel options that way. I'll include them in the v2, along with CONFIG_OSNOISE_TRACER that is also required.

Quoted 2 lines

package/linux-tools/linux-tool-rtla.mk.in line 11

Quoted 2 lines
package/linux-tools/linux-tool-rtla.mk.in new file +2 -0
+RTLA_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
+	CC=$(TARGET_CC) \

Define _GNU_SOURCE to prevent the musl build error above. This generates a warning due to redefinition of symbol in trace.c, but it is less intrusive than patching the source code:

+ EXTRA_CFLAGS="-D_GNU_SOURCE" \

Quoted 54 lines
Quoted 7 lines

package/linux-tools/linux-tool-rtla.mk.in line 14

Quoted 3 lines
package/linux-tools/linux-tool-rtla.mk.in new file +3 -0
+	LDFLAGS="$(TARGET_LDFLAGS)" \
+	PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
+

The RTLA Makefile unconditionally compiles with stack smashing protection; linking fails on builds configured without this feature:

Quoted 7 lines
# adapted from linux-tool-tmon.mk.in
ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
define RTLA_DISABLE_STACK_PROTECTOR
	$(SED) 's/-fstack-protector.* //'
$(LINUX_DIR)/tools/tracing/rtla/Makefile
endef
endif

Good catch too, I didn't see that.

Quoted 30 lines

package/linux-tools/linux-tool-rtla.mk.in

Quoted 10 lines
package/linux-tools/linux-tool-rtla.mk.in new file +2 -0
+define RTLA_BUILD_CMDS
+	$(Q)if ! grep install

$(LINUX_DIR)/tools/tracing/rtla/Makefile

Quoted 1 line

/dev/null 2>&1 ; then \

package/linux-tools/linux-tool-rtla.mk.in new file +1 -0
+		echo "Your kernel version is too old and does not

implement the rtla tool." ; \

package/linux-tools/linux-tool-rtla.mk.in new file +4 -0
+		echo "At least kernel 5.17 must be used." ; \
+		exit 1 ; \
+	fi
+
	$(RTLA_DISABLE_STACK_PROTECTOR)

package/linux-tools/linux-tool-rtla.mk.in

Quoted 11 lines
package/linux-tools/linux-tool-rtla.mk.in new file +11 -0
+	$(TARGET_MAKE_ENV) \
+	$(MAKE) $(RTLA_MAKE_OPTS) \
+	-C $(LINUX_DIR)/tools/tracing rtla
+endef
+
+define RTLA_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/tracing \
+	$(RTLA_MAKE_OPTS) \
+	DESTDIR=$(TARGET_DIR) \
+	rtla_install
+endef

rtla_install fails with:
Makefile:34: *** NOTICE: rst2man required to generate man pages. Stop. because it tries to build and install man pages also. Better to use a custom install command:

Quoted 6 lines

# The rtla_install target tries to create and install manpages,

# which terminates with an error and cannot be disabled
define RTLA_INSTALL_TARGET_CMDS
	$(INSTALL) -m 0755 -D $(LINUX_DIR)/tools/tracing/rtla/rtla \
		$(TARGET_DIR)/usr/bin/rtla
endef
Quoted 11 lines

Ok makes sense as well :)

Thanks a lot for the review, tests and fixes !

Maxime

Quoted 5 lines

Kind regards,
Andreas

Quoted 2 lines

--
2.39.1

Kind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot