From fe376952de4b7d0bac1e97df50c021c7b7645dd5 Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Tue, 19 Aug 2025 12:39:48 +0800 Subject: [PATCH] Fix compilation on Protobuf v30 --- ...ix-incompatibility-with-protobuf-v30.patch | 36 +++++++++++++++++++ android-tools.spec | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 0002-extras-libjsonpb-Fix-incompatibility-with-protobuf-v30.patch diff --git a/0002-extras-libjsonpb-Fix-incompatibility-with-protobuf-v30.patch b/0002-extras-libjsonpb-Fix-incompatibility-with-protobuf-v30.patch new file mode 100644 index 0000000..fd6a890 --- /dev/null +++ b/0002-extras-libjsonpb-Fix-incompatibility-with-protobuf-v30.patch @@ -0,0 +1,36 @@ +From 36c605004ae1c75813181ffe4c59907016aaf9e9 Mon Sep 17 00:00:00 2001 +From: Biswapriyo Nath +Date: Tue, 22 Apr 2025 15:12:23 +0000 +Subject: [PATCH] extras/libjsonpb: Fix incompatibility with protobuf v30 + +This commit fixes the following compiler error. + +jsonpb.cpp:36:44: error: invalid operands to binary expression ( +'basic_string, allocator>' and +'internal::DescriptorStringView' (aka 'basic_string_view')) +36 | return std::string(kTypeUrlPrefix) + "/" + message.GetDescriptor()->full_name(); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +More info here https://protobuf.dev/news/2024-10-02/#descriptor-apis + +Change-Id: I3c76d51dfdfbe013eaa5031e6194bf5edae1be35 +--- + libjsonpb/parse/jsonpb.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/vendor/extras/libjsonpb/parse/jsonpb.cpp b/vendor/extras/libjsonpb/parse/jsonpb.cpp +index b342c2b..ebd71bf 100644 +--- a/vendor/extras/libjsonpb/parse/jsonpb.cpp ++++ b/vendor/extras/libjsonpb/parse/jsonpb.cpp +@@ -33,7 +33,7 @@ using google::protobuf::util::TypeResolver; + static constexpr char kTypeUrlPrefix[] = "type.googleapis.com"; + + std::string GetTypeUrl(const Message& message) { +- return std::string(kTypeUrlPrefix) + "/" + message.GetDescriptor()->full_name(); ++ return std::string(kTypeUrlPrefix) + "/" + std::string(message.GetDescriptor()->full_name()); + } + + ErrorOr MessageToJsonString(const Message& message) { +-- +2.49.0 + diff --git a/android-tools.spec b/android-tools.spec index 5efc2ed..6e2a87a 100644 --- a/android-tools.spec +++ b/android-tools.spec @@ -13,6 +13,8 @@ URL: http://developer.android.com/guide/developing/tools/ Source0: https://github.com/nmeum/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz # https://github.com/nmeum/android-tools/issues/153 Patch0: 0001-Fix-libusb-enumeration.patch +# https://github.com/nmeum/android-tools/pull/172 +Patch1: 0002-extras-libjsonpb-Fix-incompatibility-with-protobuf-v30.patch BuildRequires: brotli-devel BuildRequires: cmake