diff mbox series

[4/5] trace-cmd: Have libtracecmd.so include libtraceevent

Message ID 20200122171329.476181697@goodmis.org (mailing list archive)
State Superseded
Headers show
Series trace-cmd: A few updates | expand

Commit Message

Steven Rostedt Jan. 22, 2020, 5:12 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Was getting errors with loading libtracecmd.so with undefined symbols
from libtraceevent. Add it to the build process to include what it uses
as well.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile               |  2 +-
 lib/trace-cmd/Makefile |  2 ++
 scripts/utils.mk       | 12 +++++++-----
 3 files changed, 10 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index c22aa7847b51..9c74268eddd5 100644
--- a/Makefile
+++ b/Makefile
@@ -301,7 +301,7 @@  $(LIBTRACEEVENT_STATIC): force $(obj)/lib/traceevent/plugins/trace_python_dir \
 $(LIBTRACECMD_STATIC): force
 	$(Q)$(MAKE) -C $(src)/lib/trace-cmd $@
 
-$(LIBTRACECMD_SHARED): force
+$(LIBTRACECMD_SHARED): force $(LIBTRACEEVENT_SHARED)
 	$(Q)$(MAKE) -C $(src)/lib/trace-cmd $@
 
 libtraceevent.so: $(LIBTRACEEVENT_SHARED)
diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index 6f3e6b1bf935..29c36ca195d0 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -35,6 +35,8 @@  $(DEPS): | $(bdir)
 $(bdir)/libtracecmd.a: $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
+LIBS = -L$(obj)/lib/traceevent -ltraceevent
+
 $(bdir)/libtracecmd.so: $(OBJS)
 	$(Q)$(call do_compile_shared_library)
 
diff --git a/scripts/utils.mk b/scripts/utils.mk
index 4da8829159a0..28dcd7b44061 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -61,7 +61,7 @@  do_build_static_lib =				\
 
 do_compile_shared_library =			\
 	($(print_shared_lib_compile)		\
-	$(CC) --shared $^ -Wl,-soname,$(@F) -o $@)
+	$(CC) --shared $^ $(LIBS) -Wl,-soname,$(@F) -o $@)
 
 do_compile_plugin_obj =				\
 	($(print_plugin_obj_compile)		\
@@ -135,9 +135,11 @@  define do_install_data
 endef
 
 define do_install_ld
-	$(print_install)				\
-	if [ -d '$(DESTDIR_SQ)$2' ]; then		\
-		echo '$3' >> $(DESTDIR_SQ)$2/$1;	\
-		ldconfig;				\
+	$(print_install)						\
+	if [ -d '$(DESTDIR_SQ)$2' ]; then				\
+		if ! grep -q $3 $(DESTDIR_SQ)$2/$1 2>/dev/null; then	\
+			echo '$3' >> $(DESTDIR_SQ)$2/$1;		\
+			ldconfig;					\
+		fi							\
 	fi
 endef