MixinNetwork / MixinNetwork/flutter-plugins

desktop_webview_window fails to link on Windows ARM64

Open
#481 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
512
Forks
292
Avg merge
15h 8m
Merged PRs (30d)
7

Description

Issue

desktop_webview_window fails to build for native Windows ARM64 Flutter apps.

Flutter 3.44.1 auto-selects windows-arm64 on Windows ARM hosts. The plugin target is then built as ARM64, but the plugin links the x64 WebView2 loader import library.

Evidence

Environment:

Flutter 3.44.1
Dart 3.12.1
Windows ARM64 host
desktop_webview_window 0.3.0

Build failure:

web_view.obj : error LNK2019: unresolved external symbol CreateCoreWebView2EnvironmentWithOptions
web_view_window_plugin.obj : error LNK2019: unresolved external symbol GetAvailableCoreWebView2BrowserVersionString
windows\flutter\ephemeral\.plugin_symlinks\desktop_webview_window\windows\libs\x64\Webview2Loader.dll.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'ARM64'
desktop_webview_window_plugin.dll : fatal error LNK1120: 2 unresolved externals

Current Windows CMake hardcodes x64:

add_library(Webview2 SHARED IMPORTED GLOBAL)
SET_PROPERTY(TARGET Webview2 PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/libs/x64/Webview2Loader.dll)
SET_PROPERTY(TARGET Webview2 PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/libs/x64/Webview2Loader.dll.lib)

The package only includes:

windows/libs/x64/WebView2Loader.dll
windows/libs/x64/WebView2Loader.dll.lib

Root Cause

The plugin always links the x64 WebView2 loader import library, regardless of the Windows build architecture.

On Windows ARM64 builds, MSVC cannot link an x64 .lib into an ARM64 plugin DLL, which produces LNK4272 and unresolved WebView2 symbols.

Suggested Fix

Ship WebView2 loader binaries for all supported Windows architectures and select the correct directory from CMake.

Suggested layout:

windows/libs/x64/WebView2Loader.dll
windows/libs/x64/WebView2Loader.dll.lib
windows/libs/arm64/WebView2Loader.dll
windows/libs/arm64/WebView2Loader.dll.lib

Suggested CMake behavior:

if(CMAKE_GENERATOR_PLATFORM MATCHES "ARM64")
  set(WEBVIEW2_LOADER_ARCH "arm64")
else()
  set(WEBVIEW2_LOADER_ARCH "x64")
endif()

set_property(TARGET Webview2 PROPERTY IMPORTED_LOCATION
  ${CMAKE_CURRENT_SOURCE_DIR}/libs/${WEBVIEW2_LOADER_ARCH}/WebView2Loader.dll)
set_property(TARGET Webview2 PROPERTY IMPORTED_IMPLIB
  ${CMAKE_CURRENT_SOURCE_DIR}/libs/${WEBVIEW2_LOADER_ARCH}/WebView2Loader.dll.lib)

Microsoft ships the ARM64 WebView2 loader in the Microsoft.Web.WebView2 NuGet package.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the Windows plugin CMake configuration and the existing windows/libs/x64 WebView2 loader files first. Check how the Microsoft.Web.WebView2 package supplies ARM64 binaries, then verify a native Windows ARM64 Flutter build links without the x64-versus-ARM64 warning or unresolved symbols. Done means both supported architectures select matching loader binaries and the plugin builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cmake
Domain
build-system, desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.