GraphiteEditor/Graphite · error

Failed to compile Windows resources

Error message

Failed to compile Windows resources

What it means

Panic in desktop/platform/win's build.rs when winresource's res.compile() fails to embed the icon and version resources into Graphite.exe. compile() locates and runs a platform resource compiler: the Windows SDK's rc under MSVC (found via the Visual Studio environment) or windres under the GNU toolchain (e.g. x86_64-w64-mingw32-windres). Failure almost always means no usable resource compiler was found on PATH or the referenced icon file is missing/corrupt.

Source

Thrown at desktop/platform/win/build.rs:30

			const MAJOR: u64 = 0;
			const MINOR: u64 = 0;
			const PATCH: u64 = 0;
			const RELEASE: u64 = 0;
			(MAJOR << 48) | (MINOR << 32) | (PATCH << 16) | RELEASE
		});
		res.set("FileVersion", "0.0.0.0");
		res.set("ProductVersion", "0.0.0.0");

		res.set("OriginalFilename", "Graphite.exe");

		res.set("FileDescription", "Graphite");
		res.set("ProductName", "Graphite");

		// TODO: Pull this year from the Git commit date
		res.set("LegalCopyright", "Copyright © 2026 Graphite Labs, LLC");
		res.set("CompanyName", "Graphite Labs, LLC");

		res.compile().expect("Failed to compile Windows resources");
	}
}

View on GitHub (pinned to c507b35645)

Solutions

  1. For the GNU target install the matching windres (Debian/Ubuntu: apt install mingw-w64; Arch: mingw-w64-gcc) and ensure it is on PATH
  2. For the MSVC target build from a VS developer prompt or run vsdevcmd so the Windows SDK resource compiler is discoverable
  3. Verify the icon file referenced by build.rs exists under branding/app-icons and is a valid .ico
  4. As a last resort, set the tool path via the WINRESOURCE/RC environment knobs supported by winresource

Example fix

// before
res.compile().expect("Failed to compile Windows resources");

// after (build.rs: degrade gracefully so builds without a resource compiler still link)
if let Err(e) = res.compile() {
	println!("cargo:warning=Failed to compile Windows resources (icon/version info not embedded): {e}");
}
Defensive patterns

Strategy: fallback

Validate before calling

// In build.rs, probe for a resource compiler before attempting to embed
fn resource_compiler_available() -> bool {
	let target = std::env::var("TARGET").unwrap_or_default();
	if target.contains("windows-gnu") {
		std::process::Command::new("x86_64-w64-mingw32-windres").arg("--version").output().is_ok()
	} else {
		true // msvc toolchains locate rc via the VS environment
	}
}

Try / catch

if let Err(e) = res.compile() {
	println!("cargo:warning=Windows resources not embedded: {e}");
	// continue the build without icon/version info
}

Prevention

When it happens

Trigger: cargo build targeting x86_64-pc-windows-gnu from Linux/macOS without mingw-w64's windres installed; building with the MSVC toolchain outside a VS developer environment so the SDK rc cannot be located; the branding .ico path referenced in build.rs not existing.

Common situations: CI cross-compilation jobs missing the mingw-w64 package; a local Rust GNU toolchain installed without windres; a broken or partial Visual Studio/Windows SDK installation; icon asset not generated before the build script runs.

Related errors


AI-assisted analysis of GraphiteEditor/Graphite@c507b35645 (2026-08-16). Data as JSON: /api/errors/2fe52ce382c8e1d8. Report an issue: GitHub.