Skip to contentSkip to conversation

kernel-shark: Cleanup in CMakeLists.txt

PATCH In review Yordan Karadzhov (VMware) 2 participants 3 messages Jul 26, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kernel-shark: Cleanup in CMakeLists.txt

The CMake variable TRACE CMD INCLUDE_DIR is a leftover from previous versions of the build system. This variable is no longer set, hance its usage has no effect.

---
 CMakeLists.txt | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
CMakeLists.txt +1 -2
index f3449a5..67dfb81 100644
@@ -132,8 +132,7 @@ else (CMAKE_BUILD_TYPE MATCHES Package)
 endif (CMAKE_BUILD_TYPE MATCHES Package)
 
 include_directories(${KS_DIR}/src/
-                    ${KS_DIR}/build/src/
-                    ${TRACECMD_INCLUDE_DIR})
+                    ${KS_DIR}/build/src/)
 
 message("")
 message(STATUS "C flags      : " ${CMAKE_C_FLAGS})
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/2 kernel-shark: Treat all tracing headers as library headers

The CMake scripts used to discover all tracing libraries are modified such that the full path to the header is determined. Later there is no need to add that part when the headers are included. Using angular brackets ('<' and '>') denotes that it is a library header and not a local one.

1. Note that this patch actually fixes a build failure, caused by the following commit in libtracefs:
880885d (libtracefs: Remove "traceevent/" from referencing libtraceevent headers) It seems that so far the discovery of the headers was working more or less by chance.

2. Note that after applying the patch you may need to clean the Cmake cache (running cmake_clean.sh).

---
 build/FindTraceCmd.cmake     | 2 +-
 build/FindTraceEvent.cmake   | 2 +-
 build/FindTraceFS.cmake      | 2 +-
 src/KsAdvFilteringDialog.cpp | 2 +-
 src/libkshark-tepdata.c      | 3 +--
 src/plugins/sched_events.c   | 2 +-
 6 files changed, 6 insertions(+), 7 deletions(-)
build/FindTraceCmd.cmake +1 -1
index 23eefed..602eac5 100644
@@ -42,7 +42,7 @@ pkg_check_modules(PC_TraceCmd QUIET libtracecmd)
 set(TraceCmd_VERSION     ${PC_TraceCmd_VERSION})
 set(TraceCmd_DEFINITIONS ${PC_TraceCmd_CFLAGS_OTHER})
 
-find_path(TraceCmd_INCLUDE_DIR NAMES trace-cmd/trace-cmd.h
+find_path(TraceCmd_INCLUDE_DIR NAMES trace-cmd.h
                                HINTS ${PC_TraceCmd_INCLUDE_DIRS}
                                      ${PC_TraceCmd_INCLUDEDIR})
 
build/FindTraceEvent.cmake +1 -1
index ae391b6..668a5de 100644
@@ -42,7 +42,7 @@ pkg_check_modules(PC_TraceEvent QUIET libtraceevent)
 set(TraceEvent_VERSION     ${PC_TraceEvent_VERSION})
 set(TraceEvent_DEFINITIONS ${PC_TraceEvent_CFLAGS_OTHER})
 
-find_path(TraceEvent_INCLUDE_DIR  NAMES traceevent/event-parse.h
+find_path(TraceEvent_INCLUDE_DIR  NAMES event-parse.h
                                   HINTS ${PC_TraceEvent_INCLUDE_DIRS}
                                         ${PC_TraceEvent_INCLUDEDIR})
 
build/FindTraceFS.cmake +1 -1
index 82fa012..251b506 100644
@@ -42,7 +42,7 @@ pkg_check_modules(PC_TraceFS QUIET libtracefs)
 set(TraceFS_VERSION     ${PC_TraceFS_VERSION})
 set(TraceFS_DEFINITIONS ${PC_TraceFS_CFLAGS_OTHER})
 
-find_path(TraceFS_INCLUDE_DIR  NAMES tracefs/tracefs.h
+find_path(TraceFS_INCLUDE_DIR  NAMES tracefs.h
                                HINTS ${PC_TraceFS_INCLUDE_DIRS}
                                      ${PC_TraceFS_INCLUDEDIR})
 
src/KsAdvFilteringDialog.cpp +1 -1
index 2fdb624..f01467d 100644
@@ -10,7 +10,7 @@
  */
 
 // trace-cmd
-#include "trace-cmd/trace-cmd.h"
+#include <trace-cmd.h>
 
 // KernelShark
 #include "libkshark.h"
src/libkshark-tepdata.c +1 -2
index acc554b..865ca82 100644
@@ -21,8 +21,7 @@
 #include <string.h>
 
 // trace-cmd
-#include "trace-cmd/trace-cmd.h"
-#include "tracefs/tracefs.h"
+#include <trace-cmd.h>
 
 // KernelShark
 #include "libkshark.h"
src/plugins/sched_events.c +1 -1
index 659ecc3..83c2520 100644
@@ -14,7 +14,7 @@
 #include <stdio.h>
 
 // trace-cmd
-#include "trace-cmd/trace-cmd.h"
+#include <trace-cmd.h>
 
 // KernelShark
 #include "plugins/sched_events.h"
Signature · 1 line
2.27.0
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] kernel-shark: Treat all tracing headers as library headers

Quoted 5 lines · On Mon, 26 Jul 2021 12:41:41 +0300 "Yordan Karadzhov (VMware)"…

1. Note that this patch actually fixes a build failure, caused by the following commit in libtracefs:
880885d (libtracefs: Remove "traceevent/" from referencing libtraceevent headers) It seems that so far the discovery of the headers was working more or less by chance.

Yep, it was "by chance", that we just happened to include the headers in the main directory in the same paths as were added in the files. But if we ever changed those paths, the files would not be updated and the compile would break.

to both patches.

Thanks Yordan.

-- Steve