From 89140523dc4054e70cd760c0b5db4ef23b83aff6 Mon Sep 17 00:00:00 2001 From: Psychotoxical <171614930+Psychotoxical@users.noreply.github.com> Date: Tue, 7 Jul 2026 18:55:41 +0200 Subject: [PATCH] chore(build): bind Windows cargo-test binaries to Common-Controls v6 manifest (#1257) On Windows/MSVC the test executables for `psysonic-analysis`, `psysonic-audio` and the top `psysonic` crate link the wry/tao windowing runtime (via the tauri dependency) and statically import `TaskDialogIndirect` from comctl32. That symbol only exists in Common-Controls v6; System32 comctl32.dll is v5.82 and lacks it, so an unmanifested test exe aborts at startup with STATUS_ENTRYPOINT_NOT_FOUND (0xC0000139) before any test runs. The app binary avoids this through the manifest tauri_build embeds. Declare the Common-Controls v6 dependency on the test binaries via build-script link args, gated to windows-msvc. The app binary's manifest is unchanged (byte-identical: tauri_build already embeds the same dependency, the linker dedupes). Non-Windows/CI builds are unaffected. --- src-tauri/build.rs | 17 +++++++++++++++++ src-tauri/crates/psysonic-analysis/build.rs | 19 +++++++++++++++++++ src-tauri/crates/psysonic-audio/build.rs | 19 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 src-tauri/crates/psysonic-analysis/build.rs create mode 100644 src-tauri/crates/psysonic-audio/build.rs diff --git a/src-tauri/build.rs b/src-tauri/build.rs index d860e1e6..e3740e4c 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -1,3 +1,20 @@ fn main() { + // Windows/MSVC test binaries only: bind to Common-Controls v6. + // + // The library test harness (`--lib` unittests) links the wry/tao windowing + // runtime and statically imports `TaskDialogIndirect` from comctl32, which + // exists only in Common-Controls v6 (WinSxS). The real app binary gets that + // manifest from `tauri_build`, but the separate test executable does not, so + // it aborts at startup with STATUS_ENTRYPOINT_NOT_FOUND (0xC0000139). Add the + // dependency to test targets only — never the app binary (which already has a + // manifest via tauri_build) nor non-Windows/CI builds. + let is_windows_msvc = std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") + && std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc"); + if is_windows_msvc { + println!( + "cargo::rustc-link-arg=/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'" + ); + } + tauri_build::build() } diff --git a/src-tauri/crates/psysonic-analysis/build.rs b/src-tauri/crates/psysonic-analysis/build.rs new file mode 100644 index 00000000..b2e1cdd6 --- /dev/null +++ b/src-tauri/crates/psysonic-analysis/build.rs @@ -0,0 +1,19 @@ +fn main() { + // Windows/MSVC test binaries only: bind to Common-Controls v6. + // + // The `tauri` dev-dependency pulls the wry/tao windowing runtime into this + // crate's *test* executables, which statically import `TaskDialogIndirect` + // from comctl32. That symbol lives only in Common-Controls v6 (WinSxS); the + // bare System32 comctl32.dll is v5.82 and does not export it, so an + // unmanifested test exe aborts at startup with STATUS_ENTRYPOINT_NOT_FOUND + // (0xC0000139) before any test runs. The app binary avoids this through its + // embedded manifest — mirror that here, scoped to test targets only (never + // the app, the rlib, or non-Windows/CI builds). + let is_windows_msvc = std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") + && std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc"); + if is_windows_msvc { + println!( + "cargo::rustc-link-arg=/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'" + ); + } +} diff --git a/src-tauri/crates/psysonic-audio/build.rs b/src-tauri/crates/psysonic-audio/build.rs new file mode 100644 index 00000000..b2e1cdd6 --- /dev/null +++ b/src-tauri/crates/psysonic-audio/build.rs @@ -0,0 +1,19 @@ +fn main() { + // Windows/MSVC test binaries only: bind to Common-Controls v6. + // + // The `tauri` dev-dependency pulls the wry/tao windowing runtime into this + // crate's *test* executables, which statically import `TaskDialogIndirect` + // from comctl32. That symbol lives only in Common-Controls v6 (WinSxS); the + // bare System32 comctl32.dll is v5.82 and does not export it, so an + // unmanifested test exe aborts at startup with STATUS_ENTRYPOINT_NOT_FOUND + // (0xC0000139) before any test runs. The app binary avoids this through its + // embedded manifest — mirror that here, scoped to test targets only (never + // the app, the rlib, or non-Windows/CI builds). + let is_windows_msvc = std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") + && std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc"); + if is_windows_msvc { + println!( + "cargo::rustc-link-arg=/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'" + ); + } +}