From d40b3ddfab57888fa209816e792532d69f729db6 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Thu, 16 May 2024 10:53:36 +0200 Subject: [PATCH] Fixed gcc-14 msys2 build --- .github/workflows/c-cpp.yml | 5 ++++- patches/msys2/gcc14_abseil.patch | 13 +++++++++++++ patches/msys2/gcc14_boringssl.patch | 22 ++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 patches/msys2/gcc14_abseil.patch create mode 100644 patches/msys2/gcc14_boringssl.patch diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index b0bb04f..e92b7b2 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -354,8 +354,11 @@ jobs: install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang mingw-w64-x86_64-lld mingw-w64-x86_64-cmake make git - name: Apply patch - if: matrix.config.c == 'clang' run: | + cd external/src/grpc/third_party/boringssl-with-bazel + git apply --verbose --ignore-whitespace ../../../../../patches/msys2/gcc14_boringssl.patch + cd ../abseil-cpp + git apply --verbose --ignore-whitespace ../../../../../patches/msys2/gcc14_abseil.patch cd / git apply --verbose --ignore-whitespace --directory=mingw64/include/c++/`ls mingw64/include/c++`/ /d/a/p2pool/p2pool/patches/msys2/typeinfo.patch diff --git a/patches/msys2/gcc14_abseil.patch b/patches/msys2/gcc14_abseil.patch new file mode 100644 index 0000000..e9f2e51 --- /dev/null +++ b/patches/msys2/gcc14_abseil.patch @@ -0,0 +1,13 @@ +diff --git a/absl/numeric/internal/bits.h b/absl/numeric/internal/bits.h +index bfef06bc..3091d1b4 100644 +--- a/absl/numeric/internal/bits.h ++++ b/absl/numeric/internal/bits.h +@@ -303,7 +303,7 @@ CountTrailingZeroesNonzero64(uint64_t x) { + + ABSL_ATTRIBUTE_ALWAYS_INLINE ABSL_INTERNAL_CONSTEXPR_CTZ inline int + CountTrailingZeroesNonzero16(uint16_t x) { +-#if ABSL_HAVE_BUILTIN(__builtin_ctzs) ++#if ABSL_HAVE_BUILTIN(__builtin_ctzs) && defined(__clang__) + static_assert(sizeof(unsigned short) == sizeof(x), // NOLINT(runtime/int) + "__builtin_ctzs does not take 16-bit arg"); + return __builtin_ctzs(x); diff --git a/patches/msys2/gcc14_boringssl.patch b/patches/msys2/gcc14_boringssl.patch new file mode 100644 index 0000000..f5d453d --- /dev/null +++ b/patches/msys2/gcc14_boringssl.patch @@ -0,0 +1,22 @@ +diff --git a/src/crypto/internal.h b/src/crypto/internal.h +index a77102d76..30d6826dd 100644 +--- a/src/crypto/internal.h ++++ b/src/crypto/internal.h +@@ -1176,7 +1176,7 @@ static inline uint64_t CRYPTO_rotr_u64(uint64_t value, int shift) { + + // CRYPTO_addc_* returns |x + y + carry|, and sets |*out_carry| to the carry + // bit. |carry| must be zero or one. +-#if OPENSSL_HAS_BUILTIN(__builtin_addc) ++#if OPENSSL_HAS_BUILTIN(__builtin_addc) && !defined(__cplusplus) + + #define CRYPTO_GENERIC_ADDC(x, y, carry, out_carry) \ + (_Generic((x), \ +@@ -1228,7 +1228,7 @@ static inline uint64_t CRYPTO_addc_u64(uint64_t x, uint64_t y, uint64_t carry, + + // CRYPTO_subc_* returns |x - y - borrow|, and sets |*out_borrow| to the borrow + // bit. |borrow| must be zero or one. +-#if OPENSSL_HAS_BUILTIN(__builtin_subc) ++#if OPENSSL_HAS_BUILTIN(__builtin_subc) && !defined(__cplusplus) + + #define CRYPTO_GENERIC_SUBC(x, y, borrow, out_borrow) \ + (_Generic((x), \