diff options
| author | Sasi Kumar Maddineni <quic_sasikuma@quicinc.com> | 2025-10-29 12:22:58 +0530 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2025-10-29 21:02:20 -0700 |
| commit | 838dbfc496a2940b060c19f7bfc8e080f7b68e40 (patch) | |
| tree | 4cb889f466cd7c1a230d57be0ff809fb4d79bc30 | |
| parent | 517f03237b89a0496304de1d83adbd862cc52e2f (diff) | |
| download | meta-openembedded-838dbfc496a2940b060c19f7bfc8e080f7b68e40.tar.gz | |
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>
2 files changed, 53 insertions, 0 deletions
diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/android-tools-scope-write-macro-to-prevent-conflict-.patch b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/android-tools-scope-write-macro-to-prevent-conflict-.patch new file mode 100644 index 0000000000..61032944d8 --- /dev/null +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools/debian/system/core/android-tools-scope-write-macro-to-prevent-conflict-.patch | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | From 72b53f2d5c6e1b462a288cef3d84dd302fe603d6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Sasi Kumar Maddineni <quic_sasikuma@quicinc.com> | ||
| 3 | Date: Wed, 29 Oct 2025 11:58:20 +0530 | ||
| 4 | Subject: [PATCH] android-tools: scope 'write' macro to prevent conflict with | ||
| 5 | std::basic_ostream::write | ||
| 6 | |||
| 7 | The build fails with a compiler error due to a macro redefinition of 'write' | ||
| 8 | to '___xxx_write'. This macro substitution interferes with the standard C++ | ||
| 9 | library's definition of std::basic_ostream::write, leading to a mismatch | ||
| 10 | between function declarations and definitions in <ostream.tcc>. | ||
| 11 | |||
| 12 | Wrap the `#undef write` and `#define write ___xxx_write` directives with | ||
| 13 | `#if defined(__ANDROID__)` to ensure they are only applied when building | ||
| 14 | for | ||
| 15 | Android. | ||
| 16 | |||
| 17 | Upstream-Status: Pending | ||
| 18 | |||
| 19 | Signed-off-by: Sasi Kumar Maddineni <quic_sasikuma@quicinc.com> | ||
| 20 | --- | ||
| 21 | system/core/adb/sysdeps.h | 4 ++++ | ||
| 22 | 1 file changed, 4 insertions(+) | ||
| 23 | |||
| 24 | diff --git a/system/core/adb/sysdeps.h b/system/core/adb/sysdeps.h | ||
| 25 | index a4827b8a..ff51d574 100644 | ||
| 26 | --- a/system/core/adb/sysdeps.h | ||
| 27 | +++ b/system/core/adb/sysdeps.h | ||
| 28 | @@ -127,8 +127,10 @@ static __inline__ int unix_read(borrowed_fd fd, void* buf, size_t len) { | ||
| 29 | static __inline__ int unix_write(borrowed_fd fd, const void* buf, size_t len) { | ||
| 30 | return write(fd.get(), buf, len); | ||
| 31 | } | ||
| 32 | +#if defined(__ANDROID__) | ||
| 33 | #undef write | ||
| 34 | #define write ___xxx_write | ||
| 35 | +#endif | ||
| 36 | |||
| 37 | #undef pwrite | ||
| 38 | #define pwrite ___xxx_pwrite | ||
| 39 | @@ -463,8 +465,10 @@ static __inline__ int adb_pwrite(int fd, const void* buf, size_t len, off64_t of | ||
| 40 | #endif | ||
| 41 | } | ||
| 42 | |||
| 43 | +#if defined(__ANDROID__) | ||
| 44 | #undef write | ||
| 45 | #define write ___xxx_write | ||
| 46 | +#endif | ||
| 47 | #undef pwrite | ||
| 48 | #define pwrite ___xxx_pwrite | ||
| 49 | |||
| 50 | -- | ||
| 51 | 2.34.1 | ||
| 52 | |||
diff --git a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_29.0.6.r14.bb b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_29.0.6.r14.bb index 63e31e90cc..0e25c39bc2 100644 --- a/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_29.0.6.r14.bb +++ b/meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools/android-tools_29.0.6.r14.bb | |||
| @@ -38,6 +38,7 @@ SRC_URI += " \ | |||
| 38 | file://debian/system/core/stub-out-fastdeploy.patch \ | 38 | file://debian/system/core/stub-out-fastdeploy.patch \ |
| 39 | file://debian/system/core/fix-standard-namespace-errors.patch \ | 39 | file://debian/system/core/fix-standard-namespace-errors.patch \ |
| 40 | file://debian/system/core/Add-riscv64-support.patch \ | 40 | file://debian/system/core/Add-riscv64-support.patch \ |
| 41 | file://debian/system/core/android-tools-scope-write-macro-to-prevent-conflict-.patch \ | ||
| 41 | \ | 42 | \ |
| 42 | " | 43 | " |
| 43 | 44 | ||
