Skip to contentSkip to conversation

kernel-shark: Silence a warning from 'cmake_clean.sh'

PATCH In review Yordan Karadzhov (VMware) 2 participants 6 messages Nov 10, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 kernel-shark: Silence a warning from 'cmake_clean.sh'

The file 'CTestTestfile.cmake' may not exist if the CI tests were never executed.

---
 build/cmake_clean.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
build/cmake_clean.sh +1 -1
index d645c32..8defa67 100755
@@ -2,7 +2,7 @@ make clean
 rm CMakeCache.txt
 rm cmake_install.cmake
 rm Makefile
-rm CTestTestfile.cmake
+rm -f CTestTestfile.cmake
 rm -f DartConfiguration.tcl
 rm -rf CMakeFiles/
 rm -rf src/
Signature · 1 line
2.33.1
#1 lore raw

PATCH 2/5 kernel-shark: Fix a warning from 'KsUtils.cpp'

gcc 11.2.1 prints the following warning:

KsUtils.cpp:573:41: warning: loop variable 'task' creates a copy from type 'const QString' [-Wrange-loop-construct]

---
 src/KsUtils.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/KsUtils.cpp +1 -1
index 364c25d..a22c445 100644
@@ -570,7 +570,7 @@ QMap<int, QVector<int>> parseTaskList(QString v_str)
 			if (name.isEmpty())
 				continue;
 
-			for (auto const task: taskList) {
+			for (auto const &task: taskList) {
 				if(name == task)
 					ret[sd].append(pid);
 			}
Signature · 1 line
2.33.1
#2 lore raw

PATCH 3/5 kernel-shark: Update the README file

In reply to Yordan Karadzhov (VMware)

Making sure that the install instructions are adequate for building with the latest versions of the third-party libraries.

---
 README | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
README +10 -5
index 652891c..24d6001 100644
@@ -13,7 +13,8 @@ KernelShark has the following external dependencies:
 1. In order to install the packages on Ubuntu do the following:
     sudo apt-get install build-essential git cmake libjson-c-dev -y
     sudo apt-get install freeglut3-dev libxmu-dev libxi-dev -y
-    sudo apt-get install fonts-freefont-ttf
+    sudo apt-get install flex bison -y
+    sudo apt-get install fonts-freefont-ttf -y
     sudo apt-get install qtbase5-dev -y
 
 1.1 If you want to be able to generate Doxygen documentation:
@@ -21,12 +22,14 @@ KernelShark has the following external dependencies:
 
 
 2. In order to install the packages on Fedora, as root do the following:
-    dnf install gcc gcc-c++ git cmake json-c-devel -y
-    dnf install freeglut-devel redhat-rpm-config -y
-    dnf install qt5-qtbase-devel -y
+    sudo dnf install gcc gcc-c++ git cmake json-c-devel -y
+    sudo dnf install freeglut-devel redhat-rpm-config -y
+    sudo dnf install flex bison -y
+    sudo dnf install gnu-free-sans-fonts -y
+    sudo dnf install qt5-qtbase-devel -y
 
 2.1 If you want to be able to generate Doxygen documentation:
-    dnf install graphviz doxygen -y
+    sudo dnf install graphviz doxygen -y
 
 
 3. In order to install the final dependencies do the following:
@@ -43,6 +46,8 @@ KernelShark has the following external dependencies:
     git clone https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
     cd trace-cmd
     make
+    make libs
+    sudo make install
     sudo make install_libs
 
 Building:
Signature · 1 line
2.33.1
#3 lore raw

PATCH 4/5 kernel-shark: Add 'Requires' to libkshark.pc

In reply to Yordan Karadzhov (VMware)

Adding only the requirements for building 'libkshark'. The requirements for building the GUI are not supposed to be listed here.

---
 CMakeLists.txt           | 2 ++
 build/libkshark.pc.cmake | 2 ++
 2 files changed, 4 insertions(+)
CMakeLists.txt +2 -0
index bb7b2a1..3723654 100644
@@ -42,6 +42,8 @@ if (NOT _POLKIT_INSTALL_PREFIX)
 
 endif ()
 
+set(LIBTRACECMD_MIN_VERSION 1.0)
+
 set(CMAKE_MODULE_PATH "${KS_DIR}/build")
 find_package(TraceEvent REQUIRED)
 find_package(TraceFS    REQUIRED)
build/libkshark.pc.cmake +2 -0
index ad4ce34..0591cf9 100644
@@ -6,5 +6,7 @@ Name: libkshark
 URL: https://git.kernel.org/pub/scm/utils/trace-cmd/kernel-shark.git/
 Description: Library for accessing ftrace file system
 Version: @KS_VERSION_STRING@
+Requires: tracecmd >= @LIBTRACECMD_MIN_VERSION@
+Requires: json-c
 Cflags: -I${includedir}
 Libs: -L${libdir} -lkshark
Signature · 1 line
2.33.1
#4 lore raw

Re: [PATCH 4/5] kernel-shark: Add 'Requires' to libkshark.pc

build/libkshark.pc.cmake Name: libkshark · line 9

Quoted 7 lines · On Wed, 10 Nov 2021 16:37:46 +0200 "Yordan Karadzhov (VMware)"…
build/libkshark.pc.cmake +1 -0
@@ -6,5 +6,7 @@ Name: libkshark
 URL: https://git.kernel.org/pub/scm/utils/trace-cmd/kernel-shark.git/
 Description: Library for accessing ftrace file system
 Version: @KS_VERSION_STRING@
+Requires: tracecmd >= @LIBTRACECMD_MIN_VERSION@

Note, when I added this, I get:

  # pkg-config --libs libkshark
  Package tracecmd was not found in the pkg-config search path.
  Perhaps you should add the directory containing `tracecmd.pc'
  to the PKG_CONFIG_PATH environment variable
  Package 'tracecmd', required by 'libkshark', not found

But if I switch it to libtracecmd, I get:

  # pkg-config --libs libkshark
  -lkshark -ltracecmd -ltracefs -ltraceevent 

-- Steve

Quoted 4 lines
build/libkshark.pc.cmake +1 -0
+Requires: json-c
 Cflags: -I${includedir}
 Libs: -L${libdir} -lkshark
#5 lore raw

PATCH 5/5 kernel-shark: Always run 'ldconfig' after installing libkshark

In reply to Yordan Karadzhov (VMware)

This way we make sure that the run-time bindings of the linker are properly configured and have the necessary cache to find the library.

---
 src/CMakeLists.txt | 5 +++++
 1 file changed, 5 insertions(+)
src/CMakeLists.txt +5 -0
index f3c4e0a..babb9c1 100644
@@ -46,6 +46,11 @@ install(FILES "${KS_DIR}/libkshark.pc"
         DESTINATION ${PKG_CONGIG_DIR}
             COMPONENT                 libkshark-devel)
 
+install(CODE "message(\"-- Executing: ldconfig ${_LIBDIR}\")
+              execute_process(COMMAND bash \"-c\" \"ldconfig ${_INSTALL_PREFIX}\"
+                              ECHO_ERROR_VARIABLE)"
+        COMPONENT libkshark-devel)
+
 if (OPENGL_FOUND)
 
     message(STATUS "libkshark-plot")
Signature · 1 line
2.33.1