Skip to content
Draft
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
1 change: 1 addition & 0 deletions docs/packages/ray.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ versions:
- filename: ray-2.58.0-cp314-cp314-manylinux_2_39_riscv64.whl
sha256: e65f089c913024ea2ac05cca674f049ad5bab1fa8e83fb3de0dcf76c11577bbf
requires-python: '>=3.10'
- version: 2.59.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Tue, 25 Aug 2026 22:30:00 +0200
Subject: [PATCH] Build with a manylinux interpreter, not a hermetic CPython 3.10

WORKSPACE calls python_register_toolchains(python_version = "3.10") and then
load()s @python3_10 at the top level, so every bazel invocation downloads a
python-build-standalone interpreter for the host platform before anything is
analysed. The rules_python version ray resolves declares no riscv64 platform,
so that load fails with

No platform declared for host OS linux on arch riscv64

Point the py310 runtime and pip_parse at the manylinux image's own CPython
3.10 instead. It has to stay 3.10 rather than follow the interpreter each
wheel is built for: the pip vendored by that rules_python imports distutils,
which 3.12 removed.

Ray 2.59.0 overrides @pypi__pip with pip 24.3.1 between the python3_10
load and pip_install_dependencies(); that override is kept as is, only the
hermetic interpreter around it is removed.

Upstream-Status: Inappropriate [riscv64 build environment; upstream's own fix would be a rules_python bump, python-build-standalone does publish riscv64 CPython now]
---
diff --git a/WORKSPACE b/WORKSPACE
index 4554595..19b0f0d 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -51,15 +51,6 @@ load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_

hedron_compile_commands_setup()

-load("@rules_python//python:repositories.bzl", "python_register_toolchains")
-
-python_register_toolchains(
- name = "python3_10",
- python_version = "3.10",
- register_toolchains = False,
-)
-
-load("@python3_10//:defs.bzl", python310 = "interpreter")
load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies")

# The pip that whl_library shells out to, overridden ahead of the one rules_python
@@ -133,7 +124,7 @@ load("@rules_python//python:pip.bzl", "pip_parse")
# For CI scripts use only; not for ray testing.
pip_parse(
name = "py_deps_py310",
- python_interpreter_target = python310,
+ python_interpreter = "/opt/python/cp310-cp310/bin/python3",
requirements_lock = "//release:requirements_py310.txt",
)

diff --git a/bazel/BUILD.bazel b/bazel/BUILD.bazel
index 9d422c1..cb3c32d 100644
--- a/bazel/BUILD.bazel
+++ b/bazel/BUILD.bazel
@@ -1,4 +1,3 @@
-load("@python3_10//:defs.bzl", python310 = "interpreter")
load("@py_deps_py310//:requirements.bzl", ci_require = "requirement")
load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_runtime", "py_runtime_pair")

@@ -72,7 +71,7 @@ config_setting(

py_runtime(
name = "py310_runtime",
- interpreter = python310,
+ interpreter_path = "/opt/python/cp310-cp310/bin/python3",
python_version = "PY3",
visibility = ["//visibility:private"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Thu, 27 Aug 2026 15:12:28 +0200
Subject: [PATCH] Build boost.context's riscv64 assembly

Boost.Context implements its stack switching primitives -- jump_fcontext,
make_fcontext, ontop_fcontext -- in hand-written assembly, one file per
(architecture, ABI, object format). rules_boost selects them in
BOOST_CTX_ASM_SOURCES, which enumerates aarch64, arm, ppc64, x86_64, the
Apple targets and Windows, and ends in "//conditions:default": [].

riscv64 hits that default, so @boost//:context is compiled with no assembly
at all. Nothing fails while building: the three symbols are simply left
undefined in _raylet.so, which links @boost//:fiber, and the failure only
appears the first time the extension is loaded --

OSError: .../ray/_raylet.so: undefined symbol: jump_fcontext

Boost has shipped libs/context/src/asm/{jump,make,ontop}_riscv64_sysv_elf_gas.S
since 1.71.0, and ray pins 1.81.0, so the sources are already present in the
archive. Add the linux_riscv64 config_setting and point the select at them,
exactly as every other ELF target does.

Carried as one more entry in ray's existing thirdparty/patches list because
rules_boost is pinned as a third-party archive; the fix itself belongs in
nelhage/rules_boost, whose master branch still has no riscv64 branch in this
select.

Upstream-Status: To upstream [the change is to nelhage/rules_boost, which ray pins by commit hash; ray itself can only carry it as a patch, and rules_boost has no riscv64 support to bump to]
---
bazel/ray_deps_setup.bzl | 1 +
.../patches/boost-riscv64-context.patch | 30 +++++++++++++++++++
2 files changed, 31 insertions(+)
create mode 100644 thirdparty/patches/boost-riscv64-context.patch

diff --git a/bazel/ray_deps_setup.bzl b/bazel/ray_deps_setup.bzl
index bbf3c84..c1d5710 100644
--- a/bazel/ray_deps_setup.bzl
+++ b/bazel/ray_deps_setup.bzl
@@ -242,6 +242,7 @@ def ray_deps_setup():
sha256 = "490d11425393eed068966a4990ead1ff07c658f823fd982fddac67006ccc44ab",
patches = [
"//thirdparty/patches:boost-headers.patch",
+ "//thirdparty/patches:boost-riscv64-context.patch",
],
patch_args = ["-p1"],
)
diff --git a/thirdparty/patches/boost-riscv64-context.patch b/thirdparty/patches/boost-riscv64-context.patch
new file mode 100644
index 0000000..bae3ec6
--- /dev/null
+++ b/thirdparty/patches/boost-riscv64-context.patch
@@ -0,0 +1,30 @@
+diff --git BUILD.boost BUILD.boost
+--- a/BUILD.boost
++++ b/BUILD.boost
+@@ -37,6 +37,14 @@ config_setting(
+ )
+
+ config_setting(
++ name = "linux_riscv64",
++ constraint_values = [
++ "@platforms//os:linux",
++ "@platforms//cpu:riscv64",
++ ],
++)
++
++config_setting(
+ name = "linux_x86_64",
+ constraint_values = [
+ "@platforms//os:linux",
+@@ -111,6 +119,11 @@ BOOST_CTX_ASM_SOURCES = selects.with_or({
+ "libs/context/src/asm/make_ppc64_sysv_elf_gas.S",
+ "libs/context/src/asm/ontop_ppc64_sysv_elf_gas.S",
+ ],
++ ":linux_riscv64": [
++ "libs/context/src/asm/jump_riscv64_sysv_elf_gas.S",
++ "libs/context/src/asm/make_riscv64_sysv_elf_gas.S",
++ "libs/context/src/asm/ontop_riscv64_sysv_elf_gas.S",
++ ],
+ ":linux_x86_64": [
+ "libs/context/src/asm/jump_x86_64_sysv_elf_gas.S",
+ "libs/context/src/asm/make_x86_64_sysv_elf_gas.S",
Loading