From 7ff4a8213c2c25141cd19cfbb7782632e9305f0e Mon Sep 17 00:00:00 2001 From: Jun Gong Date: Mon, 13 Sep 2021 23:52:15 -0700 Subject: [PATCH] Fix Ray arm64 build for Mac M1. --- bazel/ray_deps_setup.bzl | 5 +-- .../patches/prometheus-windows-pollfd.patch | 37 +++++++++++++++++-- ...les_boost-undefine-boost_fallthrough.patch | 8 ---- .../rules_boost-windows-linkopts.patch | 21 +++++------ 4 files changed, 44 insertions(+), 27 deletions(-) delete mode 100644 thirdparty/patches/rules_boost-undefine-boost_fallthrough.patch diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl index 1925aedfa4ed..b4226adb1134 100644 --- a/bazel/ray_deps_setup.bzl +++ b/bazel/ray_deps_setup.bzl @@ -161,10 +161,9 @@ def ray_deps_setup(): auto_http_archive( name = "com_github_nelhage_rules_boost", # If you update the Boost version, remember to update the 'boost' rule. - url = "https://github.com/nelhage/rules_boost/archive/2613d04ab3d22dfc4543ea0a083d9adeaa0daf09.tar.gz", - sha256 = "512f913240e026099d4ca4a98b1ce8048c99de77fdc8e8584e9e2539ee119ca2", + url = "https://github.com/nelhage/rules_boost/archive/652b21e35e4eeed5579e696da0facbe8dba52b1f.tar.gz", + sha256 = "c1b8b2adc3b4201683cf94dda7eef3fc0f4f4c0ea5caa3ed3feffe07e1fb5b15", patches = [ - "//thirdparty/patches:rules_boost-undefine-boost_fallthrough.patch", "//thirdparty/patches:rules_boost-windows-linkopts.patch", ], ) diff --git a/thirdparty/patches/prometheus-windows-pollfd.patch b/thirdparty/patches/prometheus-windows-pollfd.patch index 1941b6cb247c..3b30942bb85f 100644 --- a/thirdparty/patches/prometheus-windows-pollfd.patch +++ b/thirdparty/patches/prometheus-windows-pollfd.patch @@ -6,17 +6,46 @@ Windows Vista and later SDKs define struct pollfd for WSAPoll(), but it has a pe 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(+) + bazel/civetweb.BUILD | 7 +++++++ + 1 file changed, 7 insertions(+) diff --git bazel/civetweb.BUILD bazel/civetweb.BUILD --- bazel/civetweb.BUILD +++ bazel/civetweb.BUILD -@@ -34,5 +34,6 @@ cc_library( +@@ -9,6 +9,11 @@ config_setting( + values = {"cpu": "darwin_x86_64"}, + ) + ++config_setting( ++ name = "darwin_arm64", ++ values = {"cpu": "darwin_arm64"}, ++) ++ + config_setting( + name = "windows", + values = { "cpu": "x64_windows" }, +@@ -34,6 +39,7 @@ cc_library( "-DNO_CACHING", "-DNO_SSL", "-DNO_FILES", + "-D_WIN32_WINNT=0x0502", "-UDEBUG", ], --- + includes = [ +@@ -46,6 +52,7 @@ cc_library( + }) + select({ + ":darwin": [], + ":darwin_x86_64": [], ++ ":darwin_arm64": [], + ":windows": [], + ":windows_msvc": [], + "//conditions:default": ["-lrt"], +@@ -86,6 +93,7 @@ cc_library( + }) + select({ + ":darwin": [], + ":darwin_x86_64": [], ++ ":darwin_arm64": [], + ":windows": [], + ":windows_msvc": [], + "//conditions:default": ["-lrt"], +-- diff --git a/thirdparty/patches/rules_boost-undefine-boost_fallthrough.patch b/thirdparty/patches/rules_boost-undefine-boost_fallthrough.patch deleted file mode 100644 index 9cd53fe60f84..000000000000 --- a/thirdparty/patches/rules_boost-undefine-boost_fallthrough.patch +++ /dev/null @@ -1,8 +0,0 @@ -diff --git BUILD.boost BUILD.boost ---- BUILD.boost -+++ BUILD.boost -@@ -1356,3 +1356,2 @@ boost_library( - defines = [ -- "BOOST_FALLTHROUGH", - ], --- diff --git a/thirdparty/patches/rules_boost-windows-linkopts.patch b/thirdparty/patches/rules_boost-windows-linkopts.patch index 28bda4eb0693..204443d3c718 100644 --- a/thirdparty/patches/rules_boost-windows-linkopts.patch +++ b/thirdparty/patches/rules_boost-windows-linkopts.patch @@ -1,15 +1,12 @@ diff --git BUILD.boost BUILD.boost --- BUILD.boost +++ BUILD.boost -@@ -313,1 +313,9 @@ boost_library(name = "asio", -- linkopts = ["-lpthread"], -+ linkopts = select({ -+ ":linux": [ -+ "-lpthread", -+ ], -+ ":osx_x86_64": [ -+ "-lpthread", -+ ], -+ "//conditions:default": [], -+ }), --- +@@ -428,6 +428,7 @@ boost_library( + }), + linkopts = select({ + ":android": [], ++ ":windows": [], + "//conditions:default": ["-lpthread"], + }), + deps = [ +--