Goal: Build the Thorium browser (a Chromium fork) from source on Windows.
System Setup:
OS: Windows
Source Code: Located at D:\thorium\src
Build Tools: Google's depot_tools (installed at D:\depot_tools), gclient, gn, ninja.
Visual Studio: Visual Studio 2022 Community installed at D:\Microsoft Visual Studio\2022\Community.
Windows SDK: Located at D:\Windows Kits\10 (Version 10.0.26100.0 definitely present, potentially others like 10.0.22621.0 if installed during troubleshooting).
Build Output Directory: D:\thorium\src\out\ThoriumBuild
Core Problem:
The gn args out\ThoriumBuild command consistently fails during the "Generating files..." step when trying to automatically detect the required Visual Studio installation. It throws a Python exception from the D:\thorium\src\build\vs_toolchain.py script:
Exception: No supported Visual Studio can be found. Supported versions are: 17.0 (2022), 16.0 (2019), 15.0 (2017).
Troubleshooting Steps Taken (Summary):
Initial Setup: gclient sync completed successfully.
Manual Toolchain Override (Failed):
Set $env:DEPOT_TOOLS_WIN_TOOLCHAIN=0 (PowerShell) or set DEPOT_TOOLS_WIN_TOOLCHAIN=0 (CMD).
Manually added visual_studio_path, visual_studio_version, windows_sdk_path, windows_sdk_version, and wdk_path to args.gn.
Result: Bypassed the initial VS detection error but led to a new error (visual_studio_runtime_dirs is not a string), indicating this manual override method is incomplete/unviable.
PGO Disabled: Added chrome_pgo_phase = 0 to args.gn to successfully resolve a separate error about missing PGO profile data. This setting is kept in subsequent attempts.
Focusing on Automatic Detection (No Manual Path Overrides in args.gn):
Used the "x64 Native Tools Command Prompt for VS 2022".
Verified essential VS Components installed via VS Installer ("Desktop development with C++", Windows SDK (tried latest and older versions like 10.0.22621.0), WDK).
Set GYP_MSVS_VERSION=2022 environment variable.
Corrected System PATH Environment Variable to ensure D:\depot_tools has priority over other Python installations. Confirmed gn now uses Python from depot_tools.
Confirmed vs_toolchain.py script was not modified locally (git status).
Confirmed vswhere.exe successfully finds the VS 2022 installation (D:\Microsoft Visual Studio\2022\Community).
Result (All Attempts): Automatic detection still fails with the same Exception: No supported Visual Studio can be found. error originating from vs_toolchain.py.
Current Status:
Despite confirming the VS installation is fundamentally detectable by vswhere.exe, using the correct command prompt, ensuring the right Python environment, and having the required components supposedly installed, the crucial vs_toolchain.py script used by gn fails to detect VS 2022. The last suggested action was to try Repairing the Visual Studio 2022 installation via the Visual Studio Installer, restarting, and attempting the automatic detection build process again.