{"record":{"id":"2fe52ce382c8e1d8","repo":"GraphiteEditor/Graphite","slug":"failed-to-compile-windows-resources","errorCode":null,"errorMessage":"Failed to compile Windows resources","messagePattern":"Failed to compile Windows resources","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"desktop/platform/win/build.rs","lineNumber":30,"sourceCode":"\t\t\tconst MAJOR: u64 = 0;\n\t\t\tconst MINOR: u64 = 0;\n\t\t\tconst PATCH: u64 = 0;\n\t\t\tconst RELEASE: u64 = 0;\n\t\t\t(MAJOR << 48) | (MINOR << 32) | (PATCH << 16) | RELEASE\n\t\t});\n\t\tres.set(\"FileVersion\", \"0.0.0.0\");\n\t\tres.set(\"ProductVersion\", \"0.0.0.0\");\n\n\t\tres.set(\"OriginalFilename\", \"Graphite.exe\");\n\n\t\tres.set(\"FileDescription\", \"Graphite\");\n\t\tres.set(\"ProductName\", \"Graphite\");\n\n\t\t// TODO: Pull this year from the Git commit date\n\t\tres.set(\"LegalCopyright\", \"Copyright © 2026 Graphite Labs, LLC\");\n\t\tres.set(\"CompanyName\", \"Graphite Labs, LLC\");\n\n\t\tres.compile().expect(\"Failed to compile Windows resources\");\n\t}\n}\n","sourceCodeStart":12,"sourceCodeEnd":33,"githubUrl":"https://github.com/GraphiteEditor/Graphite/blob/c507b356453361e31638b8bff8f6d46b6da2961e/desktop/platform/win/build.rs#L12-L33","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["For the GNU target install the matching windres (Debian/Ubuntu: apt install mingw-w64; Arch: mingw-w64-gcc) and ensure it is on PATH","For the MSVC target build from a VS developer prompt or run vsdevcmd so the Windows SDK resource compiler is discoverable","Verify the icon file referenced by build.rs exists under branding/app-icons and is a valid .ico","As a last resort, set the tool path via the WINRESOURCE/RC environment knobs supported by winresource"],"exampleFix":"// before\nres.compile().expect(\"Failed to compile Windows resources\");\n\n// after (build.rs: degrade gracefully so builds without a resource compiler still link)\nif let Err(e) = res.compile() {\n\tprintln!(\"cargo:warning=Failed to compile Windows resources (icon/version info not embedded): {e}\");\n}","handlingStrategy":"fallback","validationCode":"// In build.rs, probe for a resource compiler before attempting to embed\nfn resource_compiler_available() -> bool {\n\tlet target = std::env::var(\"TARGET\").unwrap_or_default();\n\tif target.contains(\"windows-gnu\") {\n\t\tstd::process::Command::new(\"x86_64-w64-mingw32-windres\").arg(\"--version\").output().is_ok()\n\t} else {\n\t\ttrue // msvc toolchains locate rc via the VS environment\n\t}\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = res.compile() {\n\tprintln!(\"cargo:warning=Windows resources not embedded: {e}\");\n\t// continue the build without icon/version info\n}","preventionTips":["Install mingw-w64 (provides windres) before cross-compiling GNU Windows targets","Build MSVC targets from a VS developer prompt so the SDK resource compiler is discoverable","Cache the compiler-availability check so builds degrade to a warning instead of failing"],"tags":["rust","windows","build-script","winresource","cross-compilation"],"backgroundTag":"missing-build-tool","analyzedSha":"c507b356453361e31638b8bff8f6d46b6da2961e","analyzedAt":"2026-08-16T21:57:18.596Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}