gn gen out/ThoriumBuild

Adarsh Jha 0 Reputation points
2025-04-02T00:01:28.8066667+00:00

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.

Developer technologies | Visual Studio | Debugging
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,456 Reputation points Microsoft External Staff
    2025-04-02T03:58:24.41+00:00

    Hello @Adarsh Jha ,

    Welcome to Microsoft Q&A forum.

    I notice that you have customized the installation location of Visual Studio, and the issue seems to be that the installed Visual Studio cannot be detected correctly.

    I checked the vs_toolchain.py script here: build/vs_toolchain.py - chromium. From line 196 to line 264, I see that

    User's image

    Looks like the path for detecting installed Visual Studio is hardcoded. Which means it checks the default installation path of VS(C:\Program Files\Microsoft Visual Studio\2022\Community).

    Is it possible for you to try to reinstall VS 2022 and use the default C drive installation location? I believe if you use the default installation location, this issue will disappear.

    If you cannot install VS 2022 in the default C drive, then you may need to consider other methods like changing the path in the vs_toolchain.py script(I’m not sure if it’s allowed to change the path in it, you can contact them and double confirm this).

    Best regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.