From f599864294230a78f15c0d4d87617c2c13c54422 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 8 Jan 2026 13:05:15 +0200 Subject: [PATCH] Fail early if clangd is downloaded on aarch Linux (#46346) Part of https://github.com/zed-industries/zed/issues/46182 One caveat of this fix is that already downloaded clangd versions will error with the old, "cannot start binary" error. The new ones will be getting image though. Release Notes: - N/A --- crates/languages/src/c.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/languages/src/c.rs b/crates/languages/src/c.rs index 8fe2bae693d702346a1ecc96334d35b89d179b3b..76a0674edafd51110777346d8e95722dfd0cd4f9 100644 --- a/crates/languages/src/c.rs +++ b/crates/languages/src/c.rs @@ -27,6 +27,8 @@ impl LspInstaller for CLspAdapter { pre_release: bool, _: &mut AsyncApp, ) -> Result { + ensure_arch_compatibility()?; + let release = latest_github_release("clangd/clangd", true, pre_release, delegate.http_client()) .await?; @@ -70,6 +72,8 @@ impl LspInstaller for CLspAdapter { container_dir: PathBuf, delegate: &dyn LspAdapterDelegate, ) -> Result { + ensure_arch_compatibility()?; + let GitHubLspBinaryVersion { name, url, @@ -147,6 +151,16 @@ impl LspInstaller for CLspAdapter { } } +fn ensure_arch_compatibility() -> Result<()> { + let arch = consts::ARCH; + if consts::OS == "linux" && !["x86_64", "x86"].contains(&arch) { + anyhow::bail!( + "Clangd does not provide prebuilt binaries for {arch} to fetch from GitHub. Consider installing the binary manually." + ) + } + Ok(()) +} + #[async_trait(?Send)] impl super::LspAdapter for CLspAdapter { fn name(&self) -> LanguageServerName {