Skip to contentSkip to conversation

Two fixes for compiling

PATCH In review [email protected] 3 participants 9 messages Feb 9, 2020 – Feb 21, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Two fixes for compiling

This contains two fixes of compiling.

The KernelShark one is to inherit libdir into kernelshark CMakeLists so that the libdir parsed to Makefile is honored in kernelshark.

The trace-cmd one is to remove python-gui which depends on the obsoleted gtk stuff.

In order to compile and test this change, the following patch from Tzvetomir need to be applied.
[PATCH] kernel-shark: Fix search path for libtracefs
https://lore.kernel.org/linux-trace-devel/[email protected]/T/#u

Note: I always send email and git commits with signature "Zamir SUN" before. However I see DCO requires to sign using real name, so I changed to fulfill the DCO.

#1 lore raw

PATCH 1/2 KernelShark: Inherit libdir from Makefile

From: "Ziqian SUN (Zamir)" <[email protected]>

The trace-cmd makefile supports install lib into a different name like lib64. Now this patch implemented the same in kernel-shark.

And in order to make debuginfo also lives in the same file structure, the compiling dir is changed to reflect libdir and prefix as well.

---
 Makefile                        |  2 +-
 kernel-shark/CMakeLists.txt     | 13 +++++++++----
 kernel-shark/src/CMakeLists.txt |  6 +++---
 3 files changed, 13 insertions(+), 8 deletions(-)
Makefile +1 -1
index d75f143..1aca807 100644
@@ -295,7 +295,7 @@ CMAKE_COMMAND = /usr/bin/cmake
 BUILD_TYPE ?= RelWithDebInfo
 
 $(kshark-dir)/build/Makefile: $(kshark-dir)/CMakeLists.txt
-	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D_INSTALL_PREFIX=$(prefix) ..
+	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D_INSTALL_PREFIX=$(prefix) -D_LIBDIR=$(libdir) ..
 
 gui: force $(CMD_TARGETS) $(kshark-dir)/build/Makefile
 	$(Q)$(MAKE) $(S) -C $(kshark-dir)/build
kernel-shark/CMakeLists.txt +9 -4
index 8786b83..6652d08 100644
@@ -17,6 +17,10 @@ if (NOT _INSTALL_PREFIX)
     set(_INSTALL_PREFIX "/usr/local")
 endif (NOT _INSTALL_PREFIX)
 
+if (NOT _LIBDIR)
+    set(_LIBDIR "${_INSTALL_PREFIX}/lib")
+endif (NOT _LIBDIR)
+
 include(${KS_DIR}/build/FindTraceCmd.cmake)
 include(${KS_DIR}/build/FindJSONC.cmake)
 
@@ -34,8 +38,8 @@ if (Qt5Widgets_FOUND)
 
 endif (Qt5Widgets_FOUND)
 
-set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/lib")
-set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin")
+set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/${_LIBDIR}")
+set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/${_INSTALL_PREFIX}/bin")
 
 set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall -pthread -fPIC")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fPIC")
@@ -54,14 +58,15 @@ if (NOT CMAKE_CXX_FLAGS_PACKAGE)
     set(CMAKE_CXX_FLAGS_PACKAGE "-O3")
 endif (NOT CMAKE_CXX_FLAGS_PACKAGE)
 
-set(KS_PLUGIN_INSTALL_PREFIX ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/plugins/)
+set(KS_PLUGIN_INSTALL_PREFIX ${_LIBDIR}/${KS_APP_NAME}/plugins/)
 
 set(KS_ICON        KS_icon_shark.svg)
 set(KS_ICON_FIN    KS_icon_fin.svg)
 set(KS_LOGO        KS_logo_symbol.svg)
 set(KS_LOGO_LABEL  KS_logo_horizontal.svg)
 
-set(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/")
+SET(CMAKE_INSTALL_RPATH "${_LIBDIR}/${KS_APP_NAME}/")
+
 
 if (CMAKE_BUILD_TYPE MATCHES Package)
 
kernel-shark/src/CMakeLists.txt +3 -3
index 33b5db8..9666b18 100644
@@ -15,7 +15,7 @@ target_link_libraries(kshark ${TRACEEVENT_LIBRARY}
 
 set_target_properties(kshark  PROPERTIES SUFFIX	".so.${KS_VERSION_STRING}")
 
-install(TARGETS kshark LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME})
+install(TARGETS kshark LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME})
 
 if (OPENGL_FOUND AND GLUT_FOUND)
 
@@ -29,7 +29,7 @@ if (OPENGL_FOUND AND GLUT_FOUND)
 
     set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
 
-    install(TARGETS kshark-plot LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME})
+    install(TARGETS kshark-plot LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME})
 
 endif (OPENGL_FOUND AND GLUT_FOUND)
 
