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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 kernel-shark/src/CMakeLists.txt | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

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
                           libkshark-configio.c
                           libkshark-collection.c)
 
-target_link_libraries(kshark ${CMAKE_DL_LIBS}
+target_link_libraries(kshark ${TRACEEVENT_LIBRARY}
+                             ${TRACECMD_LIBRARY}
                              ${JSONC_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)
                                      KsPlotTools.cpp)
 
     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)
                                                             KsAdvFilteringDialog.cpp)
 
     target_link_libraries(kshark-gui kshark-plot
-                                     ${CMAKE_DL_LIBS}
+                                     Qt5::Widgets
+                                     Qt5::Network
                                      ${TRACEEVENT_LIBRARY}
                                      ${TRACECMD_LIBRARY}
-                                     Qt5::Widgets
-                                     Qt5::Network)
+                                     ${CMAKE_DL_LIBS})
 
     set_target_properties(kshark-gui PROPERTIES  SUFFIX ".so.${KS_VERSION_STRING}")
 
-- 
2.20.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux