From 942280627774cd19d4d2c7a6f457e60135c7ed63 Mon Sep 17 00:00:00 2001 From: "Lei, HUANG" Date: Fri, 11 Sep 2026 16:55:51 +0800 Subject: [PATCH] fix(pprof): gate framehop-unwinder to supported targets framehop-unwinder is only available on x86_64/aarch64 Linux/macOS. Enabling it unconditionally for all Unix targets breaks the build on riscv64 and other platforms: pprof disables its backtrace-rs fallback when framehop-unwinder is set, but the framehop module is not compiled on unsupported targets, leaving no TraceImpl implementation. Split the pprof dependency: the base target.'cfg(unix)' block carries the common features (flamegraph, prost-codec, protobuf), and a separate target block adds framehop-unwinder only on supported targets. Cargo unions features from both blocks on matching targets, so x86_64 and aarch64 Linux/macOS get the full feature set while other Unix targets fall back to the default backtrace-rs implementation. Addresses review comment discussion_r3987313632. Signed-off-by: Lei, HUANG --- src/common/pprof/Cargo.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/pprof/Cargo.toml b/src/common/pprof/Cargo.toml index f31bc9839f0..e3a5bce78ea 100644 --- a/src/common/pprof/Cargo.toml +++ b/src/common/pprof/Cargo.toml @@ -13,10 +13,15 @@ tokio.workspace = true [target.'cfg(unix)'.dependencies] pprof = { version = "0.15", features = [ "flamegraph", - "framehop-unwinder", "prost-codec", "protobuf", ] } +# framehop-unwinder is only available on x86_64/aarch64 Linux/macOS. +# Enabling it on other targets (e.g. riscv64) would disable the +# backtrace-rs fallback without providing a TraceImpl, breaking the build. +[target.'cfg(all(unix, any(target_arch = "x86_64", target_arch = "aarch64"), any(target_os = "linux", target_os = "macos")))'.dependencies] +pprof = { version = "0.15", features = ["framehop-unwinder"] } + [lints] workspace = true