lttng-tools: Fix build with libcxx runtime

(From OE-Core rev: d66afee0a040e4417db774425297ca43497f5386)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2025-08-20 23:45:20 -07:00
committed by Richard Purdie
parent fd0ba87ae0
commit 542af25cfa
2 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
sessiond: avoid std::vector range-ctor on non-standard iterators (libc++)
libc++ SFINAE-gates std::vector(It, It) behind standard iterator requirements.
The events_view/channels_ht_view iterators dont model Input/Forward, so the
range constructor is not viable and the build fails under clang+libc++.
Populate the vectors via a simple loop instead, which only relies on !=, ++,
and dereference. No functional change; fixes clang/libc++ builds while keeping
libstdc++ behavior unchanged.
Upstream-Status: Submitted [https://review.lttng.org/c/lttng-tools/+/15163]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Index: lttng-tools-2.14.0/src/bin/lttng-sessiond/ust-registry-channel.cpp
===================================================================
--- lttng-tools-2.14.0.orig/src/bin/lttng-sessiond/ust-registry-channel.cpp
+++ lttng-tools-2.14.0/src/bin/lttng-sessiond/ust-registry-channel.cpp
@@ -529,8 +529,11 @@ void lsu::registry_channel::_accept_on_e
events_view(*_events->ht);
/* Copy the event ptrs from the _events ht to this vector which we'll sort. */
- std::vector<const lttng::sessiond::ust::registry_event *> sorted_event_classes(
- events_view.begin(), events_view.end());
+ std::vector<const lttng::sessiond::ust::registry_event *> sorted_event_classes;
+ /* Avoid libc++s range-ctor SFINAE on non-standard iterators. */
+ for (auto it = events_view.begin(); it != events_view.end(); ++it) {
+ sorted_event_classes.push_back(*it);
+ }
std::sort(sorted_event_classes.begin(),
sorted_event_classes.end(),
Index: lttng-tools-2.14.0/src/bin/lttng-sessiond/ust-registry-session.cpp
===================================================================
--- lttng-tools-2.14.0.orig/src/bin/lttng-sessiond/ust-registry-session.cpp
+++ lttng-tools-2.14.0/src/bin/lttng-sessiond/ust-registry-session.cpp
@@ -586,8 +586,11 @@ void lsu::registry_session::_accept_on_s
decltype(lsu::registry_channel::_node),
&lsu::registry_channel::_node>
channels_ht_view(*_channels->ht);
- std::vector<const lttng::sessiond::ust::registry_channel *> sorted_stream_classes(
- channels_ht_view.begin(), channels_ht_view.end());
+ std::vector<const lttng::sessiond::ust::registry_channel *> sorted_stream_classes;
+ /* Avoid libc++s range-ctor SFINAE on non-standard iterators. */
+ for (auto it = channels_ht_view.begin(); it != channels_ht_view.end(); ++it) {
+ sorted_stream_classes.push_back(*it);
+ }
std::sort(sorted_stream_classes.begin(),
sorted_stream_classes.end(),

View File

@@ -53,6 +53,7 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
file://0001-eventfd.cpp-Remove-the-scope-resolution-operator.patch \
file://disable-tests2.patch \
file://0001-liblttng-ctl-drop-index-allocator-symbols-from-versi.patch \
file://libc++.patch \
"
SRC_URI[sha256sum] = "d8c39c26cec13b7bd82551cd52a22efc358b888e36ebcf9c1b60ef1c3a3c2fd3"