zed-industries/zed · error

Failed to find fxc.exe

Error message

Failed to find fxc.exe

What it means

gpui_windows compiles its HLSL shaders at build time with fxc.exe, the DirectX shader compiler shipped with the Windows SDK. The build script first tries where fxc.exe, then scans installed Windows SDKs for the newest copy, and panics if neither finds it. This is a build-environment failure: the machine compiling the crate lacks the Windows SDK shader compiler.

Source

Thrown at crates/gpui_windows/build.rs:138

            return path;
        }

        // Try to find in PATH
        // NOTE: This has to be `where.exe` on Windows, not `where`, it must be ended with `.exe`
        if let Ok(output) = std::process::Command::new("where.exe")
            .arg("fxc.exe")
            .output()
            && output.status.success()
        {
            let path = String::from_utf8_lossy(&output.stdout);
            return path.trim().to_string();
        }

        if let Ok(Some(path)) = find_latest_windows_sdk_binary("fxc.exe") {
            return path.to_string_lossy().into_owned();
        }

        panic!("Failed to find fxc.exe");
    }

    fn compile_shader_for_module(
        module: &str,
        out_dir: &str,
        fxc_path: &str,
        shader_path: &str,
        rust_binding_path: &str,
    ) {
        // Compile vertex shader
        let output_file = format!("{}/{}_vs.h", out_dir, module);
        let const_name = format!("{}_VERTEX_BYTES", module.to_uppercase());
        compile_shader_impl(
            fxc_path,
            &format!("{module}_vertex"),
            &output_file,
            &const_name,
            shader_path,

View on GitHub (pinned to f4178619ac)

Solutions

  1. Install the Windows SDK via Visual Studio Installer (included in 'Desktop development with C++') or as a standalone installer
  2. Verify fxc exists: check C:\Program Files (x86)\Windows Kits\10\Bin\<version>\x64\fxc.exe and run: where fxc.exe
  3. If the SDK is installed but not found, add its Bin directory to PATH so the where-based lookup succeeds
  4. On CI, use an image with the Windows SDK preinstalled or add an SDK install step before cargo build

Example fix

# before: only Build Tools installed
cargo build -p gpui_windows   # build.rs panics: Failed to find fxc.exe

# after: install the SDK, then rebuild
winget install Microsoft.WindowsSDK.10.0.26100 --silent
cargo build -p gpui_windows
Defensive patterns

Strategy: validation

Validate before calling

# fail fast in CI before building gpui_windows
- name: Check for fxc.exe (Windows SDK)
  shell: pwsh
  run: |
    $sdkBin = 'C:\Program Files (x86)\Windows Kits\10\Bin'
    if (-not (Get-Command fxc.exe -ErrorAction SilentlyContinue) -and -not (Test-Path $sdkBin)) {
      throw 'Windows SDK missing (fxc.exe not found) - install it before building gpui_windows'
    }

Prevention

When it happens

Trigger: Running cargo build for gpui_windows on a machine without the Windows 10/11 SDK, with VS Build Tools that skip the SDK component, or with an SDK layout the version scan cannot see (custom install root, unusual SDK version). CI images lacking the SDK fail deterministically.

Common situations: Fresh dev machine or CI runner with Visual Studio Build Tools but no 'Windows SDK' workload; minimal Windows containers used for builds; SDK installed for a different architecture or only partial toolsets.

Related errors


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/4babc19156a0a6d3. Report an issue: GitHub.