Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[grpc/protobuf] Update grpc to 1.65.5 and update protobuf to 5.26.1 #39800

Merged
merged 14 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ports/arcus/0001-fix-protobuf-deprecated.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
diff --git a/src/MessageTypeStore.cpp b/src/MessageTypeStore.cpp
index 382a138..5f09122 100644
--- a/src/MessageTypeStore.cpp
+++ b/src/MessageTypeStore.cpp
@@ -52,7 +52,7 @@ class ErrorCollector : public google::protobuf::compiler::MultiFileErrorCollecto
public:
ErrorCollector() : _error_count(0) { }

- void AddError(const std::string& filename, int line, int column, const std::string& message) override
+ void RecordError(absl::string_view filename, int line, int column, absl::string_view message) override
vicroms marked this conversation as resolved.
Show resolved Hide resolved
{
_stream << "[" << filename << " (" << line << "," << column << ")] " << message << std::endl;
_error_count++;
diff --git a/src/Socket_p.h b/src/Socket_p.h
index 9c3c084..9ccabda 100644
--- a/src/Socket_p.h
Expand Down
2 changes: 1 addition & 1 deletion ports/arcus/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "arcus",
"version-semver": "4.10.0",
"port-version": 3,
"port-version": 4,
"description": "This library contains C++ bindings for creating a socket in a thread and using this socket to send and receive messages based on the Protocol Buffers library.",
"homepage": "https://github.com/Ultimaker/libArcus",
"supports": "!uwp",
Expand Down
22 changes: 0 additions & 22 deletions ports/brpc/fix-compilation-error.patch

This file was deleted.

12 changes: 9 additions & 3 deletions ports/brpc/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
vcpkg_download_distfile(
PROTOBUF_V5_PATCH
URLS https://github.com/apache/brpc/commit/282776acaf2c894791d2b5d4c294a28cfa2d4138.patch?full_index=1
SHA512 2e62617ed56047a037f0e673a7dcc43e02c9bff46b6c9d1ae0098e4c73630f1a9a67c113e770bf1cc12d86d273f88f504f83af1ed69ee771f35cccac1a472990
FILENAME 282776acaf2c894791d2b5d4c294a28cfa2d4138.patch
)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO apache/brpc
REF "${VERSION}"
SHA512 cc1a373d94752c43376a731b4f08dc559bffcd67bdad7e22268a2a20a1034b40d658d591d946d4c1aa94287060146eb041626e0354188ee7dc41554512d72490
SHA512 eb2f9528f055a31db5b2bbf57d302b17d2229d387c3bc6afd7dec5f3d21d1f882275d43d49c04cb5190442c2daa746ac2a174b3741d943e531ebbbd82526d510
HEAD_REF master
PATCHES
fix-build.patch
fix-warnings.patch
protobuf.patch
fix-compilation-error.patch
${PROTOBUF_V5_PATCH}
)

vcpkg_cmake_configure(
Expand Down
25 changes: 0 additions & 25 deletions ports/brpc/protobuf.patch

This file was deleted.

2 changes: 1 addition & 1 deletion ports/brpc/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "brpc",
"version": "1.10.0",
"version": "1.11.0",
"description": "Industrial-grade RPC framework used throughout Baidu, with 1,000,000+ instances and thousands kinds of services, called \"baidu-rpc\" inside Baidu.",
"homepage": "https://github.com/apache/brpc",
"license": "Apache-2.0",
Expand Down
13 changes: 0 additions & 13 deletions ports/grpc/00003-undef-base64-macro.patch

This file was deleted.

26 changes: 13 additions & 13 deletions ports/grpc/00004-link-gdi32-on-windows.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fce68b9..220f251 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -432,7 +432,7 @@ if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/xds)
endif()

if(WIN32)
- set(_gRPC_ALLTARGETS_LIBRARIES ${_gRPC_ALLTARGETS_LIBRARIES} ws2_32 crypt32)
+ set(_gRPC_ALLTARGETS_LIBRARIES ${_gRPC_ALLTARGETS_LIBRARIES} wsock32 ws2_32 crypt32 gdi32)
set(_gRPC_STATIC_WIN32 STATIC)
endif()

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2f633092ae..43fa8f6d97 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -481,7 +481,7 @@ if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/xds AND gRPC_DOWNLOAD_ARC
endif()
if(WIN32)
- set(_gRPC_ALLTARGETS_LIBRARIES ${_gRPC_ALLTARGETS_LIBRARIES} ws2_32 crypt32)
+ set(_gRPC_ALLTARGETS_LIBRARIES ${_gRPC_ALLTARGETS_LIBRARIES} wsock32 ws2_32 crypt32 gdi32)
set(_gRPC_STATIC_WIN32 STATIC)
endif()
94 changes: 47 additions & 47 deletions ports/grpc/00005-fix-uwp-error.patch
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
index 31bf464..d1007e4 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
@@ -689,7 +689,7 @@ class HPackParser::Parser {
}

void GPR_ATTRIBUTE_NOINLINE LogHeader(const HPackTable::Memento& memento) {
- const char* type;
+ const char* type = nullptr;
switch (log_info_.type) {
case LogInfo::kHeaders:
type = "HDR";
diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc
index 6180ef1..a8e8110 100644
--- a/src/core/lib/slice/slice.cc
+++ b/src/core/lib/slice/slice.cc
@@ -188,6 +188,7 @@ grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr<char> p,
size_t len) {
uint8_t* ptr = reinterpret_cast<uint8_t*>(p.get());
grpc_slice slice;
+ memset(&slice, 0, sizeof(grpc_slice));
if (len <= sizeof(slice.data.inlined.bytes)) {
slice.refcount = nullptr;
slice.data.inlined.length = len;
@@ -206,7 +207,7 @@ grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr<char> p) {
}

grpc_slice grpc_slice_from_cpp_string(std::string str) {
- grpc_slice slice;
+ grpc_slice slice = { 0 };
if (str.size() <= sizeof(slice.data.inlined.bytes)) {
slice.refcount = nullptr;
slice.data.inlined.length = str.size();
diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc
index 3dda49d..202caa5 100644
--- a/src/core/lib/surface/server.cc
+++ b/src/core/lib/surface/server.cc
@@ -1057,7 +1057,7 @@ grpc_call_error Server::QueueRequestedCall(size_t cq_idx, RequestedCall* rc) {
FailCall(cq_idx, rc, GRPC_ERROR_CREATE("Server Shutdown"));
return GRPC_CALL_OK;
}
- RequestMatcherInterface* rm;
+ RequestMatcherInterface* rm = nullptr;
switch (rc->type) {
case RequestedCall::Type::BATCH_CALL:
rm = unregistered_request_matcher_.get();
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
index 84b4e86279..4921002887 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
@@ -688,7 +688,7 @@ class HPackParser::Parser {
}
void GPR_ATTRIBUTE_NOINLINE LogHeader(const HPackTable::Memento& memento) {
- const char* type;
+ const char* type = nullptr;
switch (log_info_.type) {
case LogInfo::kHeaders:
type = "HDR";
diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc
index f2d49e0bf4..c86a75f1a3 100644
--- a/src/core/lib/slice/slice.cc
+++ b/src/core/lib/slice/slice.cc
@@ -189,6 +189,7 @@ grpc_slice grpc_slice_from_moved_buffer(grpc_core::UniquePtr<char> p,
size_t len) {
uint8_t* ptr = reinterpret_cast<uint8_t*>(p.get());
grpc_slice slice;
+ memset(&slice, 0, sizeof(grpc_slice));
if (len <= sizeof(slice.data.inlined.bytes)) {
slice.refcount = nullptr;
slice.data.inlined.length = len;
@@ -207,7 +208,7 @@ grpc_slice grpc_slice_from_moved_string(grpc_core::UniquePtr<char> p) {
}
grpc_slice grpc_slice_from_cpp_string(std::string str) {
- grpc_slice slice;
+ grpc_slice slice = { 0 };
if (str.size() <= sizeof(slice.data.inlined.bytes)) {
slice.refcount = nullptr;
slice.data.inlined.length = str.size();
diff --git a/src/core/server/server.cc b/src/core/server/server.cc
index c4796d6ae9..6a0289d180 100644
--- a/src/core/server/server.cc
+++ b/src/core/server/server.cc
@@ -1284,7 +1284,7 @@ grpc_call_error Server::QueueRequestedCall(size_t cq_idx, RequestedCall* rc) {
FailCall(cq_idx, rc, GRPC_ERROR_CREATE("Server Shutdown"));
return GRPC_CALL_OK;
}
- RequestMatcherInterface* rm;
+ RequestMatcherInterface* rm = nullptr;
switch (rc->type) {
case RequestedCall::Type::BATCH_CALL:
rm = unregistered_request_matcher_.get();
110 changes: 110 additions & 0 deletions ports/grpc/00006-utf8-range.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2008859625..73462d8285 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3931,7 +3931,7 @@ if(gRPC_INSTALL)
)
endif()

-
+if(0)
add_library(utf8_range_lib
third_party/utf8_range/utf8_range.c
)
@@ -3981,6 +3981,7 @@ if(gRPC_INSTALL)
ARCHIVE DESTINATION ${gRPC_INSTALL_LIBDIR}
)
endif()
+endif()

if(gRPC_BUILD_TESTS)

@@ -37649,9 +37650,9 @@ generate_pkgconfig(
"high performance general RPC framework"
"${gRPC_CORE_VERSION}"
"absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr"
- "libcares openssl re2 zlib"
+ "libcares openssl re2 zlib utf8_range"
"-lgrpc"
- "-laddress_sorting -lupb_textformat_lib -lupb_json_lib -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib"
+ "-laddress_sorting -lupb_textformat_lib -lupb_json_lib -lupb_message_lib -lupb_mem_lib -lupb_base_lib"
"grpc.pc")

# grpc_unsecure .pc file
@@ -37660,9 +37661,9 @@ generate_pkgconfig(
"high performance general RPC framework without SSL"
"${gRPC_CORE_VERSION}"
"absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr"
- "libcares zlib"
+ "libcares zlib utf8_range"
"-lgrpc_unsecure"
- "-laddress_sorting -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib"
+ "-laddress_sorting -lupb_message_lib -lupb_mem_lib -lupb_base_lib"
"grpc_unsecure.pc")

# grpc++ .pc file
@@ -37671,9 +37672,9 @@ generate_pkgconfig(
"C++ wrapper for gRPC"
"${gRPC_CPP_VERSION}"
"absl_absl_check absl_absl_log absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc"
- "libcares openssl re2 zlib"
+ "libcares openssl re2 zlib utf8_range"
"-lgrpc++"
- "-laddress_sorting -lupb_textformat_lib -lupb_json_lib -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib"
+ "-laddress_sorting -lupb_textformat_lib -lupb_json_lib -lupb_message_lib -lupb_mem_lib -lupb_base_lib"
"grpc++.pc")

# grpc++_unsecure .pc file
@@ -37682,18 +37683,20 @@ generate_pkgconfig(
"C++ wrapper for gRPC without SSL"
"${gRPC_CPP_VERSION}"
"absl_absl_check absl_absl_log absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc_unsecure"
- "libcares zlib"
+ "libcares zlib utf8_range"
"-lgrpc++_unsecure"
- "-laddress_sorting -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib"
+ "-laddress_sorting -lupb_message_lib -lupb_mem_lib -lupb_base_lib"
"grpc++_unsecure.pc")

+if(gRPC_BUILD_GRPCPP_OTEL_PLUGIN)
# grpcpp_otel_plugin .pc file
generate_pkgconfig(
"gRPC++ OpenTelemetry Plugin"
"OpenTelemetry Plugin for gRPC C++"
"${gRPC_CPP_VERSION}"
"absl_absl_check absl_absl_log absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc grpc++ opentelemetry_api"
- "libcares openssl re2 zlib"
+ "libcares openssl re2 zlib utf8_range"
"-lgrpcpp_otel_plugin"
- "-laddress_sorting -lupb_textformat_lib -lupb_json_lib -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib"
+ "-laddress_sorting -lupb_textformat_lib -lupb_json_lib -lupb_message_lib -lupb_mem_lib -lupb_base_lib"
"grpcpp_otel_plugin.pc")
+endif()
diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in
index d552e0bb4e..5751f503ba 100644
--- a/cmake/gRPCConfig.cmake.in
+++ b/cmake/gRPCConfig.cmake.in
@@ -9,6 +9,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules)
@_gRPC_FIND_ABSL@
@_gRPC_FIND_RE2@
@_gRPC_FIND_OPENTELEMETRY@
+@_gRPC_FIND_UTF8_RANGE@

# Targets
include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake)
diff --git a/cmake/upb.cmake b/cmake/upb.cmake
index 9156e5f48f..5323b5f10d 100644
--- a/cmake/upb.cmake
+++ b/cmake/upb.cmake
@@ -14,7 +14,9 @@

set(UPB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/upb)

-set(_gRPC_UPB_INCLUDE_DIR "${UPB_ROOT_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/third_party/utf8_range")
+set(_gRPC_UPB_INCLUDE_DIR "${UPB_ROOT_DIR}")
set(_gRPC_UPB_GRPC_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upb-gen" "${CMAKE_CURRENT_SOURCE_DIR}/src/core/ext/upbdefs-gen")

set(_gRPC_UPB_LIBRARIES upb)
+set(_gRPC_FIND_UTF8_RANGE "find_dependency(utf8_range CONFIG)")
+add_library(utf8_range_lib ALIAS utf8_range::utf8_range)
\ No newline at end of file
Loading
Loading