Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

How to build chromium on Windows

Paor edited this page May 15, 2019 · 2 revisions

System requirements

  • A 64-bit Intel machine with at least 8GB of RAM. More than 16GB is highly recommended.
  • At least 100GB of free disk space on an NTFS-formatted hard drive. FAT32 will not work, as some of the Git packfiles are larger than 4GB.
  • An appropriate version of Visual Studio, as described below.
  • Windows 7 or newer.

Step-by-step guide

1. Setting up Windows

  • Chromium requires Visual Studio 2017 (>=15.7.2) or 2019 (>=16.0.0) to build. The clang-cl compiler is used but Visual Studio's header files, libraries, and some tools are required. Visual Studio Community Edition should work if its license is appropriate for you. You must install the “Desktop development with C++” component and the “MFC/ATL support” sub-components.

  • You must have the version 10.0.17763 or higher Windows 10 SDK installed. This can be installed separately or by checking the appropriate box in the Visual Studio Installer.

  • The SDK Debugging Tools must also be installed. If the Windows 10 SDK was installed via the Visual Studio installer, then they can be installed by going to: Control Panel → Programs → Programs and Features → Select the “Windows Software Development Kit” → Change → Change → Check “Debugging Tools For Windows” → Change. Or, you can download the standalone SDK installer and use it to install the Debugging Tools.

  • If you are using Visual Studio 2019. Add a GYP_MSVS_VERSION system variable and set it to 2019.

2. Install depot_tools

  • Download the depot_tools bundle and extract it somewhere.

    Warning: DO NOT use drag-n-drop or copy-n-paste extract from Explorer, this will not extract the hidden “.git” folder which is necessary for depot_tools to autoupdate itself. You can use “Extract all…” from the context menu though.

  • Add depot_tools to the start of your PATH (must be ahead of any installs of Python). Assuming you unzipped the bundle to C:\src\depot_tools, open:
    Control Panel → System and Security → System → Advanced system settings

    If you have Administrator access, Modify the PATH system variable and put C:\src\depot_tools at the front (or at least in front of any directory that might already have a copy of Python or Git).
    If you don't have Administrator access, you can add a user-level PATH environment variable and put C:\src\depot_tools at the front, but if your system PATH has a Python in it, you will be out of luck.

  • Add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set it to 0. This tells depot_tools to use your locally installed version of Visual Studio (by default, depot_tools will try to use a google-internal version).

  • From a cmd.exe shell, run the command gclient (without arguments). On first run, gclient will install all the Windows-specific bits needed to work with the code, including msysgit and python.

    If you run gclient from a non-cmd shell (e.g., cygwin, PowerShell), it may appear to run properly, but msysgit, python, and other tools may not get installed correctly.
    If you see strange errors with the file system on the first run of gclient, you may want to disable Windows Indexing.

  • After running gclient open a command prompt and type where python and confirm that the depot_tools python.bat comes ahead of any copies of python.exe. Failing to ensure this can lead to overbuilding when using gn - see crbug.com.

3. Get the code

  • First, configure Git:
    $ git config --global user.name "My Name"
    $ git config --global user.email "my-name@chromium.org"
    $ git config --global core.autocrlf false
    $ git config --global core.filemode false
    $ git config --global branch.autosetuprebase always

  • Create a chromium directory for the checkout and change to it (you can call this whatever you like and put it wherever you like, as long as the full path has no spaces):
    $ mkdir chromium && cd chromium

  • Clone the chromium-src repository:
    $ git clone https://github.com/otcshare/chromium-src.git

  • Create .gclient file and edit the file to contain the following arguments:
    solutions = [
    {
    "url": "http://github.com/otcshare/chromium-src.git@webml",
    "managed": False,
    "name": "chromium-src",
    "deps_file": ".DEPS.git",
    "custom_deps": {},
    },
    ]

4. Config the proxy (proxy needed only)

  • Make sure the proxy settings is correct in terminal:
    $ set http_proxy=http://proxy_addr:proxy_port
    $ set https_proxy=https://proxy_addr:proxy_port

  • Create .boto file (you ca put it anywhere you like) and edit the file to contain the following arguments:
    [boto]
    proxy=http://proxy_addr
    proxy_port=proxy_port

  • Add .boto config to system enviroment:
    open: Control Panel → System and Security → System → Advanced system settings, add a NO_AUTH_BOTO_CONFIG system variable and set it to "\path\to.boto".

5. Update your checkout and run the hooks

  • The remaining instructions assume you have switched to the src directory:
    $ cd chromium-src

  • To update an existing checkout, you can run:
    $ gclient sync

  • You can now run the Chromium-specific hooks, which will download additional binaries and other things you might need:
    $ gclient runhooks

6. Setting up the build

  • Chromium uses Ninja as its main build tool along with a tool called GN to generate .ninja files. You can create any number of build directories with different configurations. To create a build directory, run:
    $ gn gen out/Default

  • To config the flags for WebNN, run gn args out/Default and edit the file to contain the following arguments:
    $ gn args out/Default
    target_os = "win"
    target_cpu = "x64"
    is_debug = false
    is_component_build = false

    You only have to run this once for each new build directory, Ninja will update the build files as needed.
    You can replace Default with another name, but it should be a subdirectory of out.

7. Build Chromium

  • Build Chromium (the “chrome” target) with Ninja using the command:
    $ autoninja -C out\Default chrome

8. Run Chromium

  • Once it is built, you can simply run the browser:
    $ out\Default\chrome.exe
    (The “.exe” suffix in the command is actually optional).