@@ -85,7 +85,7 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
 
     install(TARGETS ${KS_APP_NAME} kshark-record kshark-gui
             RUNTIME DESTINATION ${_INSTALL_PREFIX}/bin/
-            LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/)
+            LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME}/)
 
     install(FILES "${KS_DIR}/${KS_APP_NAME}.desktop"
             DESTINATION ${_INSTALL_PREFIX}/share/applications/)
Signature · 1 line
2.24.1
#2 lore raw

Re: [PATCH 1/2] KernelShark: Inherit libdir from Makefile

Hi Ziqian,
Thanks a lot for helping us improving the build system! Sorry for the delay of my reply. I was on a ski vacation.

Please explain us your motivation for this change. I have one general objection and couple of comments in the patch itself. First of all, libkshark is not ready to be called officially a library, because we are still playing with the API. Our plan is to introduce the library (and its API) with the release of KernelShark 2.0. Before this, I would prefer all KernelShark libraries to be installed together with the executable. For me, separating the libraries and the executable looks like an encouragement for using directly the libraries, but we do not want to do this yet. Also please note that we are in the process of splitting the repository. When released, KernelShark 2.0 will be in a separate repo and will have its own build system that uses the trace-cmd libraries as external dependency.

Quoted 44 lines · On 9.02.20 г. 5:42 ч., [email protected] wrote:

From: "Ziqian SUN (Zamir)" <[email protected]>

The trace-cmd makefile supports install lib into a different name like lib64. Now this patch implemented the same in kernel-shark.

And in order to make debuginfo also lives in the same file structure, the compiling dir is changed to reflect libdir and prefix as well.

---
  Makefile                        |  2 +-
  kernel-shark/CMakeLists.txt     | 13 +++++++++----
  kernel-shark/src/CMakeLists.txt |  6 +++---
  3 files changed, 13 insertions(+), 8 deletions(-)
Makefile +1 -1
index d75f143..1aca807 100644
@@ -295,7 +295,7 @@ CMAKE_COMMAND = /usr/bin/cmake
  BUILD_TYPE ?= RelWithDebInfo
 
  $(kshark-dir)/build/Makefile: $(kshark-dir)/CMakeLists.txt
-	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D_INSTALL_PREFIX=$(prefix) ..
+	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D_INSTALL_PREFIX=$(prefix) -D_LIBDIR=$(libdir) ..
 
  gui: force $(CMD_TARGETS) $(kshark-dir)/build/Makefile
  	$(Q)$(MAKE) $(S) -C $(kshark-dir)/build
kernel-shark/CMakeLists.txt +4 -0
index 8786b83..6652d08 100644
@@ -17,6 +17,10 @@ if (NOT _INSTALL_PREFIX)
      set(_INSTALL_PREFIX "/usr/local")
  endif (NOT _INSTALL_PREFIX)
 
+if (NOT _LIBDIR)
+    set(_LIBDIR "${_INSTALL_PREFIX}/lib")
+endif (NOT _LIBDIR)
+
  include(${KS_DIR}/build/FindTraceCmd.cmake)
  include(${KS_DIR}/build/FindJSONC.cmake)
 

kernel-shark/CMakeLists.txt if (Qt5Widgets_FOUND) · line 42

Quoted 7 lines
kernel-shark/CMakeLists.txt +2 -2
@@ -34,8 +38,8 @@ if (Qt5Widgets_FOUND)
 
  endif (Qt5Widgets_FOUND)
 
-set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/lib")
-set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin")
+set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/${_LIBDIR}")
+set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/${_INSTALL_PREFIX}/bin")

Not sure what is your idea here, but this looks wrong to me. When you are building from source (just typing "make") you don't expect the object files and the executables to be placed outside the trunk of the repository(${KS_DIR}). Do not confuse building the source with installing (when typing "make install").

Quoted 7 lines
kernel-shark/CMakeLists.txt +0 -0
  set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall -pthread -fPIC")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fPIC")
@@ -54,14 +58,15 @@ if (NOT CMAKE_CXX_FLAGS_PACKAGE)
      set(CMAKE_CXX_FLAGS_PACKAGE "-O3")
  endif (NOT CMAKE_CXX_FLAGS_PACKAGE)
 

kernel-shark/CMakeLists.txt if (NOT CMAKE_CXX_FLAGS_PACKAGE) · line 68

Quoted 10 lines
kernel-shark/CMakeLists.txt +2 -2
-set(KS_PLUGIN_INSTALL_PREFIX ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/plugins/)
+set(KS_PLUGIN_INSTALL_PREFIX ${_LIBDIR}/${KS_APP_NAME}/plugins/)
 
  set(KS_ICON        KS_icon_shark.svg)
  set(KS_ICON_FIN    KS_icon_fin.svg)
  set(KS_LOGO        KS_logo_symbol.svg)
  set(KS_LOGO_LABEL  KS_logo_horizontal.svg)
 
