Skip to content

desktop_webview_window fails to link on Windows ARM64 #481

@sgaabdu4

Description

@sgaabdu4

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions