Files
arrow/cpp/cmake_modules/google-cloud-cpp-bcrypt-mingw.patch
Raúl CumplidoandSutou Kouhei b95645d213 GH-48926: [C++] Upgrade Abseil/Protobuf/GRPC/Google-Cloud-CPP bundled versions (#48964)
### Rationale for this change

The versions we are currently using are really old. There are several advantages on using newer bundled versions but in general they'll bring bug fixes, security fixes and new features.

### What changes are included in this PR?

- Update ABSL from `20211102.0` to `20250127.0`
- Remove now unnecessary CRC32C
- Update Google Cloud CPP from `v2.22.0` to `v3.2.0`
- Updatge gRPC from `v1.46.3` to `v1.76.0`
- Update Protobuf from `v21.3` to `v31.1`
- Older Ubuntu, Debian and RHEL will have to bundle newer ABSL due to CRC32C requirements.
- A couple of minor patches required for Google Cloud old MINGW and protobuf emscripten builds.
- Other minor changes and requirements to build.

### Are these changes tested?

Yes via CI

### Are there any user-facing changes?

Not directly but some old versions (like compiling Google Cloud with old system Abseil) might stop working.

* GitHub Issue: #48926

Lead-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
2026-04-15 12:12:57 +02:00

66 lines
3.1 KiB
Diff

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
diff --git a/google/cloud/internal/win32/sign_using_sha256.cc b/google/cloud/internal/win32/sign_using_sha256.cc
index 15ecc6e6f9..9595ed9eb3 100644
--- a/google/cloud/internal/win32/sign_using_sha256.cc
+++ b/google/cloud/internal/win32/sign_using_sha256.cc
@@ -99,6 +99,11 @@ StatusOr<std::unique_ptr<std::remove_pointer_t<BCRYPT_KEY_HANDLE>,
decltype(&BCryptDestroyKey)>>
CreateRsaBCryptKey(std::vector<BYTE> buffer) {
BCRYPT_KEY_HANDLE key_handle;
+ // Workaround missing macros in MinGW-w64:
+ // https://github.com/mingw-w64/mingw-w64/issues/49
+ #ifndef BCRYPT_RSA_ALG_HANDLE
+ #define BCRYPT_RSA_ALG_HANDLE ((BCRYPT_ALG_HANDLE)0x000000e1)
+ #endif
if (BCryptImportKeyPair(BCRYPT_RSA_ALG_HANDLE, nullptr,
BCRYPT_RSAPRIVATE_BLOB, &key_handle, buffer.data(),
static_cast<DWORD>(buffer.size()),
diff --git a/google/cloud/storage/internal/md5hash.cc b/google/cloud/storage/internal/md5hash.cc
index 00c72e0e5d..7fbd04507f 100644
--- a/google/cloud/storage/internal/md5hash.cc
+++ b/google/cloud/storage/internal/md5hash.cc
@@ -31,6 +31,11 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
std::vector<std::uint8_t> MD5Hash(absl::string_view payload) {
#ifdef _WIN32
std::vector<unsigned char> digest(16);
+ // Workaround missing macros in MinGW-w64:
+ // https://github.com/mingw-w64/mingw-w64/issues/49
+ #ifndef BCRYPT_MD5_ALG_HANDLE
+ #define BCRYPT_MD5_ALG_HANDLE ((BCRYPT_ALG_HANDLE)0x00000021)
+ #endif
BCryptHash(BCRYPT_MD5_ALG_HANDLE, nullptr, 0,
reinterpret_cast<PUCHAR>(const_cast<char*>(payload.data())),
static_cast<ULONG>(payload.size()), digest.data(),
diff --git a/google/cloud/storage/internal/win32/hash_function_impl.cc b/google/cloud/storage/internal/win32/hash_function_impl.cc
index 655c9f0991..07b2937c94 100644
--- a/google/cloud/storage/internal/win32/hash_function_impl.cc
+++ b/google/cloud/storage/internal/win32/hash_function_impl.cc
@@ -33,6 +33,11 @@ using ContextPtr =
ContextPtr CreateMD5HashCtx() {
BCRYPT_HASH_HANDLE hHash = nullptr;
+ // Workaround missing macros in MinGW-w64:
+ // https://github.com/mingw-w64/mingw-w64/issues/49
+ #ifndef BCRYPT_MD5_ALG_HANDLE
+ #define BCRYPT_MD5_ALG_HANDLE ((BCRYPT_ALG_HANDLE)0x00000021)
+ #endif
BCryptCreateHash(BCRYPT_MD5_ALG_HANDLE, &hHash, nullptr, 0, nullptr, 0, 0);
return ContextPtr(hHash);
}