From 9911b6ec40d79a0f8014b7bbbbcf6e4f977cb496 Mon Sep 17 00:00:00 2001 From: Bossiara13 <236771060+DmitryBykov-ISPO@users.noreply.github.com> Date: Fri, 15 May 2026 13:26:00 +0300 Subject: [PATCH] fix(app): embed Common-Controls v6 manifest so TaskDialogIndirect resolves MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Symptom: jarvis-app.exe failed to start with a MessageBox saying "Точка входа в процедуру TaskDialogIndirect не найдена в библиотеке DLL ... jarvis-app.exe". Loader phase, no log lines ever written. Cause: tray-icon 0.21 / winit 0.30 transitive Win32 imports include TaskDialogIndirect from comctl32.dll, which is a Common-Controls v6 API. Without a side-by-side manifest declaring a dependency on Microsoft.Windows.Common-Controls v6.0.0.0, Windows loads the legacy v5 comctl32 (which does not export TaskDialogIndirect) and the loader rejects the exe before main(). jarvis-gui does not hit this because tauri-build embeds its own manifest as part of the Tauri compile step. jarvis-app had no manifest at all. Fix: - app.manifest: Common-Controls v6 dependency, supportedOS for Win7..Win11, PerMonitorV2 DPI awareness, UTF-8 active code page, asInvoker execution level. - app.manifest.rc: 3-line .rc that embeds the manifest with CREATEPROCESS_MANIFEST_RESOURCE_ID (1) and RT_MANIFEST (24). - build.rs: on cfg(windows), embed_resource::compile() compiles the .rc and links the resulting .res into the exe. rerun-if-changed on the manifest sources. - Cargo.toml: target-windows build-dependency on embed-resource 3. Verified: jarvis-app.exe now runs cleanly through all init steps: commands parsed, audio init, recorder init found "Микрофон (5- Fifine Microphone)", IPC server up on ws://127.0.0.1:9712, VAD already flushing frames. UTF-8 active code page in the manifest also helps russian-character fidelity when win32 APIs are invoked from PowerShell helpers. --- Cargo.lock | 1 + crates/jarvis-app/Cargo.toml | 5 ++- crates/jarvis-app/app.manifest | 60 +++++++++++++++++++++++++++++++ crates/jarvis-app/app.manifest.rc | 4 +++ crates/jarvis-app/build.rs | 16 ++++++--- 5 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 crates/jarvis-app/app.manifest create mode 100644 crates/jarvis-app/app.manifest.rc diff --git a/Cargo.lock b/Cargo.lock index a8f8b66..588ec6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3271,6 +3271,7 @@ name = "jarvis-app" version = "0.1.0" dependencies = [ "dotenvy", + "embed-resource", "glib 0.21.5", "gtk", "image", diff --git a/crates/jarvis-app/Cargo.toml b/crates/jarvis-app/Cargo.toml index 2e47394..3a1a89c 100644 --- a/crates/jarvis-app/Cargo.toml +++ b/crates/jarvis-app/Cargo.toml @@ -31,4 +31,7 @@ winrt-notification.workspace = true [target.'cfg(target_os = "linux")'.dependencies] gtk = "0.18" -glib = "0.21.5" \ No newline at end of file +glib = "0.21.5" + +[target.'cfg(target_os = "windows")'.build-dependencies] +embed-resource = "3" \ No newline at end of file diff --git a/crates/jarvis-app/app.manifest b/crates/jarvis-app/app.manifest new file mode 100644 index 0000000..de8adb1 --- /dev/null +++ b/crates/jarvis-app/app.manifest @@ -0,0 +1,60 @@ + + + + J.A.R.V.I.S. voice assistant daemon + + + + + + + + + + + + + + + + + + + + + + + + + true/pm + PerMonitorV2,PerMonitor + UTF-8 + + + + + + + + + + + diff --git a/crates/jarvis-app/app.manifest.rc b/crates/jarvis-app/app.manifest.rc new file mode 100644 index 0000000..bbb1850 --- /dev/null +++ b/crates/jarvis-app/app.manifest.rc @@ -0,0 +1,4 @@ +#define RT_MANIFEST 24 +#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "app.manifest" diff --git a/crates/jarvis-app/build.rs b/crates/jarvis-app/build.rs index 30a6d3f..e7a70a7 100644 --- a/crates/jarvis-app/build.rs +++ b/crates/jarvis-app/build.rs @@ -1,10 +1,18 @@ fn main() { - // link to Vosk lib - // println!("cargo:rustc-link-lib=libvosk.dll"); - let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); let lib_path = std::path::Path::new(&manifest_dir) .join("..\\..\\lib\\windows\\amd64"); - + println!("cargo:rustc-link-search=native={}", lib_path.display()); + + // Embed a Common-Controls v6 manifest on Windows so transitive imports + // pulled in by tray-icon / winit (TaskDialogIndirect, themed controls, + // per-monitor DPI) resolve against comctl32 v6. Without this the exe + // crashes at load with "TaskDialogIndirect entry point not found". + #[cfg(target_os = "windows")] + { + println!("cargo:rerun-if-changed=app.manifest"); + println!("cargo:rerun-if-changed=app.manifest.rc"); + let _ = embed_resource::compile("app.manifest.rc", embed_resource::NONE); + } }