diff --git a/.bazelrc.common b/.bazelrc.common index 6d8fa4fd1..c746b343f 100644 --- a/.bazelrc.common +++ b/.bazelrc.common @@ -41,6 +41,9 @@ build:linux-nixpkgs --config=nixpkgs build:macos-nixpkgs --config=nixpkgs build:nixpkgs --host_platform=@rules_nixpkgs_core//platforms:host +# abseil c++ (a dependency of protobuf) needs a C++14 compiler, but rules_nixpkgs cc sets `-std=c++0x` +build:nixpkgs --host_cxxopt=-std=c++14 + # Build and Test Filters # ---------------------- # Note tag filters do not compose. If you wish to augment these filters on the diff --git a/haskell/private/com_google_protobuf-protoc-dbghlp.diff b/haskell/private/com_google_protobuf-protoc-dbghlp.diff new file mode 100644 index 000000000..a318a5fc9 --- /dev/null +++ b/haskell/private/com_google_protobuf-protoc-dbghlp.diff @@ -0,0 +1,27 @@ +diff --git a/build_defs/cpp_opts.bzl b/build_defs/cpp_opts.bzl +index f667a4088..da463ca45 100644 +--- a/build_defs/cpp_opts.bzl ++++ b/build_defs/cpp_opts.bzl +@@ -44,6 +44,9 @@ LINK_OPTS = select({ + "-lm", + "-framework CoreFoundation", + ], ++ "@platforms//os:windows": [ ++ "-ldbghelp", ++ ], + "//conditions:default": [ + "-lpthread", + "-lm", +diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc +index 60900d215..10c41b441 100644 +--- a/src/google/protobuf/port_def.inc ++++ b/src/google/protobuf/port_def.inc +@@ -673,7 +673,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3), + #error PROTOBUF_DESCRIPTOR_WEAK_MESSAGES_ALLOWED was previously defined + #endif + #if defined(__GNUC__) && defined(__clang__) && !defined(__APPLE__) && \ +- !defined(_MSC_VER) ++ !defined(_MSC_VER) && !defined(_WIN32) + #define PROTOBUF_DESCRIPTOR_WEAK_MESSAGES_ALLOWED + #endif + diff --git a/haskell/repositories.bzl b/haskell/repositories.bzl index 91c7b4086..44fcc1868 100644 --- a/haskell/repositories.bzl +++ b/haskell/repositories.bzl @@ -121,11 +121,25 @@ def rules_haskell_dependencies(): maybe( http_archive, name = "com_google_protobuf", - sha256 = "22fdaf641b31655d4b2297f9981fa5203b2866f8332d3c6333f6b0107bb320de", - strip_prefix = "protobuf-21.12", + sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa", + strip_prefix = "protobuf-27.0", urls = [ - "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v21.12.tar.gz", + "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v27.0.tar.gz", ], + patches = [ + # see https://github.com/protocolbuffers/protobuf/issues/16844 + "@rules_haskell//haskell:private/com_google_protobuf-protoc-dbghlp.diff", + ], + patch_args = ["-p1"], + ) + maybe( + http_archive, + name = "com_google_absl", + urls = [ + "https://github.com/abseil/abseil-cpp/releases/download/20240116.0/abseil-cpp-20240116.0.tar.gz", + ], + sha256 = "338420448b140f0dfd1a1ea3c3ce71b3bc172071f24f4d9a57d59b45037da440", + strip_prefix = "abseil-cpp-20240116.0", ) maybe(