Commit b4404f6e authored by Stepan Nassyr's avatar Stepan Nassyr
Browse files

Patch Bazel/ray to no longer need ugly hack

parent 6ba5d660
......@@ -9,12 +9,13 @@ toolchain = {'name': 'GCCcore', 'version': '11.1.0'}
source_urls = ['https://github.com/bazelbuild/%(namelower)s/releases/download/%(version)s']
sources = ['%(namelower)s-%(version)s-dist.zip']
#patches = [
patches = [
# 'Bazel-3.4.1-fix-grpc-protoc.patch',
# 'Bazel-3.7.1_fix-protobuf-env.patch',
'Bazel-3.7.1_fix-protobuf-env.patch',
'Bazel-5.1.1-grpc-protoc-env.patch',
# 'Bazel-3.7.2_fix-GCC-11.patch',
# 'Bazel-3.7.2_fix-Java-15.patch',
#]
]
checksums = [
'7f5d3bc1d344692b2400f3765fd4b5c0b636eb4e7a8a7b17923095c7b56a4f78', # bazel-5.1.1-dist.zip
# 'f87ad8ad6922fd9c974381ea22b7b0e6502ccad5e532145f179b80d5599e24ac', # Bazel-3.4.1-fix-grpc-protoc.patch
......
diff --color -urN src-unpatched/distdir_deps.bzl src/distdir_deps.bzl
--- src-unpatched/distdir_deps.bzl 2022-05-06 16:20:51.705622577 +0000
+++ src/distdir_deps.bzl 2022-05-06 16:30:31.539198755 +0000
@@ -130,6 +130,7 @@
"patch_args": ["-p1"],
"patches": [
"//third_party/grpc:grpc_1.41.0.patch",
+ "//third_party/grpc:grpc-1.41.0-default-shell-env-everywhere.patch",
"//third_party/grpc:grpc_1.41.0.win_arm64.patch",
],
"used_in": [
diff --color -urN src-unpatched/third_party/grpc/BUILD src/third_party/grpc/BUILD
--- src-unpatched/third_party/grpc/BUILD 2022-05-06 16:20:51.765622947 +0000
+++ src/third_party/grpc/BUILD 2022-05-06 16:31:36.899601728 +0000
@@ -21,7 +21,8 @@
exports_files([
"grpc_1.31.1.patch",
"grpc_1.41.0.patch",
- "grpc_1.41.0.win_arm64.patch"
+ "grpc_1.41.0.win_arm64.patch",
+ "grpc-1.41.0-default-shell-env-everywhere.patch"
])
package(default_visibility = ["//visibility:public"])
diff --color -urN src-unpatched/third_party/grpc/grpc-1.41.0-default-shell-env-everywhere.patch src/third_party/grpc/grpc-1.41.0-default-shell-env-everywhere.patch
--- src-unpatched/third_party/grpc/grpc-1.41.0-default-shell-env-everywhere.patch 1970-01-01 00:00:00.000000000 +0000
+++ src/third_party/grpc/grpc-1.41.0-default-shell-env-everywhere.patch 2022-05-06 16:31:16.899478419 +0000
@@ -0,0 +1,48 @@
+diff --git a/bazel/generate_objc.bzl b/bazel/generate_objc.bzl
+index f6424b383f..8f6d2da3f9 100644
+--- a/bazel/generate_objc.bzl
++++ b/bazel/generate_objc.bzl
+@@ -96,6 +96,7 @@ def _generate_objc_impl(ctx):
+ outputs = out_files,
+ executable = ctx.executable._protoc,
+ arguments = arguments,
++ use_default_shell_env = True,
+ )
+
+ return struct(files = depset(out_files))
+diff --git a/third_party/upb/bazel/build_defs.bzl b/third_party/upb/bazel/build_defs.bzl
+index acd474d3bb..3c8e19b412 100644
+--- a/third_party/upb/bazel/build_defs.bzl
++++ b/third_party/upb/bazel/build_defs.bzl
+@@ -150,6 +150,7 @@ def _upb_amalgamation(ctx):
+ arguments = [ctx.bin_dir.path + "/", ctx.attr.prefix] + [f.path for f in srcs] + ["-I" + root for root in _get_real_roots(inputs)],
+ progress_message = "Making amalgamation",
+ executable = ctx.executable.amalgamator,
++ use_default_shell_env = True,
+ )
+ return []
+
+diff --git a/third_party/upb/bazel/upb_proto_library.bzl b/third_party/upb/bazel/upb_proto_library.bzl
+index cc02a9aa43..dafa52b01e 100644
+--- a/third_party/upb/bazel/upb_proto_library.bzl
++++ b/third_party/upb/bazel/upb_proto_library.bzl
+@@ -205,6 +205,7 @@ def _compile_upb_protos(ctx, generator, proto_info, proto_sources):
+ ] +
+ [_get_real_short_path(file) for file in proto_sources],
+ progress_message = "Generating upb protos for :" + ctx.label.name,
++ use_default_shell_env = True,
+ )
+ return GeneratedSrcsInfo(srcs = srcs, hdrs = hdrs)
+
+diff --git a/third_party/upb/upb/bindings/lua/lua_proto_library.bzl b/third_party/upb/upb/bindings/lua/lua_proto_library.bzl
+index fa20cf79f7..ff73d915c4 100644
+--- a/third_party/upb/upb/bindings/lua/lua_proto_library.bzl
++++ b/third_party/upb/upb/bindings/lua/lua_proto_library.bzl
+@@ -77,6 +77,7 @@ def _compile_upb_protos(ctx, proto_info, proto_sources):
+ ] +
+ [_get_real_short_path(file) for file in proto_sources],
+ progress_message = "Generating Lua protos for :" + ctx.label.name,
++ use_default_shell_env = True,
+ )
+ return files
+
# Author: 2022 Stepan Nassyr (Forschungszentrum Juelich)
#
# WARNING: This will fail to compile due to use of 'env -' by bazel and not propagating the
# environment to protoc calls The proper solution would be to patch Bazel or ray to
# propagate the environment, but I just did the following workaround:
#
# sudo mkdir /usr/libreplace
# sudo mkdir /usr/liborig
# (as root) cat "/usr/libreplace" >> /etc/ld.so.conf.d/raybuildlibs.conf
# module load GCC/<version>
# sudo cp $EBROOTGCC/lib64/libstdc++*so* /usr/libreplace/
# sudo cp <any other libraries it doesn't find> /usr/libreplace/
# sudo mv /usr/lib64/libstdc++*so* /usr/liborig
# sudo ldconfig
# <build ray>
# sudo mv /usr/liborig/libstdc++*so* /usr/lib64
# sudo rm /etc/ld.so.conf.d/raybuildlibs.conf
# sudo ldconfig
#
# This is obviously an ugly hack, but I can't invest more time into this right now
# Related links:
# https://github.com/bazelbuild/bazel/pull/11860
# https://github.com/grpc/grpc/pull/23664
#
easyblock = 'PythonPackage'
name = 'ray-project'
......@@ -71,6 +49,8 @@ preinstallopts += 'module unload protobuf && '
preinstallopts += 'module unload Boost && '
preinstallopts += 'cd ../../python && BAZEL_LIMIT_CPUS=$EASYBUILD_PARALLEL '
# ray installs a link to the build location, instead of installing properly, which is non-sensical as the build location gets deleted
# This reads the link and properly installs ray, ray/dashboard and ray/rllib from the location, then deletes the link
postinstallcmds = [
"""export eggdest=$(cat %(installdir)s/lib/python%(pyshortver)s/site-packages/ray.egg-link | head -n1);
cp -r $eggdest/ray* %(installdir)s/lib/python%(pyshortver)s/site-packages/;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment