diff --git a/components/background_hang_monitor/Cargo.toml b/components/background_hang_monitor/Cargo.toml index 3470bb3f437..0aac8b38247 100644 --- a/components/background_hang_monitor/Cargo.toml +++ b/components/background_hang_monitor/Cargo.toml @@ -25,6 +25,6 @@ serde_json = { workspace = true } [target.'cfg(target_os = "macos")'.dependencies] mach2 = "0.4" -[target.'cfg(all(target_os = "linux", not(any(target_arch = "arm", target_arch = "aarch64", target_env = "ohos"))))'.dependencies] +[target.'cfg(all(target_os = "linux", not(any(target_arch = "arm", target_arch = "aarch64", target_env = "ohos", target_env = "musl"))))'.dependencies] nix = { workspace = true, features = ["signal"] } unwind-sys = "0.1.4" diff --git a/components/background_hang_monitor/background_hang_monitor.rs b/components/background_hang_monitor/background_hang_monitor.rs index c35e4f85431..cdc077a38ae 100644 --- a/components/background_hang_monitor/background_hang_monitor.rs +++ b/components/background_hang_monitor/background_hang_monitor.rs @@ -98,14 +98,24 @@ impl BackgroundHangMonitorRegister for HangMonitorRegister { let sampler = crate::sampler_mac::MacOsSampler::new_boxed(); #[cfg(all( target_os = "linux", - not(any(target_arch = "arm", target_arch = "aarch64", target_env = "ohos")), + not(any( + target_arch = "arm", + target_arch = "aarch64", + target_env = "ohos", + target_env = "musl" + )), ))] let sampler = crate::sampler_linux::LinuxSampler::new_boxed(); #[cfg(any( target_os = "android", all( target_os = "linux", - any(target_arch = "arm", target_arch = "aarch64", target_env = "ohos") + any( + target_arch = "arm", + target_arch = "aarch64", + target_env = "ohos", + target_env = "musl" + ) ) ))] let sampler = crate::sampler::DummySampler::new_boxed(); diff --git a/components/background_hang_monitor/lib.rs b/components/background_hang_monitor/lib.rs index 1db9391a675..0ea56ccbc96 100644 --- a/components/background_hang_monitor/lib.rs +++ b/components/background_hang_monitor/lib.rs @@ -8,7 +8,12 @@ pub mod background_hang_monitor; mod sampler; #[cfg(all( target_os = "linux", - not(any(target_arch = "arm", target_arch = "aarch64", target_env = "ohos")) + not(any( + target_arch = "arm", + target_arch = "aarch64", + target_env = "ohos", + target_env = "musl" + )) ))] mod sampler_linux; #[cfg(target_os = "macos")]