1

I'm trying to build the Flutter engine on Windows. I think VS 2017 is needed and I only have that version of VS installed. I had to do these two things that were not among the instructions here:

set GYP_MSVS_VERSION=2017
set DEPOT_TOOLS_WIN_TOOLCHAIN=0

Then, in the compile insturctions here, I'm getting errors after python .\flutter\tools\gn --unoptimized.

λ python .\flutter\tools\gn --unoptimized Generating GN files in: out\host_debug_unopt Traceback (most recent call last): File "C:/Installs/Flutter/engine/src/build/toolchain/win/setup_toolchain.py", line 154, in main() File "C:/Installs/Flutter/engine/src/build/toolchain/win/setup_toolchain.py", line 121, in main args = _SetupScript(cpu, win_sdk_path) File "C:/Installs/Flutter/engine/src/build/toolchain/win/setup_toolchain.py", line 68, in _SetupScript return [os.path.normpath(os.path.join(os.environ['GYP_MSVS_OVERRIDE_PATH'],
File "C:\Installs\Flutter\building\depot_tools\win_tools-2_7_15_chromium14_bin\python\bin\lib\os.py", line 425, in getitem return self.data[key.upper()] KeyError: 'GYP_MSVS_OVERRIDE_PATH' ERROR at //build/toolchain/win/BUILD.gn:28:18: Script returned non-zero exit code. toolchain_data = exec_script("setup_toolchain.py", ^---------- Current dir: C:/Installs/Flutter/engine/src/out/host_debug_unopt/ Command: C:/Installs/Flutter/building/depot_tools/win_tools-2_7_15_chromium14_bin/python/bin/python.exe C:/Installs/Flutter/engine/src/build/toolchain/win/setup_toolchain.py "C:\Program Files (x86)/Microsoft Visual Studio/2017/Community" ../../third_party/gyp/pylib/gyp/win_tool.py "C:\Program Files (x86)\Windows Kits\10" "C:\WINDOWS\System32;C:\WINDOWS\SysWOW64;Arm64Unused" x64 Returned 1. See //BUILD.gn:6:1: which caused the file to be included. group("default") { ^------------------

After doing set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017 now I get:

λ python .\flutter\tools\gn --unoptimized Generating GN files in: out\host_debug_unopt Traceback (most recent call last): File "C:/Installs/Flutter/engine/src/build/toolchain/win/setup_toolchain.py", line 154, in main() File "C:/Installs/Flutter/engine/src/build/toolchain/win/setup_toolchain.py", line 126, in main env = _ExtractImportantEnvironment(variables) File "C:/Installs/Flutter/engine/src/build/toolchain/win/setup_toolchain.py", line 50, in _ExtractImportantEnvironment 'required to be set to valid path' % required) Exception: Environment variable "SYSTEMROOT" required to be set to valid path ERROR at //build/toolchain/win/BUILD.gn:28:18: Script returned non-zero exit code. toolchain_data = exec_script("setup_toolchain.py", ^---------- Current dir: C:/Installs/Flutter/engine/src/out/host_debug_unopt/ Command: C:/Installs/Flutter/building/depot_tools/win_tools-2_7_15_chromium14_bin/python/bin/python.exe C:/Installs/Flutter/engine/src/build/toolchain/win/setup_toolchain.py "C:\Program Files (x86)\Microsoft Visual Studio\2017" ../../third_party/gyp/pylib/gyp/win_tool.py "C:\Program Files (x86)\Windows Kits\10" "C:\WINDOWS\System32;C:\WINDOWS\SysWOW64;Arm64Unused" x64 Returned 1. See //BUILD.gn:6:1: which caused the file to be included. group("default") { ^------------------

SYSTEMROOT is already set:

λ echo %SYSTEMROOT%
C:\WINDOWS

I tried these, but still I'm getting the same error.

set WindowsSdkDir=C:\Program Files (x86)\Windows Kits\8.1
SET use_sysroot=0
SET USE_SYSROOT=0

How can I get over this issue and compile the Flutter engine?

Edit: by the way, I hit enter when it asks for a username Username for 'https://chrome-internal.googlesource.com':, could it be related?

1 Answer 1

2

Ok it was supposed to be set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community. Missed out the Community part. Figured it out after digging in the python files a bit.

So, these below should be added to the instructions:

  1. Set these variables
set GYP_MSVS_VERSION=2017
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
  1. Install Windows 10 SDK with Windows SDK for Desktop C++ x86/amd64 Apps.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.