-set(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/")
+SET(CMAKE_INSTALL_RPATH "${_LIBDIR}/${KS_APP_NAME}/")

Please stick to lower-case characters with all CMake commands.

Thanks!
Yordan

Quoted 34 lines
kernel-shark/CMakeLists.txt +0 -0
  if (CMAKE_BUILD_TYPE MATCHES Package)
 
kernel-shark/src/CMakeLists.txt +3 -3
index 33b5db8..9666b18 100644
@@ -15,7 +15,7 @@ target_link_libraries(kshark ${TRACEEVENT_LIBRARY}
 
  set_target_properties(kshark  PROPERTIES SUFFIX	".so.${KS_VERSION_STRING}")
 
-install(TARGETS kshark LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME})
+install(TARGETS kshark LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME})
 
  if (OPENGL_FOUND AND GLUT_FOUND)
 
@@ -29,7 +29,7 @@ if (OPENGL_FOUND AND GLUT_FOUND)
 
      set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
 
-    install(TARGETS kshark-plot LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME})
+    install(TARGETS kshark-plot LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME})
 
  endif (OPENGL_FOUND AND GLUT_FOUND)
 
@@ -85,7 +85,7 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
 
      install(TARGETS ${KS_APP_NAME} kshark-record kshark-gui
              RUNTIME DESTINATION ${_INSTALL_PREFIX}/bin/
-            LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/)
+            LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME}/)
 
      install(FILES "${KS_DIR}/${KS_APP_NAME}.desktop"
              DESTINATION ${_INSTALL_PREFIX}/share/applications/)
author
#3 lore raw

Re: [PATCH 1/2] KernelShark: Inherit libdir from Makefile

Quoted 5 lines · Yordan Karadzhov (VMware)

Hi Ziqian,
Thanks a lot for helping us improving the build system! Sorry for the delay of my reply. I was on a ski vacation.

Please explain us your motivation for this change. I have one general objection and couple of comments in the patch itself.

Hi Yordan,

To be a little verbose, the background of the whole patchset about trying to fulfill packaging guideline of distribution.

I am the Fedora packager and recently updated trace-cmd to 2.8.3. Kernel shark lives as a sub package of trace-cmd in Fedora before I start with the packaging. By the time I update trace-cmd, I see some failure because libraries goes to lib directory rather than lib64 on x86_64, while the latter is the expected one for Fedora packages. So I have to come up with some sort of fix to make it happen.

Quoted 1 line

First of all, libkshark is not ready to be called officially a library, because we are still playing with the API. Our plan is to introduce the library (and its API) with the release of KernelShark 2.0. Before this, I would prefer all KernelShark libraries to be installed together with the executable. For me, separating the libraries and the executable looks like an encouragement for using directly the libraries, but we do not want to do this yet.

Sorry for make this confusing. Actually even when I've already make it into lib64, I don't have the motivation to make it a separate library (from packaging point of view). If you think moving these can potential make users think the libraries is ready to use, it might be better for me to carry on the patch within Fedora only just to make this fulfill guidelines.

Quoted 45 lines

Also please note that we are in the process of splitting the repository. When released, KernelShark 2.0 will be in a separate repo and will have its own build system that uses the trace-cmd libraries as external dependency.

Quoted 43 lines · On 9.02.20 г. 5:42 ч., [email protected] wrote:

From: "Ziqian SUN (Zamir)" <[email protected]>

The trace-cmd makefile supports install lib into a different name like lib64. Now this patch implemented the same in kernel-shark.

And in order to make debuginfo also lives in the same file structure, the compiling dir is changed to reflect libdir and prefix as well.

---
  Makefile                        |  2 +- kernel-shark/CMakeLists.txt     | 13 +++++++++---- kernel-shark/src/CMakeLists.txt |  6 +++---

  3 files changed, 13 insertions(+), 8 deletions(-)
Makefile +0 -0
index d75f143..1aca807 100644
@@ -295,7 +295,7 @@ CMAKE_COMMAND = /usr/bin/cmake

  BUILD_TYPE ?= RelWithDebInfo $(kshark-dir)/build/Makefile: $(kshark-dir)/CMakeLists.txt -    $(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND)

Makefile +1 -3
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D_INSTALL_PREFIX=$(prefix) ..
+    $(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) 
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D_INSTALL_PREFIX=$(prefix) 
-D_LIBDIR=$(libdir) ..

  gui: force $(CMD_TARGETS) $(kshark-dir)/build/Makefile $(Q)$(MAKE) $(S) -C $(kshark-dir)/build

