jnschulze / flutter-webview-windows

A WebView2-powered Flutter WebView implementation for the Windows platform.
BSD 3-Clause "New" or "Revised" License
202 stars 119 forks source link

CMake Error at flutter/ephemeral/.plugin_symlinks/webview_windows/windows/CMakeLists.txt:32 #88

Closed TOKID closed 2 years ago

TOKID commented 2 years ago

it happend when i use webview_windows: ^0.1.4

Building Windows application... CMake Error at flutter/ephemeral/.plugin_symlinks/webview_windows/windows/CMakeLists.txt:32 (message): Integrity check for D:/Android/Projects/publish_player/build/windows/nuget.exe failed

Exception: Unable to generate build files

Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.18363.1556], locale zh-CN) [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.9) [√] Android Studio (version 2020.3) [√] Connected device (2 available)

jnschulze commented 2 years ago

The windows/CMakeLists.txt attempts to download nuget and checks its integrity. So either the download or the validation fails. Does build/windows/nuget.exe exist?

It’s up to you if you want to download nuget manually and put it to your $PATH or disable the integrity check at your own risk by modifying the CMakeLists.txt.

TOKID commented 2 years ago

build/windows/nuget.exe existed, how to modifying the CMakeLists.txt

i found codes in CMakeLists.txt below:

if (NUGET_DL_HASH STREQUAL NUGET_SHA256) add_custom_target(DEPENDENCIES_DOWNLOAD ALL) add_custom_command( TARGET DEPENDENCIES_DOWNLOAD PRE_BUILD COMMAND ${NUGET} install Microsoft.Windows.ImplementationLibrary -Version ${WIL_VERSION} -ExcludeVersion -OutputDirectory ${CMAKE_BINARY_DIR}/packages COMMAND ${NUGET} install Microsoft.Web.WebView2 -Version ${WEBVIEW_VERSION} -ExcludeVersion -OutputDirectory ${CMAKE_BINARY_DIR}/packages DEPENDS ${NUGET} ) else() message(FATAL_ERROR "Integrity check for ${NUGET} failed") endif()

jnschulze commented 2 years ago

Comment the line if (NUGET_DL_HASH STREQUAL NUGET_SHA256) and the corresponding else-block.

TOKID commented 2 years ago

then i got a windows alert says 'this application not allowed launchering in your computer'

jnschulze commented 2 years ago

Looks like it's compromised in fact. What's the SHA256 sum?

CertUtil -HashFile nuget.exe SHA256

It should output

SHA256 hash of nuget.exe:
852b71cc8c8c2d40d09ea49d321ff56fd2397b9d6ea9f96e532530307bbbafd3
CertUtil: -hashfile command completed successfully.

image Is it signed by MS? image

Do you live in China btw?

TOKID commented 2 years ago

Looks like it's compromised in fact. What's the SHA256 sum?

CertUtil -HashFile nuget.exe SHA256

It should output

SHA256 hash of nuget.exe:
852b71cc8c8c2d40d09ea49d321ff56fd2397b9d6ea9f96e532530307bbbafd3
CertUtil: -hashfile command completed successfully.

image Is it signed by MS? image

Do you live in China btw?

\build\windows>CertUtil -HashFile nuget.exe SHA256 SHA256 的 nuget.exe 哈希: 54cd3025d8f9eaca25bc97a7cd3c1ac7d3ba7f79a995f3813afbd953f0345929 CertUtil: -hashfile 命令成功完成。

,and yes,i do live in china. also i try to run 'nuget.exe',i got the same windows alert 'this application not allowed launchering in your computer'.

TOKID commented 2 years ago

ok, i will try, thank you for answer my question, help me a lot.

jnschulze commented 2 years ago

I've just published a new version (0.1.5) which prefers a local nuget over the downloaded one. So you just need to install it yourself.

Brian586 commented 2 years ago

Comment the line if (NUGET_DL_HASH STREQUAL NUGET_SHA256) and the corresponding else-block.

I tried that:

file(SHA256 ${NUGET} NUGET_DL_HASH)

if (NUGET_DL_HASH STREQUAL NUGET_SHA256)

add_custom_target(DEPENDENCIES_DOWNLOAD ALL)
add_custom_command(
    TARGET DEPENDENCIES_DOWNLOAD PRE_BUILD
    COMMAND ${NUGET} install Microsoft.Windows.ImplementationLibrary -Version ${WIL_VERSION} -ExcludeVersion -OutputDirectory ${CMAKE_BINARY_DIR}/packages
    COMMAND ${NUGET} install Microsoft.Web.WebView2 -Version ${WEBVIEW_VERSION} -ExcludeVersion -OutputDirectory ${CMAKE_BINARY_DIR}/packages
    DEPENDS ${NUGET}
)

else()

message(FATAL_ERROR "Integrity check for ${NUGET} failed")

endif()

But I'm still getting this error:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: The command "setlocal [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: ....\nuget.exe install Microsoft.Windows.ImplementationLibrary -Version 1.0.211019.2 -ExcludeVersion -OutputDirectory C:/src/FlutterApps/afriblox/build/windows/packages [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: ....\nuget.exe install Microsoft.Web.WebView2 -Version 1.0.1054.31 -ExcludeVersion -OutputDirectory C:/src/FlutterApps/afriblox/build/windows/packages [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: :cmEnd [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: :cmErrorLevel [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: exit /b %1 [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: :cmDone [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(145,5): error MSB3073: :VCEnd" exited with code 1. [C:\src\FlutterApps\afriblox\build\windows\plugins\webview_windows\DEPENDENCIES_DOWNLOAD.vcxproj] Exception: Build process failed.

khuntia commented 2 years ago

@jnschulze I am also getting the above error, its a new setup for me and I am not in china. Have nuget in my path. I have visual studio 22, not 19. Do you think that can be an issue ?

crifurch commented 2 years ago

I have same issues caused by missing nuget.com repo for packages. Verify that you have same problems try add sources location as pointed at https://docs.microsoft.com/en-us/microsoft-edge/webview2/get-started/win32#step-7---install-the-windows-implementation-libraries-wil

PonyPC commented 2 years ago

The literally solution is deleting the %appdata%\nuget\nuget.config file

lucasjinreal commented 1 year ago

Seriously?

/webview_windows/windows/CMakeLists.txt:77 (target_compile_features): target_compile_features The compiler feature "cxx_std_23" is not known to CXX compiler

"MSVC"

version 19.29.30147.0.

lucasjinreal commented 1 year ago

Please,...... stop using decent c++ version on c++ projects.............................

steniljoseph commented 1 year ago

Any updates on this issue , I am still getting the same issue in windows build...!

ranjitIN commented 1 year ago

any update on this issue still i am facing this issue

snehccurry commented 3 months ago

ah same,