flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.27k stars 436 forks source link

[flet build windows] fails for some reason #2493

Open ghost opened 9 months ago

ghost commented 9 months ago

I have all the requirements right:

I am using [flet build windows] in a To-Do app, the code works correctly.

------- LOG ------- $ flet build windows --verbose Flutter bootstrap directory: C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh Creating Flutter bootstrap project...OK Customizing app icons and splash images...Copying C:\Users\USER\Desktop\FLET_TODO_2COND\assets\icon.png to C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\images OK Generating app icons...OK Packaging Python app...OK Building Windows app...['C:\Users\USER\dev\flutter\bin\flutter.BAT', 'build', 'windows'] Resolving dependencies... ffi 2.1.0 (2.1.2 available) fl_chart 0.65.0 (0.66.1 available) flutter_lints 2.0.3 (3.0.1 available) flutter_native_splash 2.3.7 (2.3.9 available) js 0.6.7 (0.7.0 available) lints 2.1.1 (3.0.0 available) matcher 0.12.16 (0.12.16+1 available) material_color_utilities 0.5.0 (0.8.0 available) meta 1.10.0 (1.11.0 available) package_info_plus 4.2.0 (5.0.1 available) path 1.8.3 (1.9.0 available) petitparser 5.4.0 (6.0.2 available) test_api 0.6.1 (0.7.0 available) toml 0.14.0 (0.15.0 available) web 0.3.0 (0.4.2 available) web_socket_channel 2.4.0 (2.4.3 available) xml 6.3.0 (6.5.0 available) Got dependencies! 17 packages have newer versions incompatible with dependency constraints. Try flutter pub outdated for more information.

windows/flutter/CMakeLists.txt does not use FLUTTER_TARGET_PLATFORM, updating. Building Windows application... Building Windows application... 1188.3s

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\ZERO_CHECK.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\plugins\serious_python_windows\CopyPyth onDLLs.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\flutter\flutter_assemble.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\flutter\flutter_wrapper_plugin.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\plugins\audioplayers_windows\audioplaye rs_windows_plugin.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\flutter\flutter_wrapper_app.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\plugins\screen_retriever\screen_retriev er_plugin.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\plugins\serious_pythonwindows\serious python_windows_plugin.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include\format(42): warning
STL4038: The contents of are available only with C++20 or later. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\plugins\serious_pythonwindows\serious python_windows_plugin.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\plugins\url_launcher_windows\url_launch er_windows_plugin.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\plugins\window_manager\window_manager_p lugin.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\plugins\window_to_front\window_to_front _plugin.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\runner\flet_todo_2cond.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\ALL_BUILD.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(541,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could
lead to issues with incremental build. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\INSTALL.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: The command "setlocal
[C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\INSTALL.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: "C:\Program Files
(x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -DBUILD_TYPE=Release -P cmake_install.cmake [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\INSTALL.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: if %errorlevel% neq 0
goto :cmEnd [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\INSTALL.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmEnd [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\INSTALL.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: endlocal & call
:cmErrorLevel %errorlevel% & goto :cmDone [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\INSTALL.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmErrorLevel [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\INSTALL.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: exit /b %1 [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\INSTALL.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmDone [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\INSTALL.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: if %errorlevel% neq 0
goto :VCEnd [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\INSTALL.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :VCEnd" exited with
code 1. [C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh\build\windows\x64\INSTALL.vcxproj] Build process failed.

Deleting Flutter bootstrap directory C:\Users\USER\AppData\Local\Temp\flet_flutter_build_tJQQVZLCxh Error building Flet app - see the log of failed command above.

FeodorFitsner commented 9 months ago

Try upgrading to the latest "Dev" release of flet package: https://pypi.org/project/flet/0.20.0.dev2183/ Then build with flet build windows -vv - it will yield super-detailed output from flutter build command. Maybe we'll see some more details there.

ghost commented 9 months ago

Try upgrading to the latest "Dev" release of flet package: https://pypi.org/project/flet/0.20.0.dev2183/ Then build with flet build windows -vv - it will yield super-detailed output from flutter build command. Maybe we'll see some more details there.

(venv) USER@DESKTOP-0D4Q1HS MINGW64 ~/Desktop/FLET_TODO_2COND $ flet --version 0.20.0.dev2183 (venv) USER@DESKTOP-0D4Q1HS MINGW64 ~/Desktop/FLET_TODO_2COND $ flet build windows -vv Flutter executable: C:\Users\USER\dev\flutter\bin\flutter.BAT Dart executable: C:\Users\USER\dev\flutter\bin\dart.BAT Flutter bootstrap directory: C:\Users\USER\AppData\Local\Temp\flet_flutter_build_SGVOKKnCzT Creating Flutter bootstrap project...Deleting Flutter bootstrap directory C:\Users\USER\AppData\Local\Temp\flet_flutter_build_SGVOKKnCzT The 0.20.0.dev2183 branch of repository https://github.com/flet-dev/flet-build-template.git could not found, have you made a typo? (venv) USER@DESKTOP-0D4Q1HS MINGW64 ~/Desktop/FLET_TODO_2COND $

FeodorFitsner commented 9 months ago

Ah, good point!

Run it with:

flet build windows --template-ref 0.20.0 -vv
ghost commented 9 months ago

Ah, good point!

Run it with:

flet build windows --template-ref 0.20.0 -vv

Here is the log: build_log.txt

FeodorFitsner commented 9 months ago

Can you check if you have C:/Windows/system32/vcruntime140_1.dll file?

ghost commented 9 months ago

Can you check if you have C:/Windows/system32/vcruntime140_1.dll file?

i have it image

Samwellwang commented 3 months ago

same problem

Samwellwang commented 3 months ago

same problem

I have the same error , the solution it work for me was INSTALL Visual Studio community 2022 , after installed . build successd

ndonkoHenri commented 3 months ago

INSTALL Visual Studio community 2022

@418kz can you give it a try.

carlos-alberto-code commented 2 months ago

I have a similar problem. I already installed Visual Studio 2022 but it did not compile successfully.

I am using poetry, and when I run poetry run flet build windows --verbose although it ends with the indication that the compilation was successful, in the middle of the process it sends warnings, especially this one:

ChatGPT suggested a solution but I can't find the file it indicates: ''What you need to do is edit the project configuration files where CMake sets the output paths for binary files, libraries and application files. These files are usually called CMakeLists.txt.''

Another thing I have thought is that, with poetry a pyproject.toml is generated and it may be that it requires the requirements.txt file, although I already tried running the poetry command to export the requirements.txt and it indicated that the .zip file was not generated.

ndonkoHenri commented 2 months ago

@carlos-alberto-code will you mind sharing your errors as text (in english)?

Alan3344 commented 1 month ago

Following the prompts, I successfully compiled my project The following is the detailed log build.log It is recommended to use the vscode tool with the log plug-in to view

Project Structure ![image](https://github.com/user-attachments/assets/de942b17-e99e-4f3a-aff7-61b22ce826ea)