mirror of
https://github.com/wassname/ray.git
synced 2026-08-11 05:51:40 +08:00
Update various build options relating to Windows (#6315)
* Update .bazelrc for Windows compatibility * Block inclusion of (legacy) WinSock.h to avoid errors * Suppress warnings for Windows code * Include boost::asio in includes so that it is passed as -isystem to avoid warnings * Link with -lpthread only on non-Windows * Undefine BOOST_FALLTHROUGH, which is unnecessary and causes macro redefinition warnings * Define RAY_STATIC and ARROW_STATIC to compile for Windows * Add WinSock import library for Arrow
This commit is contained in:
@@ -9,17 +9,20 @@ build --action_env=PYTHON3_BIN_PATH
|
||||
build --action_env=USE_CLANG_CL=1
|
||||
# Enable build:windows, build:linux, build:macos, build:freebsd
|
||||
build --enable_platform_specific_config
|
||||
# TODO(mehrdadn): Revert the "-\\.(asm|S)$" exclusion when this Bazel bug
|
||||
# for compiling assembly files is fixed on Windows:
|
||||
# https://github.com/bazelbuild/bazel/issues/8924
|
||||
# Warnings should be errors
|
||||
build --per_file_copt=-.*/arrow/util/logging.cc@-Werror
|
||||
build --per_file_copt="-\\.(asm|S)$,-.*/arrow/util/logging\\.cc@-Werror"
|
||||
# Ignore warnings for protobuf generated files and external projects.
|
||||
build --per_file_copt='\\.pb\\.cc$@-w'
|
||||
build --per_file_copt='external/.*@-w'
|
||||
build --per_file_copt="-\\.(asm|S)$,\\.pb\\.cc$@-w"
|
||||
build --per_file_copt="-\\.(asm|S)$,external/.*@-w"
|
||||
# Ignore minor warnings for host tools, which we generally can't control
|
||||
build --host_copt="-Wno-builtin-macro-redefined"
|
||||
build --host_copt="-Wno-inconsistent-missing-override"
|
||||
build --host_copt="-Wno-microsoft-unqualified-friend"
|
||||
# This workaround is needed due to https://github.com/bazelbuild/bazel/issues/4341
|
||||
build --per_file_copt="external/com_github_grpc_grpc/.*@-DGRPC_BAZEL_BUILD"
|
||||
build --per_file_copt="-\\.(asm|S)$,external/com_github_grpc_grpc/.*@-DGRPC_BAZEL_BUILD"
|
||||
build --http_timeout_scaling=5.0
|
||||
# This workaround is due to an incompatibility of
|
||||
# bazel_common/tools/maven/pom_file.bzl with Bazel 1.0
|
||||
|
||||
+27
-3
@@ -8,10 +8,15 @@ load("@com_github_grpc_grpc//bazel:cython_library.bzl", "pyx_library")
|
||||
load("@rules_proto_grpc//python:defs.bzl", "python_grpc_compile")
|
||||
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
|
||||
|
||||
# TODO(mehrdadn): (How to) support dynamic linking?
|
||||
PROPAGATED_WINDOWS_DEFINES = ["RAY_STATIC"]
|
||||
|
||||
COPTS = ["-DRAY_USE_GLOG"] + select({
|
||||
"@bazel_tools//src/conditions:windows": [
|
||||
"-DWIN32_LEAN_AND_MEAN=", # Block the inclusion of WinSock.h, which is obsolete and causes errors
|
||||
"-Wno-builtin-macro-redefined", # To get rid of warnings caused by deterministic build macros (e.g. #define __DATE__ "redacted")
|
||||
],
|
||||
"-Wno-microsoft-unqualified-friend", # This shouldn't normally be enabled, but otherwise we get: google/protobuf/map_field.h: warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier (for: friend class DynamicMessage)
|
||||
] + ["-D" + define for define in PROPAGATED_WINDOWS_DEFINES],
|
||||
"//conditions:default": [
|
||||
],
|
||||
})
|
||||
@@ -211,6 +216,9 @@ cc_library(
|
||||
],
|
||||
),
|
||||
copts = COPTS,
|
||||
includes = [
|
||||
"@boost//:asio",
|
||||
],
|
||||
deps = [
|
||||
":common_cc_proto",
|
||||
":gcs_cc_proto",
|
||||
@@ -270,7 +278,13 @@ cc_library(
|
||||
includes = [
|
||||
"src",
|
||||
],
|
||||
linkopts = ["-pthread"],
|
||||
linkopts = select({
|
||||
"@bazel_tools//src/conditions:windows": [
|
||||
],
|
||||
"//conditions:default": [
|
||||
"-lpthread",
|
||||
],
|
||||
}),
|
||||
deps = [
|
||||
":ray_util",
|
||||
"@com_github_jupp0r_prometheus_cpp//pull",
|
||||
@@ -302,7 +316,17 @@ cc_library(
|
||||
"src/ray/raylet/*.h",
|
||||
]),
|
||||
copts = COPTS,
|
||||
linkopts = ["-pthread"],
|
||||
defines = select({
|
||||
"@bazel_tools//src/conditions:windows": PROPAGATED_WINDOWS_DEFINES,
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
linkopts = select({
|
||||
"@bazel_tools//src/conditions:windows": [
|
||||
],
|
||||
"//conditions:default": [
|
||||
"-lpthread",
|
||||
],
|
||||
}),
|
||||
deps = [
|
||||
":common_cc_proto",
|
||||
":gcs",
|
||||
|
||||
+19
-1
@@ -1,13 +1,24 @@
|
||||
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
|
||||
|
||||
# TODO(mehrdadn): (How to) support dynamic linking?
|
||||
PROPAGATED_WINDOWS_DEFINES = ["ARROW_STATIC"]
|
||||
|
||||
COPTS = [] + select({
|
||||
"@bazel_tools//src/conditions:windows": [
|
||||
],
|
||||
] + ["-D" + define for define in PROPAGATED_WINDOWS_DEFINES],
|
||||
"//conditions:default": [
|
||||
"-DARROW_USE_GLOG",
|
||||
],
|
||||
})
|
||||
|
||||
LINKOPTS = [] + select({
|
||||
"@bazel_tools//src/conditions:windows": [
|
||||
"-DefaultLib:" + "ws2_32.lib",
|
||||
],
|
||||
"//conditions:default": [
|
||||
],
|
||||
})
|
||||
|
||||
cc_library(
|
||||
name = "arrow",
|
||||
srcs = [
|
||||
@@ -60,6 +71,7 @@ cc_library(
|
||||
"cpp/src/arrow/vendored/xxhash/xxhash.h",
|
||||
],
|
||||
copts = COPTS,
|
||||
linkopts = LINKOPTS,
|
||||
strip_include_prefix = "cpp/src",
|
||||
deps = [
|
||||
"@boost//:filesystem",
|
||||
@@ -92,6 +104,11 @@ cc_library(
|
||||
"cpp/src/plasma/protocol.h",
|
||||
],
|
||||
copts = COPTS,
|
||||
defines = select({
|
||||
"@bazel_tools//src/conditions:windows": PROPAGATED_WINDOWS_DEFINES,
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
linkopts = LINKOPTS,
|
||||
strip_include_prefix = "cpp/src",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
@@ -173,6 +190,7 @@ cc_library(
|
||||
"cpp/src/plasma/thirdparty/dlmalloc.c",
|
||||
],
|
||||
copts = COPTS,
|
||||
linkopts = LINKOPTS,
|
||||
strip_include_prefix = "cpp/src",
|
||||
deps = [
|
||||
":plasma_client",
|
||||
|
||||
@@ -111,6 +111,7 @@ def ray_deps_setup():
|
||||
strip_prefix = "boost_1_68_0",
|
||||
url = "https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz",
|
||||
patches = [
|
||||
"//thirdparty/patches:boost-exception-no_warn_typeid_evaluated.patch",
|
||||
# Backport Clang-Cl patch on Boost 1.69 to Boost <= 1.68:
|
||||
# https://lists.boost.org/Archives/boost/2018/09/243420.php
|
||||
"//thirdparty/patches:boost-type_traits-trivial_move.patch",
|
||||
@@ -123,6 +124,9 @@ def ray_deps_setup():
|
||||
commit = "df908358c605a7d5b8bbacde07afbaede5ac12cf",
|
||||
remote = "https://github.com/nelhage/rules_boost",
|
||||
sha256 = "3775c5ab217e0c9cc380f56e243a4d75fe6fee8eaee1447899eaa04c5d582cf1",
|
||||
patches = [
|
||||
"//thirdparty/patches:rules_boost-undefine-boost_fallthrough.patch",
|
||||
],
|
||||
)
|
||||
|
||||
github_repository(
|
||||
|
||||
@@ -189,7 +189,7 @@ class ObjectManager : public ObjectManagerInterface,
|
||||
///
|
||||
/// \param object_id The object's object id.
|
||||
/// \return Status of whether the pull request successfully initiated.
|
||||
ray::Status Pull(const ObjectID &object_id);
|
||||
ray::Status Pull(const ObjectID &object_id) override;
|
||||
|
||||
/// Try to Pull an object from one of its expected client locations. If there
|
||||
/// are more client locations to try after this attempt, then this method
|
||||
@@ -207,7 +207,7 @@ class ObjectManager : public ObjectManagerInterface,
|
||||
///
|
||||
/// \param object_id The ObjectID.
|
||||
/// \return Void.
|
||||
void CancelPull(const ObjectID &object_id);
|
||||
void CancelPull(const ObjectID &object_id) override;
|
||||
|
||||
/// Callback definition for wait.
|
||||
using WaitCallback = std::function<void(const std::vector<ray::ObjectID> &found,
|
||||
|
||||
@@ -157,7 +157,7 @@ class CoreWorkerClient : public std::enable_shared_from_this<CoreWorkerClient>,
|
||||
|
||||
virtual ray::Status GetObjectStatus(
|
||||
const GetObjectStatusRequest &request,
|
||||
const ClientCallback<GetObjectStatusReply> &callback) {
|
||||
const ClientCallback<GetObjectStatusReply> &callback) override {
|
||||
auto call = client_call_manager_.CreateCall<CoreWorkerService, GetObjectStatusRequest,
|
||||
GetObjectStatusReply>(
|
||||
*stub_, &CoreWorkerService::Stub::PrepareAsyncGetObjectStatus, request, callback);
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
#pragma GCC diagnostic ignored "-Wattributes"
|
||||
#endif
|
||||
|
||||
#ifdef RAY_EXPORTING
|
||||
#ifdef RAY_STATIC
|
||||
#define RAY_EXPORT
|
||||
#elif defined(RAY_EXPORTING)
|
||||
#define RAY_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define RAY_EXPORT __declspec(dllimport)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
diff --git boost/exception/info.hpp boost/exception/info.hpp
|
||||
index f7ac50e..9a18650 100644
|
||||
--- boost/exception/info.hpp
|
||||
+++ boost/exception/info.hpp
|
||||
@@ -84,3 +84,4 @@ boost
|
||||
#ifndef BOOST_NO_RTTI
|
||||
- BOOST_ASSERT( *BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==*ti.type_ );
|
||||
+ error_info_base &target = *p; (void)target; // Avoid -Wpotentially-evaluated-expression
|
||||
+ BOOST_ASSERT( *BOOST_EXCEPTION_DYNAMIC_TYPEID(target).type_==*ti.type_ );
|
||||
#endif
|
||||
--
|
||||
@@ -0,0 +1,9 @@
|
||||
diff --git BUILD.boost BUILD.boost
|
||||
index 104c726..108e778 100644
|
||||
--- BUILD.boost
|
||||
+++ BUILD.boost
|
||||
@@ -1356,3 +1356,2 @@ boost_library(
|
||||
defines = [
|
||||
- "BOOST_FALLTHROUGH",
|
||||
],
|
||||
--
|
||||
Reference in New Issue
Block a user