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

Update build rules and patches for darwin_arm64 platform. #19037

Merged
merged 13 commits into from
Oct 10, 2021
Merged
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
9 changes: 4 additions & 5 deletions bazel/ray_deps_setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ def ray_deps_setup():
# declaring it here allows us to avoid patching the latter.
name = "boost",
build_file = "@com_github_nelhage_rules_boost//:BUILD.boost",
sha256 = "d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee",
url = "https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2",
sha256 = "83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1",
url = "https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2",
patches = [
"//thirdparty/patches:boost-exception-no_warn_typeid_evaluated.patch",
],
Expand All @@ -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",
],
)
Expand Down
1 change: 1 addition & 0 deletions cpp/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ genrule(
mkdir -p "$$PY_CPP_DIR/lib/" &&
cp -f -r $$WORK_DIR/external/msgpack/include/* "$$PY_CPP_DIR/include" &&
cp -f -r "$$WORK_DIR/external/boost/boost/archive" "$$BOOST_DIR" &&
cp -f -r "$$WORK_DIR/external/boost/boost/assert" "$$BOOST_DIR" &&
cp -f -r "$$WORK_DIR/external/boost/boost/bind" "$$BOOST_DIR" &&
cp -f -r "$$WORK_DIR/external/boost/boost/callable_traits" "$$BOOST_DIR" &&
cp -f -r "$$WORK_DIR/external/boost/boost/concept" "$$BOOST_DIR" &&
Expand Down
2 changes: 1 addition & 1 deletion src/ray/common/client_connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <boost/asio/placeholders.hpp>
#include <boost/asio/read.hpp>
#include <boost/asio/write.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <chrono>
#include <sstream>
#include <thread>
Expand Down
2 changes: 1 addition & 1 deletion src/ray/common/network_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <boost/asio.hpp>
#include <boost/asio/deadline_timer.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/system/error_code.hpp>
#include <string>
Expand Down
2 changes: 0 additions & 2 deletions src/ray/core_worker/reference_count.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#pragma once

#include <boost/bind.hpp>

#include "absl/base/thread_annotations.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
Expand Down
3 changes: 2 additions & 1 deletion src/ray/core_worker/reference_count_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <vector>

#include "absl/functional/bind_front.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "ray/common/asio/instrumented_io_context.h"
Expand Down Expand Up @@ -269,7 +270,7 @@ class MockWorkerClient : public MockCoreWorkerClientInterface {

auto borrower_callback = [=]() {
auto ref_removed_callback =
boost::bind(&ReferenceCounter::HandleRefRemoved, &rc_, _1);
absl::bind_front(&ReferenceCounter::HandleRefRemoved, &rc_);
rc_.SetRefRemovedCallback(object_id, contained_in_id, owner_address,
ref_removed_callback);
};
Expand Down
2 changes: 1 addition & 1 deletion src/ray/core_worker/test/core_worker_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <boost/asio.hpp>
#include <boost/asio/error.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <thread>

#include "absl/container/flat_hash_map.h"
Expand Down
2 changes: 1 addition & 1 deletion src/ray/gcs/asio.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include <boost/asio.hpp>
#include <boost/asio/error.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <iostream>
#include <string>

Expand Down
2 changes: 1 addition & 1 deletion src/ray/gcs/redis_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#pragma once

#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <functional>
#include <memory>
#include <mutex>
Expand Down
2 changes: 1 addition & 1 deletion src/ray/object_manager/object_buffer_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <boost/asio.hpp>
#include <boost/asio/error.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <list>
#include <memory>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion src/ray/object_manager/object_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <algorithm>
#include <boost/asio.hpp>
#include <boost/asio/error.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <cstdint>
#include <deque>
#include <map>
Expand Down
7 changes: 5 additions & 2 deletions src/ray/object_manager/plasma/store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <stdlib.h>
#include <string.h>

#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <chrono>
#include <ctime>
#include <deque>
Expand All @@ -53,6 +53,7 @@
#include "ray/object_manager/plasma/protocol.h"
#include "ray/util/util.h"

namespace ph = boost::placeholders;
namespace fb = plasma::flatbuf;

namespace plasma {
Expand Down Expand Up @@ -297,7 +298,9 @@ void PlasmaStore::ConnectClient(const boost::system::error_code &error) {
if (!error) {
// Accept a new local client and dispatch it to the node manager.
auto new_connection = Client::Create(
boost::bind(&PlasmaStore::ProcessMessage, this, _1, _2, _3), std::move(socket_));
// NOLINTNEXTLINE : handler must be of boost::AcceptHandler type.
boost::bind(&PlasmaStore::ProcessMessage, this, ph::_1, ph::_2, ph::_3),
std::move(socket_));
}
// We're ready to accept another client.
DoAccept();
Expand Down
2 changes: 1 addition & 1 deletion src/ray/object_manager/pull_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <boost/asio.hpp>
#include <boost/asio/error.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <map>

#include "absl/container/flat_hash_map.h"
Expand Down
2 changes: 1 addition & 1 deletion src/ray/raylet/raylet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "ray/raylet/raylet.h"

#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion src/ray/raylet/worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "ray/raylet/worker.h"

#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>

#include "ray/raylet/format/node_manager_generated.h"
#include "ray/raylet/raylet.h"
Expand Down
2 changes: 1 addition & 1 deletion streaming/src/queue/queue_handler.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/thread.hpp>
#include <thread>

Expand Down
37 changes: 33 additions & 4 deletions thirdparty/patches/prometheus-windows-pollfd.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
--

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 = [
--