kernel-shark/CMakeLists.txt +4 -0
index 8786b83..6652d08 100644
@@ -17,6 +17,10 @@ if (NOT _INSTALL_PREFIX)
       set(_INSTALL_PREFIX "/usr/local")
   endif (NOT _INSTALL_PREFIX)
+if (NOT _LIBDIR)
+    set(_LIBDIR "${_INSTALL_PREFIX}/lib")
+endif (NOT _LIBDIR)
+
   include(${KS_DIR}/build/FindTraceCmd.cmake)
   include(${KS_DIR}/build/FindJSONC.cmake)
Quoted 8 lines

kernel-shark/CMakeLists.txt if (Qt5Widgets_FOUND) · line 40

Quoted 6 lines
kernel-shark/CMakeLists.txt +2 -2
@@ -34,8 +38,8 @@ if (Qt5Widgets_FOUND)
   endif (Qt5Widgets_FOUND)
-set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/lib")
-set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin")
+set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/${_LIBDIR}")
+set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/${_INSTALL_PREFIX}/bin")

Not sure what is your idea here, but this looks wrong to me. When you are building from source (just typing "make") you don't expect the object files and the executables to be placed outside the trunk of the repository(${KS_DIR}). Do not confuse building the source with installing (when typing "make install").

In the beginning this was meant to make sure the debuginfo package is generated within corresponding lib64 directory. However I just compiled again and find it's not needed now.

Quoted 10 lines
Quoted 10 lines
kernel-shark/CMakeLists.txt +0 -0
   set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall -pthread -fPIC")

  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread

kernel-shark/CMakeLists.txt +1 -2
-fPIC")
@@ -54,14 +58,15 @@ if (NOT CMAKE_CXX_FLAGS_PACKAGE)
       set(CMAKE_CXX_FLAGS_PACKAGE "-O3")
   endif (NOT CMAKE_CXX_FLAGS_PACKAGE)
-set(KS_PLUGIN_INSTALL_PREFIX 
 ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/plugins/)
+set(KS_PLUGIN_INSTALL_PREFIX ${_LIBDIR}/${KS_APP_NAME}/plugins/)
Quoted 9 lines

kernel-shark/CMakeLists.txt if (NOT CMAKE_CXX_FLAGS_PACKAGE) · line 68

Quoted 6 lines
kernel-shark/CMakeLists.txt +1 -1
   set(KS_ICON        KS_icon_shark.svg)
   set(KS_ICON_FIN    KS_icon_fin.svg)
   set(KS_LOGO        KS_logo_symbol.svg)
   set(KS_LOGO_LABEL  KS_logo_horizontal.svg)
-set(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/")
+SET(CMAKE_INSTALL_RPATH "${_LIBDIR}/${KS_APP_NAME}/")

Please stick to lower-case characters with all CMake commands.

Ah sorry, this is definitely a typo when converting to capital letters in bulks.

Thanks for the review. As I don't know the background beforehand, if you think part of this patch still makes sense, I can make v2 and drop the bits you don't need yet.

Quoted 29 lines

Thanks!
Yordan

Quoted 26 lines
kernel-shark/CMakeLists.txt +0 -0
   if (CMAKE_BUILD_TYPE MATCHES Package)
kernel-shark/src/CMakeLists.txt +2 -2
index 33b5db8..9666b18 100644
@@ -15,7 +15,7 @@ target_link_libraries(kshark ${TRACEEVENT_LIBRARY}
   set_target_properties(kshark  PROPERTIES SUFFIX    ".so.${KS_VERSION_STRING}")
-install(TARGETS kshark LIBRARY DESTINATION 
 ${_INSTALL_PREFIX}/lib/${KS_APP_NAME})
+install(TARGETS kshark LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME})
   if (OPENGL_FOUND AND GLUT_FOUND)
@@ -29,7 +29,7 @@ if (OPENGL_FOUND AND GLUT_FOUND)
       set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
-    install(TARGETS kshark-plot LIBRARY DESTINATION 
 ${_INSTALL_PREFIX}/lib/${KS_APP_NAME})
+    install(TARGETS kshark-plot LIBRARY DESTINATION 
 ${_LIBDIR}/${KS_APP_NAME})
   endif (OPENGL_FOUND AND GLUT_FOUND)
@@ -85,7 +85,7 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)

      install(TARGETS ${KS_APP_NAME} kshark-record kshark-gui RUNTIME DESTINATION ${_INSTALL_PREFIX}/bin/
-            LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/) +            LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME}/) install(FILES "${KS_DIR}/${KS_APP_NAME}.desktop" DESTINATION ${_INSTALL_PREFIX}/share/applications/)

Signature · 3 lines
Zamir SUN
Fedora user
GPG : 1D86 6D4A 49CE 4BBD 72CF FCF5 D856 6E11 F2A0 525E
#4 lore raw

Re: [PATCH 1/2] KernelShark: Inherit libdir from Makefile

