From 5340e5280a1cbdc9eff3bc4c91e9913e05104776 Mon Sep 17 00:00:00 2001 From: mehrdadn Date: Tue, 26 Nov 2019 14:49:24 -0800 Subject: [PATCH] Patch prometheus-cpp internally (#6281) --- bazel/ray_deps_build_all.bzl | 2 +- bazel/ray_deps_setup.bzl | 13 +++--- .../patches/prometheus-windows-pollfd.patch | 24 ++++++++++ .../patches/prometheus-windows-zlib.patch | 45 +++++++++++++++++++ 4 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 thirdparty/patches/prometheus-windows-pollfd.patch create mode 100644 thirdparty/patches/prometheus-windows-zlib.patch diff --git a/bazel/ray_deps_build_all.bzl b/bazel/ray_deps_build_all.bzl index 8794773d9..c6f187e83 100644 --- a/bazel/ray_deps_build_all.bzl +++ b/bazel/ray_deps_build_all.bzl @@ -1,6 +1,6 @@ load("@com_github_ray_project_ray//java:dependencies.bzl", "gen_java_deps") load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps") -load("@com_github_jupp0r_prometheus_cpp//:repositories.bzl", "prometheus_cpp_repositories") +load("@com_github_jupp0r_prometheus_cpp//bazel:repositories.bzl", "prometheus_cpp_repositories") load("@com_github_checkstyle_java//:repo.bzl", "checkstyle_deps") load("@com_github_grpc_grpc//third_party/py:python_configure.bzl", "python_configure") load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl index 5539146ee..6f580bf3e 100644 --- a/bazel/ray_deps_setup.bzl +++ b/bazel/ray_deps_setup.bzl @@ -178,11 +178,14 @@ def ray_deps_setup(): # OpenCensus depends on jupp0r/prometheus-cpp github_repository( name = "com_github_jupp0r_prometheus_cpp", - commit = "5c45ba7ddc0585d765a43d136764dd2a542bd495", - remote = "https://github.com/ray-project/prometheus-cpp", - # TODO(qwang): We should use the repository of `jupp0r` here when this PR - # `https://github.com/jupp0r/prometheus-cpp/pull/225` getting merged. - sha256 = "c80293276166d405188b1af62cd11178fbcec0f1a8ab0dbece19d4bdc79d45e7", + commit = "60eaa4ea47b16751a8e8740b05fe70914c68a480", + remote = "https://github.com/jupp0r/prometheus-cpp", + sha256 = "9756bd2d573e7722f97dbe6d35934e43b9a79e6a87fc5e1da79774a621cddd8e", + patches = [ + # https://github.com/jupp0r/prometheus-cpp/pull/225 + "//thirdparty/patches:prometheus-windows-zlib.patch", + "//thirdparty/patches:prometheus-windows-pollfd.patch", + ] ) github_repository( diff --git a/thirdparty/patches/prometheus-windows-pollfd.patch b/thirdparty/patches/prometheus-windows-pollfd.patch new file mode 100644 index 000000000..5f3c7ad8f --- /dev/null +++ b/thirdparty/patches/prometheus-windows-pollfd.patch @@ -0,0 +1,24 @@ +Target an older version of Windows SDK so that we don't get a conflicting definition of struct pollfd + +Windows Vista and later SDKs define struct pollfd for WSAPoll(), but it has a permanent bug: +- https://curl.haxx.se/mail/lib-2012-08/0014.html +- https://curl.haxx.se/mail/lib-2012-10/0038.html +civetweb provides its own implementation of poll, but it has a conflicting definition for pollfd. +Hence we block Windows from defining pollfd (which this project doesn't use). +--- + bazel/civetweb.BUILD | 1 + + 1 file changed, 1 insertion(+) + +diff --git bazel/civetweb.BUILD bazel/civetweb.BUILD +index e8d6024..162f234 100644 +--- bazel/civetweb.BUILD ++++ bazel/civetweb.BUILD +@@ -34,6 +34,7 @@ cc_library( + "-DNO_CACHING", + "-DNO_SSL", + "-DNO_FILES", ++ "-D_WIN32_WINNT=0x0502", + "-UDEBUG", + ], + includes = [ +-- diff --git a/thirdparty/patches/prometheus-windows-zlib.patch b/thirdparty/patches/prometheus-windows-zlib.patch new file mode 100644 index 000000000..0885dd8c4 --- /dev/null +++ b/thirdparty/patches/prometheus-windows-zlib.patch @@ -0,0 +1,45 @@ +From 78ac107937ee3b94f0b011f9ef0c12b912a222e7 Mon Sep 17 00:00:00 2001 +From: easy +Date: Wed, 14 Nov 2018 16:49:24 +1100 +Subject: [PATCH] Rename net_zlib_zlib to com_github_madler_zlib to match gRPC. + +diff --git README.md README.md +index be8e683..1dbc917 100644 +--- README.md ++++ README.md +@@ -139,7 +139,7 @@ you introduce the following dependencies, if they do not exist yet, to your proj + * `load_com_google_googletest()` to load `com_google_googletest` rules for Google gtest + * `load_com_google_googlebenchmark()` to load `com_github_google_benchmark` rules for Googlebenchmark + * `load_com_github_curl()` to load `com_github_curl` rules for curl +-* `load_net_zlib_zlib()` to load `net_zlib_zlib` rules for zlib ++* `load_com_github_madler_zlib()` to load `com_github_madler_zlib` rules for zlib + + The list of dependencies is also available from file `repositories.bzl`. + +diff --git pull/BUILD.bazel pull/BUILD.bazel +index 6d90c23..d35f63e 100644 +--- pull/BUILD.bazel ++++ pull/BUILD.bazel +@@ -23,6 +23,6 @@ cc_library( + deps = [ + "//core", + "@civetweb", +- "@net_zlib_zlib//:z", ++ "@com_github_madler_zlib//:z", + ], + ) +diff --git bazel/repositories.bzl bazel/repositories.bzl +index 258b73f..91398cf 100644 +--- bazel/repositories.bzl ++++ bazel/repositories.bzl +@@ -47,7 +47,8 @@ def prometheus_cpp_repositories(): + + maybe( + http_archive, +- name = "net_zlib_zlib", ++ # Named "com_github_madler_zlib" to match gRPC's import of zlib. ++ name = "com_github_madler_zlib", + sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1", + strip_prefix = "zlib-1.2.11", + urls = [ +--