summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel
diff options
context:
space:
mode:
authorBin Lan <bin.lan.cn@windriver.com>2024-11-09 16:09:45 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-11-12 23:54:35 +0000
commitab6062fb3f4d3335fab03e51770fca71e9ef4d5d (patch)
tree9877dc39ce34b9c19c842cbf117b63a690425483 /meta/recipes-kernel
parentb82bb08f15587a376b2b4da5ff553b630e87283d (diff)
downloadpoky-ab6062fb3f4d3335fab03e51770fca71e9ef4d5d.tar.gz
lttng-ust: backport patch to fix cmake-multiple-shared-libraries build error
There are the following error when building doc/examples/cmake-multiple-shared-libraries: ld: warning: liblttng-ust-common.so.1, needed by lttng-ust/2.13.8/build/src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link) ld: warning: liblttng-ust-tracepoint.so.1, needed by lttng-ust/2.13.8/build/src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link) ld: warning: liblttng-ust-common.so.1, needed by lttng-ust/2.13.8/build/src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link) ld: warning: liblttng-ust-tracepoint.so.1, needed by lttng-ust/2.13.8/build/src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link) ld: lttng-ust/2.13.8/build/src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_common_alloc_tls' ld: lttng-ust/2.13.8/build/src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_after_fork_parent' ld: lttng-ust/2.13.8/build/src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_after_fork_child' ld: lttng-ust/2.13.8/build/src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_urcu_after_fork_parent' ld: lttng-ust/2.13.8/build/src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_tp_probe_unregister_queue_release' ld: lttng-ust/2.13.8/build/src/lib/lttng-ust/.libs/liblttng-ust.so: undefined reference to `lttng_ust_cancelstate_disable_pop' collect2: error: ld returned 1 exit status This change set removes the old patch file 0001-Makefile.am-update-rpath-link.patch, adds a new patch file 0001-Fix-Build-examples-when-rpath-is-stripped-from-in-bu.patch. (From OE-Core rev: 89394da1cbe98652e1d0bd59c762ff7da2d6a113) Signed-off-by: Bin Lan <bin.lan.cn@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r--meta/recipes-kernel/lttng/lttng-ust/0001-Fix-Build-examples-when-rpath-is-stripped-from-in-bu.patch161
-rw-r--r--meta/recipes-kernel/lttng/lttng-ust/0001-Makefile.am-update-rpath-link.patch33
-rw-r--r--meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb2
3 files changed, 162 insertions, 34 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
new file mode 100644
index 0000000000..6da675fa31
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-ust/0001-Fix-Build-examples-when-rpath-is-stripped-from-in-bu.patch
@@ -0,0 +1,161 @@
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
diff --git a/meta/recipes-kernel/lttng/lttng-ust/0001-Makefile.am-update-rpath-link.patch b/meta/recipes-kernel/lttng/lttng-ust/0001-Makefile.am-update-rpath-link.patch
deleted file mode 100644
index 6aca8f85fa..0000000000
--- a/meta/recipes-kernel/lttng/lttng-ust/0001-Makefile.am-update-rpath-link.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 7d053804ab3823d40ae10d90f4efc49dbfb4cb66 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Wed, 22 Sep 2021 16:33:10 +0800
4Subject: [PATCH] Makefile.am: update rpath link
5
6since commit 6339062 Move liblttng-ust to 'src/lib/',
7liblttng-ust.so/liblttng-ust-common.so/liblttng-ust-tracepoint.so
8's location changed from one dir to multiple dirs. which make below
9error:
10ld: warning: liblttng-ust-common.so.1, needed by ../../../src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link)
11ld: warning: liblttng-ust-tracepoint.so.1, needed by ../../../src/lib/lttng-ust/.libs/liblttng-ust.so, not found (try using -rpath or -rpath-link)
12
13Upstream-Status: Submitted [https://github.com/lttng/lttng-ust/pull/61]
14
15Signed-off-by: Changqing Li <changqing.li@windriver.com>
16
17---
18 doc/examples/Makefile.am | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
22index 57782cc..d46caa6 100644
23--- a/doc/examples/Makefile.am
24+++ b/doc/examples/Makefile.am
25@@ -167,7 +167,7 @@ all-local:
26 CFLAGS='$(CFLAGS)' \
27 AM_CFLAGS='$(AM_CFLAGS)' \
28 LDFLAGS="$(LDFLAGS)" \
29- 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/"' \
30+ 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/:$(PWD)/../../src/lib/lttng-ust-tracepoint/.libs:$(PWD)/../../src/lib/lttng-ust-common/.libs/"' \
31 LTTNG_GEN_TP_PATH="$$rel_src_subdir$(top_srcdir)/tools/" \
32 AM_V_P="$(AM_V_P)" \
33 AM_V_at="$(AM_V_at)" \
diff --git a/meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb b/meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb
index dddd3a5004..bf2524bdc0 100644
--- a/meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb
+++ b/meta/recipes-kernel/lttng/lttng-ust_2.13.8.bb
@@ -31,7 +31,7 @@ PE = "2"
31SRC_URI = "https://lttng.org/files/lttng-ust/lttng-ust-${PV}.tar.bz2 \ 31SRC_URI = "https://lttng.org/files/lttng-ust/lttng-ust-${PV}.tar.bz2 \
32 file://0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch \ 32 file://0001-python-lttngust-Makefile.am-Add-install-lib-to-setup.patch \
33 file://0001-lttng-ust-common-link-with-liburcu-explicitly.patch \ 33 file://0001-lttng-ust-common-link-with-liburcu-explicitly.patch \
34 file://0001-Makefile.am-update-rpath-link.patch \ 34 file://0001-Fix-Build-examples-when-rpath-is-stripped-from-in-bu.patch \
35 " 35 "
36 36
37SRC_URI[sha256sum] = "d4ef98dab9a37ad4f524ccafdfd50af4f266039b528dd5afabce78e49024d937" 37SRC_URI[sha256sum] = "d4ef98dab9a37ad4f524ccafdfd50af4f266039b528dd5afabce78e49024d937"