diff options
Diffstat (limited to 'meta/recipes-kernel')
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 @@ | |||
| 1 | From 5d10459b6b5182fcbc98240d9dace026c87a5037 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Kienan Stewart <kstewart@efficios.com> | ||
| 3 | Date: Mon, 5 Aug 2024 15:41:34 -0400 | ||
| 4 | Subject: [PATCH] Fix: Build examples when rpath is stripped from in-build-tree | ||
| 5 | libs | ||
| 6 | |||
| 7 | Observed issue | ||
| 8 | ============== | ||
| 9 | |||
| 10 | Certain tool chains[1, 2] emit warnings or errors when building the | ||
| 11 | example applications. | ||
| 12 | |||
| 13 | ``` | ||
| 14 | make[3]: Entering directory | ||
| 15 | '/home/xxx/src/efficios/lttng/master/src/lttng-ust/doc/examples/easy-ust' | ||
| 16 | CC sample.o | ||
| 17 | CC tp.o | ||
| 18 | CCLD 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' | ||
| 46 | collect2: error: ld returned 1 exit status | ||
| 47 | ``` | ||
| 48 | |||
| 49 | === Reproducer === | ||
| 50 | |||
| 51 | The easiest way to consistently reproduce this type of build failure | ||
| 52 | is to perform the following steps: | ||
| 53 | |||
| 54 | ``` | ||
| 55 | ./configure | ||
| 56 | make -j$(nproc) | ||
| 57 | find . -iname '*.so' -exec chrpath -d {} \; | ||
| 58 | make -C doc/examples clean | ||
| 59 | make -j$(nproc) | ||
| 60 | ``` | ||
| 61 | |||
| 62 | As the examples are not built with libtool, finding the libraries to | ||
| 63 | link against depends on the shared objects having an rpath. | ||
| 64 | |||
| 65 | E.g. | ||
| 66 | |||
| 67 | ``` | ||
| 68 | $ chrpath src/lib/lttng-ust/.libs/liblttng-ust.so.1.0.0 | ||
| 69 | src/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 | |||
| 72 | The current examples build with `-Wl,-rpath` for `liblttng-ust`, but | ||
| 73 | not the dependencies of `liblttng-ust` (which would normally be found | ||
| 74 | via it's own rpath). If the `rpath` is stripped from | ||
| 75 | `liblttng-ust.so`, or if the tool chain ignores `rpath` explicitly, | ||
| 76 | then the build with fail. | ||
| 77 | |||
| 78 | In the case of a yocto build environment as in GitHub#61[1], the | ||
| 79 | following commands reproduced the warnings and the errors seen in the | ||
| 80 | above test case. | ||
| 81 | |||
| 82 | ``` | ||
| 83 | git clone git://git.yoctoproject.org/poky && cd poky/ | ||
| 84 | . oe-init-build-env | ||
| 85 | echo "PACKAGECONFIG:pn-lttng-ust = 'examples'" >>conf/local.conf | ||
| 86 | bitbake lttng-ust | ||
| 87 | ``` | ||
| 88 | |||
| 89 | === Solution === | ||
| 90 | |||
| 91 | Explicitly add library search paths and set linker rpath-link are set | ||
| 92 | for both the standard and cmake examples. Similar changes were | ||
| 93 | proposed for each of those parts respectively in GitHub#61[1] and GitHub#63[2]. | ||
| 94 | |||
| 95 | === Known issues === | ||
| 96 | |||
| 97 | While the `rpath-link` for the second order library dependencies will | ||
| 98 | allow the builds to complete, the examples will not work at | ||
| 99 | runtime even when using `rpath`. From `man ld.so`, the rpaths in an | ||
| 100 | executable or shared object are only considered for direct | ||
| 101 | dependencies. Therefore, without setting `LD_LIBRARY_PATH` or | ||
| 102 | installing 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 | |||
| 109 | References | ||
| 110 | ========== | ||
| 111 | |||
| 112 | [1]: https://github.com/lttng/lttng-ust/pull/61 | ||
| 113 | [2]: https://github.com/lttng/lttng-ust/pull/63 | ||
| 114 | |||
| 115 | Change-Id: I273ccddd0d0b7a1b57b9e09ddf48d8b5b41e6f8e | ||
| 116 | Signed-off-by: Kienan Stewart <kstewart@efficios.com> | ||
| 117 | Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | ||
| 118 | |||
| 119 | Upstream-Status: Backport [https://github.com/lttng/lttng-ust/commit/5d10459b6b5182fcbc98240d9dace026c87a5037] | ||
| 120 | Signed-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 | |||
| 126 | diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am | ||
| 127 | index 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 | -- | ||
| 160 | 2.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 @@ | |||
| 1 | From 7d053804ab3823d40ae10d90f4efc49dbfb4cb66 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Changqing Li <changqing.li@windriver.com> | ||
| 3 | Date: Wed, 22 Sep 2021 16:33:10 +0800 | ||
| 4 | Subject: [PATCH] Makefile.am: update rpath link | ||
| 5 | |||
| 6 | since commit 6339062 Move liblttng-ust to 'src/lib/', | ||
| 7 | liblttng-ust.so/liblttng-ust-common.so/liblttng-ust-tracepoint.so | ||
| 8 | 's location changed from one dir to multiple dirs. which make below | ||
| 9 | error: | ||
| 10 | 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) | ||
| 11 | 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) | ||
| 12 | |||
| 13 | Upstream-Status: Submitted [https://github.com/lttng/lttng-ust/pull/61] | ||
| 14 | |||
| 15 | Signed-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 | |||
| 21 | diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am | ||
| 22 | index 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" | |||
| 31 | SRC_URI = "https://lttng.org/files/lttng-ust/lttng-ust-${PV}.tar.bz2 \ | 31 | SRC_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 | ||
| 37 | SRC_URI[sha256sum] = "d4ef98dab9a37ad4f524ccafdfd50af4f266039b528dd5afabce78e49024d937" | 37 | SRC_URI[sha256sum] = "d4ef98dab9a37ad4f524ccafdfd50af4f266039b528dd5afabce78e49024d937" |
