Description
Currently, when trying to build and run a Flutter application using flutter_gemma on a Windows ARM64 device (e.g. Snapdragon X Elite laptops), the build succeeds if using an ARM64 JDK, but the application crashes at startup during model initialization with the following error:
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'StreamProxy.dll': The specified module could not be found. (error code: 126)
#0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
#1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
#2 LiteRtLmFfiClient._ensureBindings (package:flutter_gemma/core/ffi/litert_lm_client.dart:335:33)
...
Why this happens
- The
hook/build.dart script in flutter_gemma registers code assets for Windows using the checksums of prebuilt archives.
- In
build.dart, only litertlm-windows_x86_64.tar.gz is listed in the checksums; there is no checksum or release artifact for windows_arm64.
- Consequently, when compiling for Windows ARM64, the build script skips downloading any native libraries, resulting in
StreamProxy.dll and LiteRtLm.dll being missing from the runner directory.
- If a developer builds natively for ARM64 on Windows, the application runs as a native ARM64 process and attempts to load
StreamProxy.dll. Even if an x64 version of the DLL is manually placed in the directory, Windows cannot load an x64 DLL into an ARM64 process, resulting in Error Code 126.
Requested Solution
Please compile and add windows_arm64 release artifacts (specifically litertlm-windows_arm64.tar.gz containing ARM64 builds of LiteRtLm.dll and StreamProxy.dll) to the release workflow, and add the corresponding checksum to hook/build.dart.
This will enable native ARM64 Windows developers (e.g. Snapdragon laptops) to run on-device models natively without having to force the entire Flutter project to compile for x64 under emulation.
Description
Currently, when trying to build and run a Flutter application using
flutter_gemmaon a Windows ARM64 device (e.g. Snapdragon X Elite laptops), the build succeeds if using an ARM64 JDK, but the application crashes at startup during model initialization with the following error:Why this happens
hook/build.dartscript influtter_gemmaregisters code assets for Windows using the checksums of prebuilt archives.build.dart, onlylitertlm-windows_x86_64.tar.gzis listed in the checksums; there is no checksum or release artifact forwindows_arm64.StreamProxy.dllandLiteRtLm.dllbeing missing from the runner directory.StreamProxy.dll. Even if an x64 version of the DLL is manually placed in the directory, Windows cannot load an x64 DLL into an ARM64 process, resulting in Error Code 126.Requested Solution
Please compile and add
windows_arm64release artifacts (specificallylitertlm-windows_arm64.tar.gzcontaining ARM64 builds ofLiteRtLm.dllandStreamProxy.dll) to the release workflow, and add the corresponding checksum tohook/build.dart.This will enable native ARM64 Windows developers (e.g. Snapdragon laptops) to run on-device models natively without having to force the entire Flutter project to compile for x64 under emulation.