mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-07-26 07:37:14 +00:00
android-tools: fix build with libstdc++ and current C++ frontends
Two build failures occur with the default clang/lld toolchain (and with
gcc) when compiling android-tools 35.0.2:
1. The bundled fmtlib 10.2.0 validates FMT_STRING() inside a consteval
basic_format_string constructor whose parse path evaluates
"format_str_.remove_prefix(detail::to_unsigned(it - begin()))". Current
C++ frontends reject that iterator subtraction as a non-constant
subexpression:
error: call to consteval function
'fmt::basic_format_string<...>::basic_format_string<FMT_COMPILE_STRING,0>'
is not a constant expression
Define FMT_CONSTEVAL to empty so fmt drops the consteval qualifier and
validates format strings via its runtime path instead.
2. adb's IOVector::coalesce() static_asserts that its Block collection type
is standard-layout. Block holds a std::unique_ptr<char[]>, which is
standard-layout under LLVM libc++ (AOSP's runtime) but not under GNU
libstdc++, so the assertion fails for libstdc++ based toolchains:
packages/modules/adb/types.h:235:27: error: static assertion failed due
to requirement 'std::is_standard_layout<Block>()'
The assertion does not protect the memcpy it guards (which writes into
plain char storage), so drop it.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user