[1/4] kernel-shark: Use correct order when linking all depenancies
diff mbox series

Message ID 20190920104831.23475-2-y.karadz@gmail.com
State Accepted
Headers show
  • Fixes needed for KS 1.1
Related show

Commit Message

Yordan Karadzhov (VMware) Sept. 20, 2019, 10:48 a.m. UTC
I wasn't aware of the importance of the order in which the libraries are
passed to the linker, so in the dependency list in src/CMakeLists.txt
I naively started with the most basic libraries first. This is WRONG.
The linker searches and resolves symbols in the order that they appear.
If library A contains a call to a function from library B, we have to
put A before B, otherwise the linker won't know that something in B
needs to be resolved.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
 kernel-shark/src/CMakeLists.txt | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff mbox series

diff --git a/kernel-shark/src/CMakeLists.txt b/kernel-shark/src/CMakeLists.txt
index 21494cc..e20a030 100644
--- a/kernel-shark/src/CMakeLists.txt
+++ b/kernel-shark/src/CMakeLists.txt
@@ -7,10 +7,10 @@  add_library(kshark SHARED libkshark.c
-target_link_libraries(kshark ${CMAKE_DL_LIBS}
+target_link_libraries(kshark ${TRACEEVENT_LIBRARY}
+                             ${TRACECMD_LIBRARY}
-                             ${TRACEEVENT_LIBRARY}
-                             ${TRACECMD_LIBRARY})
+                             ${CMAKE_DL_LIBS})
 set_target_properties(kshark  PROPERTIES SUFFIX	".so.${KS_VERSION_STRING}")
@@ -23,8 +23,8 @@  if (OPENGL_FOUND AND GLUT_FOUND)
     target_link_libraries(kshark-plot  kshark
-                                       ${OPENGL_LIBRARIES}
-                                       ${GLUT_LIBRARY})
+                                       ${GLUT_LIBRARY}
+                                       ${OPENGL_LIBRARIES})
     set_target_properties(kshark-plot PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
@@ -65,11 +65,11 @@  if (Qt5Widgets_FOUND AND Qt5Network_FOUND)
     target_link_libraries(kshark-gui kshark-plot
-                                     ${CMAKE_DL_LIBS}
+                                     Qt5::Widgets
+                                     Qt5::Network
-                                     Qt5::Widgets
-                                     Qt5::Network)
+                                     ${CMAKE_DL_LIBS})
     set_target_properties(kshark-gui PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")