From 26b176d2366c5fae36c903fab273734be20d2f64 Mon Sep 17 00:00:00 2001 From: wangyuhang Date: Fri, 16 May 2025 16:03:24 +0800 Subject: [PATCH] supports building a debug version and some trivial modifications --- ...-g-option-to-support-building-a-debu.patch | 28 +++++++ fix-secure-compiler-options.patch | 26 ++++-- grpc-remove-ios-related-features.patch | 42 ++-------- protobuf-remove-ruby-related-features.patch | 13 +-- python-ray.spec | 82 +++++++++---------- ...dify-the-dependencies-in-bazel-build.patch | 4 +- 6 files changed, 96 insertions(+), 99 deletions(-) create mode 100644 compile-with-the-g-option-to-support-building-a-debu.patch diff --git a/compile-with-the-g-option-to-support-building-a-debu.patch b/compile-with-the-g-option-to-support-building-a-debu.patch new file mode 100644 index 0000000..e9b7df7 --- /dev/null +++ b/compile-with-the-g-option-to-support-building-a-debu.patch @@ -0,0 +1,28 @@ +From 84ce25c9a9f535e2827ca678cff31dcf15844304 Mon Sep 17 00:00:00 2001 +From: wangyuhang <524413304@qq.com> +Date: Thu, 15 May 2025 17:28:30 +0800 +Subject: [PATCH] compile with the -g option to support building a debug + version + +--- + python/setup.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/python/setup.py b/python/setup.py +index 9a871cb..64144c8 100644 +--- a/python/setup.py ++++ b/python/setup.py +@@ -622,6 +622,10 @@ def build(build_python, build_java, build_cpp): + bazel_flags.extend(["--config=asan-build"]) + if setup_spec.build_type == BuildType.TSAN: + bazel_flags.extend(["--config=tsan"]) ++ ++ bazel_flags.extend(["--copt=-g"]) ++ bazel_flags.extend(["--copt=-fdebug-prefix-map=/proc/self/cwd=" + os.getcwd().rstrip("/python")]) ++ bazel_flags.extend(["--jobs=32"]) + + return bazel_invoke( + subprocess.check_call, +-- +2.33.0 + diff --git a/fix-secure-compiler-options.patch b/fix-secure-compiler-options.patch index f5dbdc6..99f0b53 100644 --- a/fix-secure-compiler-options.patch +++ b/fix-secure-compiler-options.patch @@ -1,15 +1,16 @@ -From c832b9f929b9649226b7fb424765ad7c99592401 Mon Sep 17 00:00:00 2001 +From d49945c6debb708b4ada7f795846b4c5ec8344dc Mon Sep 17 00:00:00 2001 From: zhangyao -Date: Thu, 10 Apr 2025 17:32:00 +0800 +Date: Thu, 10 Apr 2025 21:36:12 +0800 Subject: [PATCH] fix secure compiler options --- - bazel/BUILD.redis | 5 +++++ + bazel/BUILD.redis | 1 + bazel/ray.bzl | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) + cpp/BUILD.bazel | 2 +- + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bazel/BUILD.redis b/bazel/BUILD.redis -index 68e06a7..0c88461 100644 +index 68e06a7..c8e02cb 100644 --- a/bazel/BUILD.redis +++ b/bazel/BUILD.redis @@ -28,6 +28,7 @@ make( @@ -21,7 +22,7 @@ index 68e06a7..0c88461 100644 visibility = ["//visibility:public"], lib_source = ":all_srcs", diff --git a/bazel/ray.bzl b/bazel/ray.bzl -index 107e5f4..c30804d 100644 +index 107e5f4..f98c678 100644 --- a/bazel/ray.bzl +++ b/bazel/ray.bzl @@ -23,7 +23,7 @@ COPTS_WITHOUT_LOG = select({ @@ -33,6 +34,19 @@ index 107e5f4..c30804d 100644 PYX_COPTS = select({ "//:msvc-cl": [], +diff --git a/cpp/BUILD.bazel b/cpp/BUILD.bazel +index 3fe9ae4..263ce15 100644 +--- a/cpp/BUILD.bazel ++++ b/cpp/BUILD.bazel +@@ -89,7 +89,7 @@ cc_binary( + srcs = glob([ + "src/ray/worker/default_worker.cc", + ]), +- copts = COPTS, ++ copts = COPTS + ["-fPIE"], + linkstatic = True, + deps = select({ + "@platforms//os:windows": [ -- 2.33.0 diff --git a/grpc-remove-ios-related-features.patch b/grpc-remove-ios-related-features.patch index 66886e1..98dcd2f 100644 --- a/grpc-remove-ios-related-features.patch +++ b/grpc-remove-ios-related-features.patch @@ -38,7 +38,7 @@ new file mode 100644 index 0000000..db93eb0 --- /dev/null +++ b/oe-build/patches/grpc-remove-ios-related-features.patch -@@ -0,0 +1,366 @@ +@@ -0,0 +1,334 @@ +diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl +index f4d1310..ec27f65 100644 +--- a/bazel/grpc_build_system.bzl @@ -279,7 +279,7 @@ index 0000000..db93eb0 + + licenses(["notice"]) + -+@@ -251,59 +247,6 @@ grpc_objc_testing_library( ++@@ -251,27 +247,6 @@ grpc_objc_testing_library( + ], + ) + @@ -304,41 +304,9 @@ index 0000000..db93eb0 +- ], +-) +- -+-# TODO: Enable this again once @CronetFramework is working -+-# grpc_objc_ios_unit_test( -+-# name = "CronetTests", -+-# deps = [ -+-# "CronetTests-lib", -+-# ], -+-# ) -+-# -+-# grpc_objc_ios_unit_test( -+-# name = "CppCronetTests", -+-# deps = [ -+-# "CppCronetTests-lib", -+-# ], -+-# ) -+-# -+-# grpc_objc_ios_unit_test( -+-# name = "PerfTestsPosix", -+-# deps = [ -+-# "PerfTests-lib-Posix", -+-# ], -+-# ) -+-# -+-# grpc_objc_ios_unit_test( -+-# name = "PerfTests", -+-# env = { -+-# "GRPC_CFSTREAM_RUN_LOOP": "1", -+-# }, -+-# deps = [ -+-# "PerfTests-lib", -+-# ], -+-# ) -+- -+ macos_unit_test( -+ name = "MacTests", -+ minimum_os_version = "10.10", ++ # TODO: Enable this again once @CronetFramework is working ++ # grpc_objc_ios_unit_test( ++ # name = "CronetTests", +@@ -328,11 +271,6 @@ grpc_objc_testing_library( + ], + ) diff --git a/protobuf-remove-ruby-related-features.patch b/protobuf-remove-ruby-related-features.patch index 8c51bb4..f2f26c8 100644 --- a/protobuf-remove-ruby-related-features.patch +++ b/protobuf-remove-ruby-related-features.patch @@ -48,7 +48,7 @@ new file mode 100644 index 0000000..255e287 --- /dev/null +++ b/oe-build/patches/protobuf-remove-ruby-related-features.patch -@@ -0,0 +1,58 @@ +@@ -0,0 +1,49 @@ +diff --git a/protobuf.bzl b/protobuf.bzl +index d96eeb4..5739dc5 100644 +--- a/protobuf.bzl @@ -62,7 +62,7 @@ index 0000000..255e287 + + def _GetPath(ctx, path): + if ctx.label.workspace_root: -+@@ -535,15 +535,15 @@ def internal_ruby_proto_library( ++@@ -535,15 +535,6 @@ def internal_ruby_proto_library( + deps = [] + if default_runtime: + deps.append(default_runtime) @@ -75,15 +75,6 @@ index 0000000..255e287 +- includes = includes, +- **kwargs +- ) -++# ruby_library( -++# name = name, -++# srcs = [name + "_genproto"], -++# deps = deps, -++# testonly = testonly, -++# visibility = visibility, -++# includes = includes, -++# **kwargs -++# ) + + # When canonical labels are in use, use additional "@" prefix + _canonical_label_prefix = "@" if str(Label("//:protoc")).startswith("@@") else "" diff --git a/python-ray.spec b/python-ray.spec index de78696..3bced47 100644 --- a/python-ray.spec +++ b/python-ray.spec @@ -1,8 +1,6 @@ -%define debug_package %{nil} - Name: python-ray Version: 2.42.1 -Release: 1 +Release: 2 Summary: Ray provides a simple, universal API for building distributed applications. License: Apache 2.0 URL: https://github.com/ray-project/ray @@ -25,9 +23,10 @@ BuildRequires: python3-colorama python3-wheel python3-Cython BuildRequires: javapackages-local # need by 'rpmbuild -bp flatbuffers' BuildRequires: cmake +# need by 'chrpath -d ***' BuildRequires: chrpath -Requires: python3-devel python3-msgpack python3-filelock python3-pyyaml python3-protobuf +Requires: python3-devel python3-msgpack python3-filelock python3-pyyaml python3-protobuf python3-psutil Requires: python3-jsonschema python3-packaging python3-click python3-aiosignal python3-frozenlist Requires: python3-aiohttp >= 3.9.3 @@ -39,28 +38,30 @@ Provides: libray_api.so(VERSION_1.0)(64bit) %endif Patch0001: fix-secure-compiler-options.patch -Patch0002: set-setup_requires-to-none-in-setup.py.patch -Patch0003: ray-modify-the-dependencies-in-bazel-build.patch -Patch0004: create-an-oe-build-patches-BUILD-file-to-store-patch.patch -Patch0005: ray-add-the-patch-to-adapt-flatbuffers.patch -Patch0006: rules_perl-modify-the-dependencies-in-ray-bazel-build.patch -Patch0007: modify-the-patch-directory-level-of-grpc-cython-copt.patch -Patch0008: grpc-modify-the-dependencies-in-bazel-build.patch -Patch0009: grpc-remove-ios-related-features.patch -Patch0010: grpc-add-the-patch-to-adapt-rules_go.patch -Patch0011: protobuf-modify-the-dependencies-in-bazel-build.patch -Patch0012: protobuf-remove-ruby-related-features.patch -Patch0013: rules_boost-modify-the-dependencies-in-ray-bazel-build.patch -Patch0014: rules_foreign_cc-modify-the-dependencies-in-bazel-bu.patch -Patch0015: rules_foreign_cc-add-the-patch-to-adapt-flatbuffers.patch -Patch0016: prometheus-cpp-modify-the-dependencies-in-ray-bazel-build.patch +Patch0002: compile-with-the-g-option-to-support-building-a-debu.patch +Patch0003: set-setup_requires-to-none-in-setup.py.patch +Patch0004: ray-modify-the-dependencies-in-bazel-build.patch +Patch0005: create-an-oe-build-patches-BUILD-file-to-store-patch.patch +Patch0006: ray-add-the-patch-to-adapt-flatbuffers.patch +Patch0007: rules_perl-modify-the-dependencies-in-ray-bazel-build.patch +Patch0008: modify-the-patch-directory-level-of-grpc-cython-copt.patch +Patch0009: grpc-modify-the-dependencies-in-bazel-build.patch +Patch0010: grpc-remove-ios-related-features.patch +Patch0011: grpc-add-the-patch-to-adapt-rules_go.patch +Patch0012: protobuf-modify-the-dependencies-in-bazel-build.patch +Patch0013: protobuf-remove-ruby-related-features.patch +Patch0014: rules_boost-modify-the-dependencies-in-ray-bazel-build.patch +Patch0015: rules_foreign_cc-modify-the-dependencies-in-bazel-bu.patch +Patch0016: rules_foreign_cc-add-the-patch-to-adapt-flatbuffers.patch +Patch0017: prometheus-cpp-modify-the-dependencies-in-ray-bazel-build.patch %ifarch x86_64 -Patch0017: ray-modiy-redis-quiet.patch-to-adapt-redis-x86.patch +Patch0018: ray-modiy-redis-quiet.patch-to-adapt-redis-x86.patch %endif %ifarch aarch64 -Patch0017: ray-modiy-redis-quiet.patch-to-adapt-redis-aarch64.patch +Patch0018: ray-modiy-redis-quiet.patch-to-adapt-redis-aarch64.patch %endif -Patch0018: opencensus-add-a-patch-to-adapt-prometheus_cpp.patch +Patch0019: opencensus-add-a-patch-to-adapt-prometheus_cpp.patch + %description -n python3-ray Today's ML workloads are increasingly compute-intensive. As convenient as they are, single-node development environments such as your laptop cannot scale to meet these demands. @@ -123,19 +124,19 @@ ray_deps=( "utf8_range-de0b4a8ff9b5d4c98108bdfe723291a33c52c54f" \ "xds-e9ce68804cb4e64cab5a52e3c8baf840d4ff87b7" \ "flatbuffers-2.0.0" \ - "Cython-0.29.25" \ - "hiredis-1.0.2" \ - "jemalloc-5.3.0" \ - "openssl-1.1.1wa" \ - "re2-20211101" \ - "zlib-1.2.11" \ - "make-4.3" \ - "golang-1.17.3" \ + "Cython-0.29.25" \ + "hiredis-1.0.2" \ + "jemalloc-5.3.0" \ + "openssl-1.1.1wa" \ + "re2-20211101" \ + "zlib-1.2.11" \ + "make-4.3" \ + "golang-1.17.3" \ "gflags-2.2.2" \ "msgpack-3.1.0" \ "spdlog-1.11.0" \ "nlohmann-json-3.11.2" \ - "redis-7.2.7" \ + "redis-7.2.8" \ "zstd-1.5.0" \ "xz-5.2.5" \ "bzip2-1.0.8" \ @@ -154,7 +155,7 @@ yumdownloader %{relocal_perl} mkdir -p %{pkg_name} rpm2cpio %{relocal_perl}*.rpm | cpio -div -D %{pkg_name} cp -r %{_builddir}/.ray_deps/%{relocal_perl}/%{pkg_name}/usr/bin %{_builddir}/.ray_deps/%{relocal_perl}/%{pkg_name}/ -cp -r %{_builddir}/.ray_deps/%{relocal_perl}/%{pkg_name}/usr/lib64/ %{_builddir}/.ray_deps/%{relocal_perl}/%{pkg_name}/lib +cp -r %{_builddir}/.ray_deps/%{relocal_perl}/%{pkg_name}/usr/lib64/ %{_builddir}/.ray_deps/%{relocal_perl}/%{pkg_name}/lib64 rm -rf %{_builddir}/.ray_deps/%{relocal_perl}/%{pkg_name}/etc/ %{_builddir}/.ray_deps/%{relocal_perl}/%{pkg_name}/usr/ tar -zcf /tmp/.ray_deps/%{pkg_name}.tar.gz -C %{_builddir}/.ray_deps/%{relocal_perl}/ . @@ -196,6 +197,9 @@ bazel --version cd - %install +export JAVA_HOME=/usr/lib/jvm/java-11-openjdk +cp -r $(bazel info output_base)/external . + cd python %py3_install mkdir -p %{buildroot}%{python3_sitelib} @@ -207,20 +211,9 @@ cp -a ray/ %{buildroot}%{python3_sitelib} #remove rpath chrpath -d %{buildroot}%{python3_sitelib}/ray/cpp/default_worker - mkdir -p %{buildroot}/etc/ld.so.conf.d echo "%{_libdir}" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf -strip -s %{buildroot}%{python3_sitelib}/ray/_raylet.so -strip -s %{buildroot}%{python3_sitelib}/ray/core/src/ray/thirdparty/redis/src/redis-server -strip -s %{buildroot}%{python3_sitelib}/ray/core/src/ray/thirdparty/redis/src/redis-cli -strip -s %{buildroot}%{python3_sitelib}/ray/core/src/ray/raylet/raylet -strip -s %{buildroot}%{python3_sitelib}/ray/core/src/ray/gcs/gcs_server -strip -s %{buildroot}%{python3_sitelib}/ray/core/libjemalloc.so -strip -s %{buildroot}%{python3_sitelib}/ray/cpp/default_worker -strip -s %{buildroot}%{python3_sitelib}/ray/cpp/lib/libray_api.so -strip -s %{buildroot}%{python3_sitelib}/ray/cpp/example/thirdparty/lib/libray_api.so - %clean export JAVA_HOME=/usr/lib/jvm/java-11-openjdk cd %{_builddir}/%{name}-%{version}/; bazel clean --expunge; rm -rf ~/.cache/bazel @@ -231,5 +224,8 @@ cd %{_builddir}/%{name}-%{version}/; bazel clean --expunge; rm -rf ~/.cache/baze %config(noreplace) /etc/ld.so.conf.d/* %changelog +* Thu May 15 2025 wangyuhang <524413304@qq.com> - 2.42.1-2 +- supports building a debug version and some trivial modifications + * Thu Apr 10 2025 wangyuhang <524413304@qq.com> - 2.42.1-1 - package int diff --git a/ray-modify-the-dependencies-in-bazel-build.patch b/ray-modify-the-dependencies-in-bazel-build.patch index 88ffdbf..89632e6 100644 --- a/ray-modify-the-dependencies-in-bazel-build.patch +++ b/ray-modify-the-dependencies-in-bazel-build.patch @@ -47,8 +47,8 @@ index 02fddb0..37b096e 100644 patch_args = ["-p1"], - url = "https://github.com/redis/redis/archive/refs/tags/7.2.3.tar.gz", - sha256 = "afd656dbc18a886f9a1cc08a550bf5eb89de0d431e713eba3ae243391fb008a6", -+ strip_prefix = "redis-7.2.7", -+ url = "file:///tmp/.ray_deps/redis-7.2.7.tar.gz", ++ strip_prefix = "redis-7.2.8", ++ url = "file:///tmp/.ray_deps/redis-7.2.8.tar.gz", patches = [ "@com_github_ray_project_ray//thirdparty/patches:redis-quiet.patch", ], -- Gitee