From 29e35794e19b9c832197cfdc485b372d181c7bd9 Mon Sep 17 00:00:00 2001 From: Kaedo17 Date: Sun, 25 Oct 2026 15:54:14 +0800 Subject: [PATCH] xtask: a pkg-config that will not launch is not 'ALSA missing' The probe's spawn failure (a PKG_CONFIG that names nothing runnable, or pkg-config absent from PATH) reported the ALSA-missing hint, sending the reader off to install alsa-lib they may well have: a failed launch now reports itself, naming the executable and pointing at installing pkg-config or correcting PKG_CONFIG, while a probe that runs and exits non-zero still gets the ALSA guidance. --- xtask/src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 7e136baa9..47d40597f 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -432,11 +432,17 @@ fn audio_backend_hint(found: bool) -> Result<(), String> { /// present. Checking here turns a late, confusing link error into one line naming the package. /// The probe reads `PKG_CONFIG` first, like the pkg-config crate alsa-sys goes through: the /// variable may name a working pkg-config that is not on `PATH`, and the build would use it too. +/// A probe that could not launch is not "ALSA missing" — it reports the launch failure separately. #[cfg(target_os = "linux")] fn audio_backend() -> Result<(), String> { let program = std::env::var_os("PKG_CONFIG").unwrap_or_else(|| "pkg-config".into()); - let found = Command::new(program).args(["--exists", "alsa"]).status().map(|s| s.success()).unwrap_or(false); - audio_backend_hint(found) + match Command::new(&program).args(["--exists", "alsa"]).status() { + Ok(status) => audio_backend_hint(status.success()), + Err(e) => Err(format!( + "The {} executable could not be run: {e}. Install pkg-config, or point PKG_CONFIG at a working one — it is the same executable alsa-sys's pkg-config dependency asks.", + std::path::Path::new(&program).display() + )), + } } #[cfg(not(target_os = "linux"))]