diff --git a/meta-oe/recipes-devtools/android-tools/android-tools/0011-adb-drop-non-portable-is_standard_layout-assertion.patch b/meta-oe/recipes-devtools/android-tools/android-tools/0011-adb-drop-non-portable-is_standard_layout-assertion.patch new file mode 100644 index 0000000000..c8316a48fa --- /dev/null +++ b/meta-oe/recipes-devtools/android-tools/android-tools/0011-adb-drop-non-portable-is_standard_layout-assertion.patch @@ -0,0 +1,42 @@ +From 1cbe4eb212f9be35e89eb7f43160c7e0ec35524c Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 24 Jun 2026 17:50:54 -0700 +Subject: [PATCH] adb: drop non-portable std::is_standard_layout assertion in + IOVector::coalesce + +IOVector::coalesce() asserts that the destination collection type is +standard-layout before memcpy'ing the coalesced payload into it: + + static_assert(std::is_standard_layout()); + +The default collection type is Block, which holds a std::unique_ptr +member. unique_ptr is standard-layout in LLVM libc++ (what AOSP builds +against) but not in GNU libstdc++, so the assertion fails for any +libstdc++ based toolchain (gcc, or clang with the default C++ runtime): + + packages/modules/adb/types.h:235:27: error: static assertion failed due + to requirement 'std::is_standard_layout()' + +The assertion does not protect the memcpy, which only writes into the +contiguous char storage exposed via Block::operator[]; Block being +standard-layout is irrelevant to its correctness. Drop the assertion so +the code builds with libstdc++. + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + packages/modules/adb/types.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/packages/modules/adb/types.h b/packages/modules/adb/types.h +index 18c8e13..2ed006a 100644 +--- a/packages/modules/adb/types.h ++++ b/packages/modules/adb/types.h +@@ -232,7 +232,6 @@ struct IOVector { + + size_t offset = 0; + iterate_blocks([&offset, &result](const char* data, size_t len) { +- static_assert(std::is_standard_layout()); + memcpy(&result[offset], data, len); + offset += len; + }); diff --git a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb index 3a277cd4b5..5a3ff3a6dd 100644 --- a/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb +++ b/meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb @@ -55,6 +55,7 @@ SRC_URI = "https://deb.debian.org/debian/pool/main/a/android-platform-tools/andr file://0008-adb-GCC-compatibility-fixes-for-usb_linux-and-sysdep.patch \ file://0009-libbase-include-stdint.h-in-hex.cpp.patch \ file://0010-adbd-make-systemd-sd_notify-conditional-on-HAVE_SYSTEMD.patch \ + file://0011-adb-drop-non-portable-is_standard_layout-assertion.patch \ " SRC_URI[orig.md5sum] = "352376965cdef7bd7505d8fefdd43d50" @@ -79,7 +80,12 @@ SYSTEMD_PACKAGES = "${PN}-adbd" SYSTEMD_SERVICE:${PN}-adbd = "android-tools-adbd.service" CFLAGS:append = " -fPIC -std=gnu2x" -CXXFLAGS:append = " -fPIC -std=gnu++20 -D_Nonnull= -D_Nullable= -I${STAGING_INCDIR}/boringssl" +# The bundled fmtlib 10.2.0 validates FMT_STRING() inside a consteval +# basic_format_string constructor whose parse path evaluates "it - begin()", +# which current C++ frontends reject as a non-constant subexpression. Define +# FMT_CONSTEVAL to empty so format-string checking falls back to fmt's runtime +# path instead of the broken compile-time one. +CXXFLAGS:append = " -fPIC -std=gnu++20 -D_Nonnull= -D_Nullable= -I${STAGING_INCDIR}/boringssl -DFMT_CONSTEVAL=" LDFLAGS:append = " -fPIC -L${STAGING_LIBDIR}/android"