Quoted 95 lines · Zamir SUN
Quoted 5 lines · Yordan Karadzhov (VMware)

Hi Ziqian,
Thanks a lot for helping us improving the build system! Sorry for the delay of my reply. I was on a ski vacation.

Please explain us your motivation for this change. I have one general objection and couple of comments in the patch itself.

Hi Yordan,

To be a little verbose, the background of the whole patchset about trying to fulfill packaging guideline of distribution.

I am the Fedora packager and recently updated trace-cmd to 2.8.3. Kernel shark lives as a sub package of trace-cmd in Fedora before I start with the packaging. By the time I update trace-cmd, I see some failure because libraries goes to lib directory rather than lib64 on x86_64, while the latter is the expected one for Fedora packages. So I have to come up with some sort of fix to make it happen.

Quoted 1 line

First of all, libkshark is not ready to be called officially a library, because we are still playing with the API. Our plan is to introduce the library (and its API) with the release of KernelShark 2.0. Before this, I would prefer all KernelShark libraries to be installed together with the executable. For me, separating the libraries and the executable looks like an encouragement for using directly the libraries, but we do not want to do this yet.

Sorry for make this confusing. Actually even when I've already make it into lib64, I don't have the motivation to make it a separate library (from packaging point of view). If you think moving these can potential make users think the libraries is ready to use, it might be better for me to carry on the patch within Fedora only just to make this fulfill guidelines.

Quoted 45 lines

Also please note that we are in the process of splitting the repository. When released, KernelShark 2.0 will be in a separate repo and will have its own build system that uses the trace-cmd libraries as external dependency.

Quoted 42 lines · > On 9.02.20 г. 5:42 ч., [email protected] wrote:

From: "Ziqian SUN (Zamir)" <[email protected]>

The trace-cmd makefile supports install lib into a different name like lib64. Now this patch implemented the same in kernel-shark.

And in order to make debuginfo also lives in the same file structure, the compiling dir is changed to reflect libdir and prefix as well.

---
  Makefile                        |  2 +- kernel-shark/CMakeLists.txt     | 13 +++++++++---- kernel-shark/src/CMakeLists.txt |  6 +++---

  3 files changed, 13 insertions(+), 8 deletions(-)
Makefile +0 -0
index d75f143..1aca807 100644
@@ -295,7 +295,7 @@ CMAKE_COMMAND = /usr/bin/cmake

  BUILD_TYPE ?= RelWithDebInfo $(kshark-dir)/build/Makefile: $(kshark-dir)/CMakeLists.txt -    $(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND)

Makefile +1 -3
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D_INSTALL_PREFIX=$(prefix) ..
+    $(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) 
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D_INSTALL_PREFIX=$(prefix) 
-D_LIBDIR=$(libdir) ..

  gui: force $(CMD_TARGETS) $(kshark-dir)/build/Makefile $(Q)$(MAKE) $(S) -C $(kshark-dir)/build

kernel-shark/CMakeLists.txt +4 -0
index 8786b83..6652d08 100644
@@ -17,6 +17,10 @@ if (NOT _INSTALL_PREFIX)
       set(_INSTALL_PREFIX "/usr/local")
   endif (NOT _INSTALL_PREFIX)
+if (NOT _LIBDIR)
+    set(_LIBDIR "${_INSTALL_PREFIX}/lib")
+endif (NOT _LIBDIR)
+
   include(${KS_DIR}/build/FindTraceCmd.cmake)
   include(${KS_DIR}/build/FindJSONC.cmake)
Quoted 8 lines

kernel-shark/CMakeLists.txt if (Qt5Widgets_FOUND) · line 40

Quoted 6 lines
kernel-shark/CMakeLists.txt +2 -2
@@ -34,8 +38,8 @@ if (Qt5Widgets_FOUND)
   endif (Qt5Widgets_FOUND)
-set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/lib")
-set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin")
+set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/${_LIBDIR}")
+set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/${_INSTALL_PREFIX}/bin")

Not sure what is your idea here, but this looks wrong to me. When you are building from source (just typing "make") you don't expect the object files and the executables to be placed outside the trunk of the repository(${KS_DIR}). Do not confuse building the source with installing (when typing "make install").

In the beginning this was meant to make sure the debuginfo package is generated within corresponding lib64 directory. However I just compiled again and find it's not needed now.

Quoted 10 lines
Quoted 10 lines
kernel-shark/CMakeLists.txt +0 -0
   set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall -pthread -fPIC")

  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread

kernel-shark/CMakeLists.txt +1 -2
-fPIC")
@@ -54,14 +58,15 @@ if (NOT CMAKE_CXX_FLAGS_PACKAGE)
       set(CMAKE_CXX_FLAGS_PACKAGE "-O3")
   endif (NOT CMAKE_CXX_FLAGS_PACKAGE)
