mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-05 02:50:46 +00:00
android-tools: scope 'write' macro to prevent conflict with std::basic_ostream::write
The build fails with a compiler error due to a macro redefinition of 'write' to '___xxx_write'. This macro substitution interferes with the standard C++ library's definition of std::basic_ostream::write, leading to a mismatch between function declarations and definitions in <ostream.tcc>. Wrap the `#undef write` and `#define write ___xxx_write` directives with `#if defined(__ANDROID__)` to ensure they are only applied when building for Android. Signed-off-by: Sasi Kumar Maddineni <quic_sasikuma@quicinc.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
committed by
Khem Raj
parent
517f03237b
commit
838dbfc496
+52
@@ -0,0 +1,52 @@
|
|||||||
|
From 72b53f2d5c6e1b462a288cef3d84dd302fe603d6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sasi Kumar Maddineni <quic_sasikuma@quicinc.com>
|
||||||
|
Date: Wed, 29 Oct 2025 11:58:20 +0530
|
||||||
|
Subject: [PATCH] android-tools: scope 'write' macro to prevent conflict with
|
||||||
|
std::basic_ostream::write
|
||||||
|
|
||||||
|
The build fails with a compiler error due to a macro redefinition of 'write'
|
||||||
|
to '___xxx_write'. This macro substitution interferes with the standard C++
|
||||||
|
library's definition of std::basic_ostream::write, leading to a mismatch
|
||||||
|
between function declarations and definitions in <ostream.tcc>.
|
||||||
|
|
||||||
|
Wrap the `#undef write` and `#define write ___xxx_write` directives with
|
||||||
|
`#if defined(__ANDROID__)` to ensure they are only applied when building
|
||||||
|
for
|
||||||
|
Android.
|
||||||
|
|
||||||
|
Upstream-Status: Pending
|
||||||
|
|
||||||
|
Signed-off-by: Sasi Kumar Maddineni <quic_sasikuma@quicinc.com>
|
||||||
|
---
|
||||||
|
system/core/adb/sysdeps.h | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/system/core/adb/sysdeps.h b/system/core/adb/sysdeps.h
|
||||||
|
index a4827b8a..ff51d574 100644
|
||||||
|
--- a/system/core/adb/sysdeps.h
|
||||||
|
+++ b/system/core/adb/sysdeps.h
|
||||||
|
@@ -127,8 +127,10 @@ static __inline__ int unix_read(borrowed_fd fd, void* buf, size_t len) {
|
||||||
|
static __inline__ int unix_write(borrowed_fd fd, const void* buf, size_t len) {
|
||||||
|
return write(fd.get(), buf, len);
|
||||||
|
}
|
||||||
|
+#if defined(__ANDROID__)
|
||||||
|
#undef write
|
||||||
|
#define write ___xxx_write
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#undef pwrite
|
||||||
|
#define pwrite ___xxx_pwrite
|
||||||
|
@@ -463,8 +465,10 @@ static __inline__ int adb_pwrite(int fd, const void* buf, size_t len, off64_t of
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if defined(__ANDROID__)
|
||||||
|
#undef write
|
||||||
|
#define write ___xxx_write
|
||||||
|
+#endif
|
||||||
|
#undef pwrite
|
||||||
|
#define pwrite ___xxx_pwrite
|
||||||
|
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
||||||
+1
@@ -38,6 +38,7 @@ SRC_URI += " \
|
|||||||
file://debian/system/core/stub-out-fastdeploy.patch \
|
file://debian/system/core/stub-out-fastdeploy.patch \
|
||||||
file://debian/system/core/fix-standard-namespace-errors.patch \
|
file://debian/system/core/fix-standard-namespace-errors.patch \
|
||||||
file://debian/system/core/Add-riscv64-support.patch \
|
file://debian/system/core/Add-riscv64-support.patch \
|
||||||
|
file://debian/system/core/android-tools-scope-write-macro-to-prevent-conflict-.patch \
|
||||||
\
|
\
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user