Since October 2017, Chromium for Windows can be built from Linux machines.
This works by automatically downloading the Windows SDK and using
clang-cl in the same
way it is used on Windows. Unfortunately, the announcement at
mentioned that this would only work for people working at Google, as they were
not allowed to redistribute the Windows SDK, and asked for help in
implementing the missing bits.
Our Chromium work at Igalia requires sometimes to use Windows machines to
build or test Windows specific code, so we were really eager to get this
working. After some hacking, we contributed
depot_tools support for using a
copy of the Windows SDK from a local zip file at
As mentioned in the
the SDK can be packaged very easily by running the following script from a
depot_tools checkout on a Windows box:
$ python win_toolchain/package_from_installed.py 2017 -w 10.0.17134.0 Building file list for VS 2017 Windows 10.0.17134.0... Wrote to out.zip. Extracting to determine hash... Hashing... Calculating hash of toolchain in vs_files. Please wait... Renamed out.zip to 5c1e774993a7d6cb7ead97c408780169a12e2a3b.zip.
Then, after copying the zip file to the Linux or Mac host,
gclient needs to
be setup to build Chromium for Windows by adding
target_os = ['win'] to
.gclient and it needs to be told where the SDK package is. In order to use a
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL needs to point to the local
5c1e774993a7d6cb7ead97c408780169a12e2a3b.zip was saved.
gclient is going to look for a file whose basename matches a
hardcoded hash in
but it can be changed by setting
hash>. For this particular case:
$ export DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL=~/Downloads $ export GYP_MSVS_HASH_3bc0ec615cf20ee342f3bc29bc991b5ad66d8d2c=5c1e774993a7d6cb7ead97c408780169a12e2a3b
Instead of grepping for
vs_toolchain.py, a more
convenient way to find its value is setting
DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL alone and syncing:
$ export DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL=~/Downloads $ gclient sync ... Running hooks: 14% (11/76) win_toolchain ________ running '/usr/bin/python src/build/vs_toolchain.py update --force' in '/home/hferreiro/git/chromium' Windows toolchain out of date or doesn't exist, updating (Pro)... current_hashes: desired_hash: 3bc0ec615cf20ee342f3bc29bc991b5ad66d8d2c ...
target_os = "win" needs to be added to the
args.gn file, and then
ninja can be run normally.