-set(KS_PLUGIN_INSTALL_PREFIX 
 ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/plugins/)
+set(KS_PLUGIN_INSTALL_PREFIX ${_LIBDIR}/${KS_APP_NAME}/plugins/)
Quoted 9 lines

kernel-shark/CMakeLists.txt if (NOT CMAKE_CXX_FLAGS_PACKAGE) · line 68

Quoted 6 lines
kernel-shark/CMakeLists.txt +1 -1
   set(KS_ICON        KS_icon_shark.svg)
   set(KS_ICON_FIN    KS_icon_fin.svg)
   set(KS_LOGO        KS_logo_symbol.svg)
   set(KS_LOGO_LABEL  KS_logo_horizontal.svg)
-set(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/")
+SET(CMAKE_INSTALL_RPATH "${_LIBDIR}/${KS_APP_NAME}/")

Please stick to lower-case characters with all CMake commands.

Quoted 3 lines

Ah sorry, this is definitely a typo when converting to capital letters in bulks.

Thanks for the review. As I don't know the background beforehand, if you think part of this patch still makes sense, I can make v2 and drop the bits you don't need yet.

Thanks for the clarification. Let's wait a bit to see if someone else is going to comment on this. Maybe you can add to the README file some explanation for the _LIBDIR Command-Line option, saying that it was added only to fulfill the Fedora packaging requirements.

cheers,
Yordan

Quoted 31 lines
Quoted 30 lines

Thanks!
Yordan

Quoted 26 lines
kernel-shark/CMakeLists.txt +0 -0
   if (CMAKE_BUILD_TYPE MATCHES Package)
kernel-shark/src/CMakeLists.txt +2 -2
index 33b5db8..9666b18 100644
@@ -15,7 +15,7 @@ target_link_libraries(kshark ${TRACEEVENT_LIBRARY}
   set_target_properties(kshark  PROPERTIES SUFFIX ".so.${KS_VERSION_STRING}")
-install(TARGETS kshark LIBRARY DESTINATION 
 ${_INSTALL_PREFIX}/lib/${KS_APP_NAME})
+install(TARGETS kshark LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME})
   if (OPENGL_FOUND AND GLUT_FOUND)
@@ -29,7 +29,7 @@ if (OPENGL_FOUND AND GLUT_FOUND)
       set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
-    install(TARGETS kshark-plot LIBRARY DESTINATION 
 ${_INSTALL_PREFIX}/lib/${KS_APP_NAME})
+    install(TARGETS kshark-plot LIBRARY DESTINATION 
 ${_LIBDIR}/${KS_APP_NAME})
   endif (OPENGL_FOUND AND GLUT_FOUND)
@@ -85,7 +85,7 @@ if (Qt5Widgets_FOUND AND Qt5Network_FOUND)

      install(TARGETS ${KS_APP_NAME} kshark-record kshark-gui RUNTIME DESTINATION ${_INSTALL_PREFIX}/bin/
-            LIBRARY DESTINATION ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/) +            LIBRARY DESTINATION ${_LIBDIR}/${KS_APP_NAME}/) install(FILES "${KS_DIR}/${KS_APP_NAME}.desktop" DESTINATION ${_INSTALL_PREFIX}/share/applications/)

#5 lore raw

Re: [PATCH 1/2] KernelShark: Inherit libdir from Makefile

Quoted 33 lines · Yordan Karadzhov (VMware)
Quoted 33 lines
Quoted 10 lines

kernel-shark/CMakeLists.txt if (Qt5Widgets_FOUND) · line 40

Quoted 8 lines

include(${KS_DIR}/build/FindTraceCmd.cmake)
  include(${KS_DIR}/build/FindJSONC.cmake)

kernel-shark/CMakeLists.txt +2 -2
@@ -34,8 +38,8 @@ if (Qt5Widgets_FOUND)
   endif (Qt5Widgets_FOUND)
-set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/lib")
-set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin")
+set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/${_LIBDIR}")
+set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/${_INSTALL_PREFIX}/bin")

Not sure what is your idea here, but this looks wrong to me. When you are building from source (just typing "make") you don't expect the object files and the executables to be placed outside the trunk of the repository(${KS_DIR}). Do not confuse building the source with installing (when typing "make install").

In the beginning this was meant to make sure the debuginfo package is generated within corresponding lib64 directory. However I just compiled again and find it's not needed now.

Quoted 19 lines
Quoted 6 lines
kernel-shark/CMakeLists.txt +0 -0
   set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall -pthread -fPIC")

  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread

kernel-shark/CMakeLists.txt +0 -1
-fPIC")
@@ -54,14 +58,15 @@ if (NOT CMAKE_CXX_FLAGS_PACKAGE)
       set(CMAKE_CXX_FLAGS_PACKAGE "-O3")

