Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/build-pyroscope-io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
set -euxo pipefail

OPENSSL_VERSION=3.5.7
RUST_VERSION=1.96.0
RUST_VERSION=1.98.0

# libstdc++-static is added to upstream's list: build.rs links the C++ memalloc
# profiler statically and Rocky 10 keeps libstdc++.a out of the default install.
Expand Down
1 change: 1 addition & 0 deletions docs/packages/pyroscope-io.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ versions:
- filename: pyroscope_io-1.2.3-cp314-cp314-manylinux_2_38_riscv64.manylinux_2_39_riscv64.whl
sha256: 86065a4ba38264fa0e15b4930033988b5f73c98bce4e7ec7a4b3639d799951b9
requires-python: '>=3.10'
- version: 1.2.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From c57a63ff84704938c7609c0b380232d4d432c25d Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Fri, 18 Sep 2026 06:43:06 +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 ce22bb2..9e45d4e 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=d6fe739#d6fe739cf600d74279817d8eb0e5192b73d75d27"
dependencies = [
"anyhow",
"chrono",
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 52c429a..3fc66d4 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