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/pyroscope-io.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ versions:
- filename: pyroscope_io-1.2.4-cp314-cp314-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl
sha256: 019c654ea03a7731bf56ee3b9c31f1fd38088547f861f2da095aa8cb5aeb11b6
requires-python: '>=3.10'
- version: 1.2.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Sat, 10 Oct 2026 07:57:26 +0000
Subject: [PATCH] cargo: build py-spy from a locally patched checkout

py-spy does not compile for riscv64: pyruntime::get_tstate_current_offset
is defined once per architecture and riscv64 matches none of the arms, so
the build fails with

error[E0425]: cannot find function `get_tstate_current_offset` in module `pyruntime`

py-spy is pulled in as a git dependency pinned to a revision, so the fix
cannot be applied in place. Redirect the git source to a checkout of that
same revision carrying the one-line riscv64 addition, see
0002-python_bindings-return-no-tstate_current-offset-on-riscv64.patch.

Only the source line of the py-spy entry changes in Cargo.lock, so every
other dependency stays pinned exactly as upstream released it and the
build keeps running with --locked.

Upstream-Status: Inappropriate [redirects a pinned dependency to a local checkout; the fix itself belongs in py-spy]

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
rust/Cargo.lock | 1 -
rust/Cargo.toml | 3 +++
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index 8dcb907..2d7c807 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -1180,7 +1180,6 @@ dependencies = [
[[package]]
name = "py-spy"
version = "0.4.2"
-source = "git+https://github.com/grafana/pyroscope-py-spy?rev=e9858c0#e9858c037e796327391708f43d454ec611594ecc"
dependencies = [
"anyhow",
"chrono",
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index ae938fd..c107f29 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -32,3 +32,6 @@ cmake = "0.1"
[features]
default = []
memory = []
+
+[patch."https://github.com/grafana/pyroscope-py-spy"]
+py-spy = { path = "../py-spy" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Thu, 27 Aug 2026 00:00:00 +0000
Subject: [PATCH] python_bindings: return no tstate_current offset on riscv64

Applied to the py-spy checkout that pyroscope-python pins as a git
dependency.

pyruntime::get_tstate_current_offset has one definition per architecture
and riscv64 matches none of them, so any riscv64 build of py-spy fails to
compile:

error[E0425]: cannot find function `get_tstate_current_offset` in module `pyruntime`

Add riscv64 to the arm that returns None, the same answer powerpc, powerpc64
and mips give. The offset is only consulted for CPython 3.7 to 3.11, where
the caller already handles None by reporting an unknown offset; 3.12 and
later read the GIL through a struct offset instead.

Upstream-Status: To upstream [targets the py-spy dependency rather than pyroscope-python; not yet submitted to benfred/py-spy]

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
diff --git a/src/python_bindings/mod.rs b/src/python_bindings/mod.rs
index 772e4de..df9e4cb 100644
--- a/src/python_bindings/mod.rs
+++ b/src/python_bindings/mod.rs
@@ -195,7 +195,8 @@ pub mod pyruntime {
any(
target_arch = "powerpc64",
target_arch = "powerpc",
- target_arch = "mips"
+ target_arch = "mips",
+ target_arch = "riscv64"
)
))]
pub fn get_tstate_current_offset(version: &Version) -> Option<usize> {
Loading