summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/lttng-ust/0001-Fix-Build-examples-when-rpath-is-stripped-from-in-bu.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-ust/0001-Fix-Build-examples-when-rpath-is-stripped-from-in-bu.patch')
-rw-r--r--meta/recipes-kernel/lttng/lttng-ust/0001-Fix-Build-examples-when-rpath-is-stripped-from-in-bu.patch161
1 files changed, 0 insertions, 161 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-ust/0001-Fix-Build-examples-when-rpath-is-stripped-from-in-bu.patch b/meta/recipes-kernel/lttng/lttng-ust/0001-Fix-Build-examples-when-rpath-is-stripped-from-in-bu.patch
deleted file mode 100644
index 6da675fa31..0000000000
--- a/meta/recipes-kernel/lttng/lttng-ust/0001-Fix-Build-examples-when-rpath-is-stripped-from-in-bu.patch
+++ /dev/null
@@ -1,161 +0,0 @@
1From 5d10459b6b5182fcbc98240d9dace026c87a5037 Mon Sep 17 00:00:00 2001
2From: Kienan Stewart <kstewart@efficios.com>
3Date: Mon, 5 Aug 2024 15:41:34 -0400
4Subject: [PATCH] Fix: Build examples when rpath is stripped from in-build-tree
5 libs
6
7Observed issue
8==============
9
10Certain tool chains[1, 2] emit warnings or errors when building the
11example applications.
12
13```
14make[3]: Entering directory
15'/home/xxx/src/efficios/lttng/master/src/lttng-ust/doc/examples/easy-ust'
16CC sample.o
17CC tp.o
18CCLD sample
19
20/usr/bin/ld: warning: liblttng-ust-common.so.1, needed by ../../../src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link)
21/usr/bin/ld: warning: liblttng-ust-tracepoint.so.1, needed by ../../../src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link)
22/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_add_fd_to_tracker'
23/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_after_fork_child'
24/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_common_ctor'
25/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_tp_init'
26/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_tp_probe_register_queue_release'
27/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_cancelstate_disable_pop'
28/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_synchronize_rcu'
29/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_register_thread'
30/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_tp_probe_prune_release_queue'
31/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_cancelstate_disable_push'
32/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_before_fork'
33/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_lock_fd_tracker'
34/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_trace_clock'
35/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_has_sys_membarrier'
36/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_unlock_fd_tracker'
37/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_tp_exit'
38/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_get_cpu_sym'
39/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_common_alloc_tls'
40/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_after_fork_parent'
41/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_delete_fd_from_tracker'
42/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_register'
43/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_reader'
44/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_gp'
45/usr/bin/ld: ../../../src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_tp_probe_unregister_queue_release'
46collect2: error: ld returned 1 exit status
47```
48
49=== Reproducer ===
50
51The easiest way to consistently reproduce this type of build failure
52is to perform the following steps:
53
54```
55./configure
56make -j$(nproc)
57find . -iname '*.so' -exec chrpath -d {} \;
58make -C doc/examples clean
59make -j$(nproc)
60```
61
62As the examples are not built with libtool, finding the libraries to
63link against depends on the shared objects having an rpath.
64
65E.g.
66
67```
68$ chrpath src/lib/lttng-ust/.libs/liblttng-ust.so.1.0.0
69src/lib/lttng-ust/.libs/liblttng-ust.so.1.0.0: RUNPATH=/home/xxx/src/efficios/lttng/master/src/lttng-ust/src/lib/lttng-ust-common/.libs:/home/xxx/src/efficios/lttng/master/src/lttng-ust/src/lib/lttng-ust-tracepoint/.libs:/home/xxx/src/efficios/lttng/master/usr/lib
70```
71
72The current examples build with `-Wl,-rpath` for `liblttng-ust`, but
73not the dependencies of `liblttng-ust` (which would normally be found
74via it's own rpath). If the `rpath` is stripped from
75`liblttng-ust.so`, or if the tool chain ignores `rpath` explicitly,
76then the build with fail.
77
78In the case of a yocto build environment as in GitHub#61[1], the
79following commands reproduced the warnings and the errors seen in the
80above test case.
81
82```
83git clone git://git.yoctoproject.org/poky && cd poky/
84. oe-init-build-env
85echo "PACKAGECONFIG:pn-lttng-ust = 'examples'" >>conf/local.conf
86bitbake lttng-ust
87```
88
89=== Solution ===
90
91Explicitly add library search paths and set linker rpath-link are set
92for both the standard and cmake examples. Similar changes were
93proposed for each of those parts respectively in GitHub#61[1] and GitHub#63[2].
94
95=== Known issues ===
96
97While the `rpath-link` for the second order library dependencies will
98allow the builds to complete, the examples will not work at
99runtime even when using `rpath`. From `man ld.so`, the rpaths in an
100executable or shared object are only considered for direct
101dependencies. Therefore, without setting `LD_LIBRARY_PATH` or
102installing the libraries test applications will fail as follows:
103
104```
105$ ./doc/examples/easy-ust/sample
106./doc/examples/easy-ust/sample: error while loading shared libraries: liblttng-ust-common.so.1: cannot open shared object file: No such file or directory
107```
108
109References
110==========
111
112[1]: https://github.com/lttng/lttng-ust/pull/61
113[2]: https://github.com/lttng/lttng-ust/pull/63
114
115Change-Id: I273ccddd0d0b7a1b57b9e09ddf48d8b5b41e6f8e
116Signed-off-by: Kienan Stewart <kstewart@efficios.com>
117Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
118
119Upstream-Status: Backport [https://github.com/lttng/lttng-ust/commit/5d10459b6b5182fcbc98240d9dace026c87a5037]
120Signed-off-by: Bin Lan <bin.lan.cn@windriver.com>
121
122---
123 doc/examples/Makefile.am | 13 ++++++++++---
124 1 file changed, 10 insertions(+), 3 deletions(-)
125
126diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
127index aebf63bd..79766ec0 100644
128--- a/doc/examples/Makefile.am
129+++ b/doc/examples/Makefile.am
130@@ -169,7 +169,10 @@ all-local:
131 CFLAGS='$(CFLAGS)' \
132 AM_CFLAGS='$(AM_CFLAGS)' \
133 LDFLAGS="$(LDFLAGS)" \
134- AM_LDFLAGS='$(AM_LDFLAGS) -L../../../src/lib/lttng-ust/.libs -Wl,-rpath="$(PWD)/../../src/lib/lttng-ust/.libs/" -Wl,-rpath-link="$(PWD)/../../src/lib/lttng-ust/.libs/"' \
135+ AM_LDFLAGS='$(AM_LDFLAGS) -L../../../src/lib/lttng-ust/.libs -L../../../src/lib/lttng-ust-common/.libs -L../../../src/lib/lttng-ust-tracepoint/.libs \
136+ -Wl,-rpath="$(abs_top_builddir)/src/lib/lttng-ust/.libs/" \
137+ -Wl,-rpath-link="$(abs_top_builddir)/src/lib/lttng-ust-common/.libs/" \
138+ -Wl,-rpath-link="$(abs_top_builddir)/src/lib/lttng-ust-tracepoint/.libs/"' \
139 LTTNG_GEN_TP_PATH="$$rel_src_subdir$(top_srcdir)/tools/" \
140 AM_V_P="$(AM_V_P)" \
141 AM_V_at="$(AM_V_at)" \
142@@ -222,10 +225,14 @@ all-local:
143 CXX="$(CXX)" \
144 $(CMAKE) \
145 -DCMAKE_INCLUDE_PATH="$(abs_top_srcdir)/include;$(abs_top_builddir)/include" \
146- -DCMAKE_LIBRARY_PATH="$(abs_top_builddir)/src/lib/lttng-ust/.libs" \
147+ -DCMAKE_LIBRARY_PATH="$(abs_top_builddir)/src/lib/lttng-ust/.libs;$(abs_top_builddir)/src/lib/lttng-ust-common/.libs;$(abs_top_builddir)/src/lib/lttng-ust-tracepoint/.libs" \
148 -DCMAKE_C_FLAGS="$(AM_CFLAGS) $(CPPFLAGS) $(CFLAGS)" \
149 -DCMAKE_CXX_FLAGS="$(AM_CXXFLAGS) $(CXXFLAGS) $(CPPFLAGS)" \
150- -DCMAKE_EXE_LINKER_FLAGS="$(AM_LDFLAGS) $(LDFLAGS)" \
151+ -DCMAKE_EXE_LINKER_FLAGS="$(AM_LDFLAGS) $(LDFLAGS) \
152+ -L../../../src/lib/lttng-ust/.libs -L../../../src/lib/lttng-ust-common/.libs -L../../../src/lib/lttng-ust-tracepoint/.libs \
153+ -Wl,-rpath=$(abs_top_builddir)/src/lib/lttng-ust/.libs/ \
154+ -Wl,-rpath-link=$(abs_top_builddir)/src/lib/lttng-ust-common/.libs/ \
155+ -Wl,-rpath-link=$(abs_top_builddir)/src/lib/lttng-ust-tracepoint/.libs/" \
156 .. && \
157 $(MAKE) \
158 ) || exit 1; \
159--
1602.43.0
161