Skip to content

Feature Request: Support Windows ARM64 (Snapdragon) native binaries #326

Description

@carrycooldude

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

  1. The hook/build.dart script in flutter_gemma registers code assets for Windows using the checksums of prebuilt archives.
  2. 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.
  3. 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.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions