Linus had a problem compiling RTLA, saying:
"[...] I wish the tracing tools would do a bit more package
checking and helpful error messages too, rather than just
fail with:
fatal error: tracefs.h: No such file or directory"
Which is indeed not a helpful message. Update the Makefile, adding
proper checks for the dependencies, with useful information about
how to resolve possible problems.
For example, the previous error is now reported as:
$ make
********************************************
** NOTICE: libtracefs version 1.3 or higher not found
**
** Consider installing the latest libtracefs from your
** distribution, e.g., 'dnf install libtracefs' on Fedora,
** or from source:
**
** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/
**
********************************************
These messages are inspired by the ones used on trace-cmd, as suggested
by Stevel Rostedt.
Cc: Ingo Molnar <[email protected]>
Cc: Andrew Morton <[email protected]>
Reported-by: Linus Torvalds <[email protected]>
Suggested-by: Steven Rostedt <[email protected]>
Signed-off-by: Daniel Bristot de Oliveira <[email protected]>
---
tools/tracing/rtla/Makefile | 72 +++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile
index 5a1eda617992..448e9073736a 100644
--- a/tools/tracing/rtla/Makefile
+++ b/tools/tracing/rtla/Makefile
@@ -57,6 +57,78 @@ else
DOCSRC = $(SRCTREE)/../../../Documentation/tools/rtla/
endif
+LIBTRACEEVENT = libtraceevent
+LIBTRACEFS = libtracefs
+LIBPROCPS = libprocps
+
+LIBTRACEEVENT_MIN_VERSION = 1.5
+LIBTRACEFS_MIN_VERSION = 1.3
+LIBPROCPS_MIN_VERSION = 3.3
+
+TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) $(LIBTRACEEVENT) > /dev/null 2>&1 || echo n")
+ifeq ("$(TEST_LIBTRACEEVENT)", "n")
+.PHONY: warning_traceevent
+warning_traceevent:
+ @echo "********************************************"
+ @echo "** NOTICE: $(LIBTRACEEVENT) version $(LIBTRACEEVENT_MIN_VERSION) or higher not found"
+ @echo "**"
+ @echo "** Consider installing the latest $(LIBTRACEEVENT) from your"
+ @echo "** distribution, e.g., 'dnf install $(LIBTRACEEVENT)' on Fedora,"
+ @echo "** or from source:"
+ @echo "**"
+ @echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ "
+ @echo "**"
+ @echo "********************************************"
+endif
+
+TEST_LIBTRACEFS = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) $(LIBTRACEFS) > /dev/null 2>&1 || echo n")
+ifeq ("$(TEST_LIBTRACEFS)", "n")
+.PHONY: warning_tracefs
+warning_tracefs:
+ @echo "********************************************"
+ @echo "** NOTICE: $(LIBTRACEFS) version $(LIBTRACEFS_MIN_VERSION) or higher not found"
+ @echo "**"
+ @echo "** Consider installing the latest $(LIBTRACEFS) from your"
+ @echo "** distribution, e.g., 'dnf install $(LIBTRACEFS)' on Fedora,"
+ @echo "** or from source:"
+ @echo "**"
+ @echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ "
+ @echo "**"
+ @echo "********************************************"
+endif
+
+TEST_LIBPROCPS = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBPROCPS_MIN_VERSION) $(LIBPROCPS) > /dev/null 2>&1 || echo n")
+ifeq ("$(TEST_LIBPROCPS)", "n")
+.PHONY: warning_procps
+warning_procps:
+ @echo "********************************************"
+ @echo "** NOTICE: $(LIBPROCPS) version $(LIBPROCPS_MIN_VERSION) or higher not found"
+ @echo "**"
+ @echo "** Consider installing the latest procps-ng-devel from your"
+ @echo "** distribution, e.g., 'dnf install procps-ng-devel' on Fedora,"
+ @echo "** or from source:"
+ @echo "**"
+ @echo "** https://gitlab.com/procps-ng/procps "
+ @echo "**"
+ @echo "********************************************"
+endif
+
+TEST_RST2MAN = $(shell sh -c "rst2man --version > /dev/null 2>&1 || echo n")
+ifeq ("$(TEST_RST2MAN)", "n")
+.PHONY: warning_rst2man
+warning_rst2man:
+ @echo "********************************************"
+ @echo "** NOTICE: rst2man not found"
+ @echo "**"
+ @echo "** Consider installing the latest rst2man from your"
+ @echo "** distribution, e.g., 'dnf install python3-docutils' on Fedora,"
+ @echo "** or from source:"
+ @echo "**"
+ @echo "** https://docutils.sourceforge.io/docs/dev/repository.html "
+ @echo "**"
+ @echo "********************************************"
+endif
+
.PHONY: all
all: rtla
--
2.35.1