From ccc59cf55f8773391cc228f873eac601a4820c54 Mon Sep 17 00:00:00 2001 From: Kaedo17 Date: Sun, 25 Oct 2026 15:18:52 +0800 Subject: [PATCH] xtask: the ALSA probe reads PKG_CONFIG before PATH The probe ran pkg-config straight from PATH while the build's alsa-sys goes through the pkg-config crate, which reads PKG_CONFIG first: the variable may name a working pkg-config that is not on PATH, and then cargo xtask ci would report ALSA as missing over a build that finds it. The probe now selects the same executable the same way; no test stands over it because the probe needs a real pkg-config environment (the hint is split out for exactly that machine-dependence). --- xtask/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xtask/src/main.rs b/xtask/src/main.rs index e5c26cd2c..7e136baa9 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -430,9 +430,12 @@ fn audio_backend_hint(found: bool) -> Result<(), String> { /// `cargo xtask ci` builds the desktop app on the host, so on Linux it needs ALSA headers to be /// 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. #[cfg(target_os = "linux")] fn audio_backend() -> Result<(), String> { - let found = Command::new("pkg-config").args(["--exists", "alsa"]).status().map(|s| s.success()).unwrap_or(false); + 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) }