Skip to contentSkip to conversation

trace-cmd: Add -rpath to trace-cmd and libtracecmd.so

PATCH New Steven Rostedt 1 participant 3 messages Dec 16, 2020

lore
Share & tools
lore
#0 lore raw

cover trace-cmd: Add -rpath to trace-cmd and libtracecmd.so

Steven Rostedt (VMware) (2):
libtracecmd: Add -rpath to libtracecmd.so
trace-cmd: Add -rpath=$(libdir) for trace-cmd to find libtracecmd.so

----

 scripts/utils.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#1 lore raw

PATCH 1/2 libtracecmd: Add -rpath to libtracecmd.so

From: "Steven Rostedt (VMware)" <[email protected]>

Pass in "-rpath=$ORIGIN" to the linker when building libtracecmd.so, such that the path for libtraceevent.so and libtracefs.so might be found if it is installed in the same location as libtracecmd.

---
 scripts/utils.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/utils.mk +1 -1
index c06888795ddf..8ac38cc983b1 100644
@@ -64,7 +64,7 @@ do_build_static_lib =				\
 
 do_compile_shared_library =			\
 	($(print_shared_lib_compile)		\
-	$(CC) --shared $^ $(LIBS) -Wl,-soname,$(@F) -o $@)
+	$(CC) --shared $^ '-Wl,-soname,$(@F),-rpath=$$ORIGIN' -o $@ $(LIBS))
 
 do_compile_plugin_obj =				\
 	($(print_plugin_obj_compile)		\
Signature · 1 line
2.29.2
#2 lore raw

PATCH 2/2 trace-cmd: Add -rpath=$(libdir) for trace-cmd to find libtracecmd.so

In reply to Steven Rostedt

From: "Steven Rostedt (VMware)" <[email protected]>

Add a search path into the trace-cmd executable to find where libtracecmd.so exists, when it is executed.

---
 scripts/utils.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/utils.mk +1 -1
index 8ac38cc983b1..03389126a11c 100644
@@ -56,7 +56,7 @@ do_compile =							\
 
 do_app_build =						\
 	($(print_app_build)				\
-	$(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS))
+	$(CC) $^ -rdynamic -Wl,-rpath=$(libdir) -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS))
 
 do_build_static_lib =				\
 	($(print_static_lib_build)		\
Signature · 1 line
2.29.2