Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Darwin ARM64 build (macOS/M1 support) #16621

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bazel/ray_deps_setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,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",
],
)
Expand Down Expand Up @@ -239,6 +238,8 @@ def ray_deps_setup():
patches = [
"//thirdparty/patches:grpc-cython-copts.patch",
"//thirdparty/patches:grpc-python.patch",
# The "fix-cares-build" patch is only required until the gRPC version is upgraded
"//thirdparty/patches:grpc-fix-cares-build.patch",
],
)

Expand Down
30 changes: 30 additions & 0 deletions thirdparty/patches/grpc-fix-cares-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git third_party/cares/cares.BUILD third_party/cares/cares.BUILD
--- third_party/cares/cares.BUILD
+++ third_party/cares/cares.BUILD
@@ -13,6 +13,16 @@ config_setting(
values = {"cpu": "x64_windows"},
)

+config_setting(
+ name = "darwin_arm64",
+ values = {"cpu": "darwin_arm64"},
+)
+
+config_setting(
+ name = "darwin_arm64e",
+ values = {"cpu": "darwin_arm64e"},
+)
+
# Android is not officially supported through C++.
# This just helps with the build for now.
config_setting(
@@ -98,6 +108,8 @@ genrule(
":watchos_arm64_32": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"],
":darwin": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"],
":darwin_x86_64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"],
+ ":darwin_arm64": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"],
+ ":darwin_arm64e": ["@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h"],
":windows": ["@com_github_grpc_grpc//third_party/cares:config_windows/ares_config.h"],
":android": ["@com_github_grpc_grpc//third_party/cares:config_android/ares_config.h"],
"//conditions:default": ["@com_github_grpc_grpc//third_party/cares:config_linux/ares_config.h"],
--

This file was deleted.

21 changes: 9 additions & 12 deletions thirdparty/patches/rules_boost-windows-linkopts.patch
Original file line number Diff line number Diff line change
@@ -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 = [
--