kernel-shark/CMakeLists.txt if (NOT CMAKE_CXX_FLAGS_PACKAGE) · line 66

Quoted 10 lines
kernel-shark/CMakeLists.txt +2 -2
   endif (NOT CMAKE_CXX_FLAGS_PACKAGE)
-set(KS_PLUGIN_INSTALL_PREFIX 
 ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/plugins/)
+set(KS_PLUGIN_INSTALL_PREFIX ${_LIBDIR}/${KS_APP_NAME}/plugins/)
   set(KS_ICON        KS_icon_shark.svg)
   set(KS_ICON_FIN    KS_icon_fin.svg)
   set(KS_LOGO        KS_logo_symbol.svg)
   set(KS_LOGO_LABEL  KS_logo_horizontal.svg)
-set(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/")
+SET(CMAKE_INSTALL_RPATH "${_LIBDIR}/${KS_APP_NAME}/")

Please stick to lower-case characters with all CMake commands.

Quoted 4 lines
Quoted 3 lines

Ah sorry, this is definitely a typo when converting to capital letters in bulks.

Thanks for the review. As I don't know the background beforehand, if you think part of this patch still makes sense, I can make v2 and drop the bits you don't need yet.

Hi Ziqian,

I had a conversation with Steven about the problem and he suggested another solution how to make sure that the users know the libraries are not ready to be used directly yet. Just send new version of the patch with the small changes I asked for. Do not change the README file. I will implement what Steven suggested on top of your patch.

Thanks!
Yordan

author
#6 lore raw

Re: [PATCH 1/2] KernelShark: Inherit libdir from Makefile

Quoted 36 lines · Yordan Karadzhov (VMware)
Quoted 33 lines · Yordan Karadzhov (VMware)
Quoted 33 lines
Quoted 10 lines

kernel-shark/CMakeLists.txt if (Qt5Widgets_FOUND) · line 40

Quoted 8 lines

include(${KS_DIR}/build/FindTraceCmd.cmake)
  include(${KS_DIR}/build/FindJSONC.cmake)

kernel-shark/CMakeLists.txt +2 -2
@@ -34,8 +38,8 @@ if (Qt5Widgets_FOUND)
   endif (Qt5Widgets_FOUND)
-set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/lib")
-set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin")
+set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/${_LIBDIR}")
+set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/${_INSTALL_PREFIX}/bin")

Not sure what is your idea here, but this looks wrong to me. When you are building from source (just typing "make") you don't expect the object files and the executables to be placed outside the trunk of the repository(${KS_DIR}). Do not confuse building the source with installing (when typing "make install").

In the beginning this was meant to make sure the debuginfo package is generated within corresponding lib64 directory. However I just compiled again and find it's not needed now.

Quoted 19 lines
Quoted 6 lines
kernel-shark/CMakeLists.txt +0 -0
   set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall -pthread -fPIC")

  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread

kernel-shark/CMakeLists.txt +0 -1
-fPIC")
@@ -54,14 +58,15 @@ if (NOT CMAKE_CXX_FLAGS_PACKAGE)
       set(CMAKE_CXX_FLAGS_PACKAGE "-O3")

kernel-shark/CMakeLists.txt if (NOT CMAKE_CXX_FLAGS_PACKAGE) · line 66

Quoted 10 lines
kernel-shark/CMakeLists.txt +2 -2
   endif (NOT CMAKE_CXX_FLAGS_PACKAGE)
-set(KS_PLUGIN_INSTALL_PREFIX 
 ${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/plugins/)
+set(KS_PLUGIN_INSTALL_PREFIX ${_LIBDIR}/${KS_APP_NAME}/plugins/)
   set(KS_ICON        KS_icon_shark.svg)
   set(KS_ICON_FIN    KS_icon_fin.svg)
   set(KS_LOGO        KS_logo_symbol.svg)
   set(KS_LOGO_LABEL  KS_logo_horizontal.svg)
-set(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/")
+SET(CMAKE_INSTALL_RPATH "${_LIBDIR}/${KS_APP_NAME}/")

Please stick to lower-case characters with all CMake commands.

Quoted 9 lines
Quoted 4 lines
Quoted 3 lines

Ah sorry, this is definitely a typo when converting to capital letters in bulks.

Thanks for the review. As I don't know the background beforehand, if you think part of this patch still makes sense, I can make v2 and drop the bits you don't need yet.

Hi Ziqian,

I had a conversation with Steven about the problem and he suggested another solution how to make sure that the users know the libraries are not ready to be used directly yet. Just send new version of the patch with the small changes I asked for. Do not change the README file. I will implement what Steven suggested on top of your patch.

Hi Yordan,

Sure, I'll re-send with above fixed no later than this weekend.

Thanks for the heads-up.

Quoted 2 lines

Thanks!
Yordan

Signature · 3 lines
Zamir SUN
Fedora user
GPG : 1D86 6D4A 49CE 4BBD 72CF FCF5 D856 6E11 F2A0 525E
#7 lore raw

PATCH 2/2 trace-cmd: Clean up old gtk stuff

In reply to [email protected]

From: "Ziqian SUN (Zamir)" <[email protected]>

With ab37762ba9ad06a4f3902ad53ac2e9104bfd651f the gtk stuff was removed from kernel-shark. This patch removes the python-gui which depends on the trace-view from the gtk stuff.

---
 Makefile              |  6 ---
 python/Makefile       | 14 +------
 python/ctracecmdgui.i | 88 -------------------------------------------
 3 files changed, 2 insertions(+), 106 deletions(-)
 delete mode 100644 python/ctracecmdgui.i
Makefile +0 -6
index 1aca807..75bf1ef 100644
@@ -126,7 +126,6 @@ endif
 
 ifndef NO_PYTHON
 PYTHON		:= ctracecmd.so
-PYTHON_GUI	:= ctracecmd.so ctracecmdgui.so
 
 PYTHON_VERS ?= python
 PYTHON_PKGCONFIG_VERS ?= $(PYTHON_VERS)
@@ -473,14 +472,9 @@ export PYGTK_CFLAGS
 ctracecmd.so: force $(LIBTRACECMD_STATIC)
 	$(Q)$(MAKE) -C $(src)/python $@
 
-ctracecmdgui.so: force $(LIBTRACECMD_STATIC) trace-view
-	$(Q)$(MAKE) -C $(src)/python $@
-
 PHONY += python
 python: $(PYTHON)
 
-PHONY += python-gui
-python-gui: $(PYTHON_GUI)
 
 dist:
 	git archive --format=tar --prefix=trace-cmd-$(TRACECMD_VERSION)/ HEAD \
python/Makefile +2 -12
index 85224af..deaa83e 100644
@@ -1,13 +1,9 @@
 include $(src)/scripts/utils.mk
 
-TRACE_VIEW_OBJS =
-TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view.o
-TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view-store.o
-
 ifdef BUILD_PYTHON_WORKS
 PYTHON_SO_INSTALL := ctracecmd.install
 PYTHON_PY_PROGS := event-viewer.install
-PYTHON_PY_LIBS := tracecmd.install tracecmdgui.install
+PYTHON_PY_LIBS := tracecmd.install
 endif
 
 ctracecmd.so: ctracecmd.i $(LIBTRACECMD_STATIC)
@@ -15,12 +11,6 @@ ctracecmd.so: ctracecmd.i $(LIBTRACECMD_STATIC)
 	$(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES)  ctracecmd_wrap.c
 	$(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so $(TRACE_LIBS)
 
-ctracecmdgui.so: ctracecmdgui.i $(LIBTRACECMD_STATIC) $(TRACE_VIEW_OBJS)
-	swig -Wall -python -noproxy -I$(src)/kernel-shark/include ctracecmdgui.i
-	$(CC) -fpic -c  $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c
-	$(CC) --shared $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so $(TRACE_LIBS)
-
-
 $(PYTHON_SO_INSTALL): %.install : %.so force
 	$(Q)$(call do_install_data,$<,$(python_dir_SQ))
 
@@ -34,7 +24,7 @@ install_python: $(PYTHON_SO_INSTALL) $(PYTHON_PY_PROGS) $(PYTHON_PY_LIBS)
 
 
 clean:
-	$(RM) *.a *.so *.o .*.d ctracecmd_wrap.* ctracecmdgui_wrap.*
+	$(RM) *.a *.so *.o .*.d ctracecmd_wrap.*
 
 force:
 .PHONY: clean force
python/ctracecmdgui.i deleted +0 -88

88 lines not on this page · raw message

Signature · 1 line
2.24.1
#8 lore raw
In reply to [email protected]

Hi Zamir!

Thanks for the patches.

Quoted 4 lines · On Sun, 9 Feb 2020 11:42:24 +0800 [email protected] wrote:

This contains two fixes of compiling.

The KernelShark one is to inherit libdir into kernelshark CMakeLists so that the libdir parsed to Makefile is honored in kernelshark.

Yodan, can you review this one?

Quoted 8 lines

The trace-cmd one is to remove python-gui which depends on the obsoleted gtk stuff.

In order to compile and test this change, the following patch from Tzvetomir need to be applied.
[PATCH] kernel-shark: Fix search path for libtracefs
https://lore.kernel.org/linux-trace-devel/[email protected]/T/#u

I will start applying these.

Quoted 5 lines

Note: I always send email and git commits with signature "Zamir SUN" before. However I see DCO requires to sign using real name, so I changed to fulfill the DCO.

Yes, thank you for doing so.

-- Steve