From 3901e318d263276398bbca6764d7800f6575da97 Mon Sep 17 00:00:00 2001 From: munix9 <44939650+munix9@users.noreply.github.com> Date: Fri, 25 Sep 2026 11:56:18 +0200 Subject: [PATCH 1/2] adb: keep libbase logging macros after protobuf includes Fix build with protobuf >= 36 Based on arch linux patch https://gitlab.archlinux.org/archlinux/packaging/packages/android-tools/-/blob/03fecd370e9633927b8157ab94a7db11e7b8cf16/protobuf-36-absl-log-macros.patch Please create a new release (eg. 37.0.0p1) if this PR is accepted. --- .../0029-protobuf-36-absl-log-macros.patch | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 patches/adb/0029-protobuf-36-absl-log-macros.patch diff --git a/patches/adb/0029-protobuf-36-absl-log-macros.patch b/patches/adb/0029-protobuf-36-absl-log-macros.patch new file mode 100644 index 00000000..60247e26 --- /dev/null +++ b/patches/adb/0029-protobuf-36-absl-log-macros.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Felix Yan +Date: Thu, 27 Aug 2026 16:00:00 +0800 +Subject: [PATCH] adb: keep libbase logging macros after protobuf includes + +Protobuf 36's descriptor.h includes absl/log/log.h, which defines the +short LOG and VLOG macros. Several adb sources include generated protobuf +headers after adb's libbase logging/trace headers; those protobuf headers +then replace adb's macros and make adb_trace.h's LOG(DEBUG) expand as +Abseil logging, where DEBUG is not a valid severity. + +sysdeps.h is the first include for most adb translation units. Extend its +existing protobuf-first include to cover descriptor.h as well, so Abseil's +short logging macros are seen before android-base/logging.h and adb_trace.h +install adb's macros. Include sysdeps.h first from mdns_tracker.cpp too, +matching the rest of adb host sources. + +This keeps adb's logging behavior intact and avoids per-include macro +save/restore blocks. +--- + client/mdns_tracker.cpp | 2 ++ + sysdeps.h | 7 +++++-- + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/client/mdns_tracker.cpp b/client/mdns_tracker.cpp +index 92ef35086b18..0f21f5054164 100644 +--- a/client/mdns_tracker.cpp ++++ b/client/mdns_tracker.cpp +@@ -14,6 +14,8 @@ + * limitations under the License. + */ + ++#include "sysdeps.h" ++ + #include "mdns_tracker.h" + + #include +diff --git a/sysdeps.h b/sysdeps.h +index 970e7cf27b4d..da2a8830317e 100644 +--- a/sysdeps.h ++++ b/sysdeps.h +@@ -24,9 +24,12 @@ + # undef _WIN32 + #endif + +-// Include this protobuf header first, because it uses some write() calls +-// that we will redefine later. Not all modules that include sysdeps.h use +-// protobufs, so only include it if it exists. ++// Include protobuf headers first, because they expose Abseil's LOG/VLOG macros ++// and use some write() calls that we will redefine later. Not all modules that ++// include sysdeps.h use protobufs, so only include them if they exist. ++#if __has_include("google/protobuf/descriptor.h") ++#include "google/protobuf/descriptor.h" ++#endif + #if __has_include("google/protobuf/io/coded_stream.h") + #include "google/protobuf/io/coded_stream.h" + #endif From 72350f42896873d01060e22090e8ec51bf2fac6f Mon Sep 17 00:00:00 2001 From: munix9 <44939650+munix9@users.noreply.github.com> Date: Sun, 27 Sep 2026 19:24:00 +0200 Subject: [PATCH 2/2] fix "'adb install' command shows a warning message" https://github.com/nmeum/android-tools/pull/213#issuecomment-5854080337 --- .../0029-protobuf-36-absl-log-macros.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/patches/adb/0029-protobuf-36-absl-log-macros.patch b/patches/adb/0029-protobuf-36-absl-log-macros.patch index 60247e26..e086df3d 100644 --- a/patches/adb/0029-protobuf-36-absl-log-macros.patch +++ b/patches/adb/0029-protobuf-36-absl-log-macros.patch @@ -55,3 +55,32 @@ index 970e7cf27b4d..da2a8830317e 100644 #if __has_include("google/protobuf/io/coded_stream.h") #include "google/protobuf/io/coded_stream.h" #endif + +From: Biswapriyo Nath +Date: Sun, 27 Sep 2026 18:11:30 +0200 +Subject: [PATCH] fix "'adb install' command shows a warning message" + +https://github.com/nmeum/android-tools/pull/213#issuecomment-5854080337 +--- + client/adb_install.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/client/adb_install.cpp b/client/adb_install.cpp +--- a/client/adb_install.cpp ++++ b/client/adb_install.cpp +@@ -14,6 +14,7 @@ + * limitations under the License. + */ + ++#include "sysdeps.h" + #include "adb_install.h" + + #include +@@ -39,7 +40,6 @@ + #include "commandline.h" + #include "fastdeploy.h" + #include "incremental.h" +-#include "sysdeps.h" + + using namespace std::literals; +