blob: f1cfcd8065dfdb8bcb7397117083c7f4d7cb5e53 [file] [log] [blame] [view]
Nico Weberbf97a6d12017-10-13 17:40:021# Cross-compiling Chrome/win
2
Nico Weberce96b4702017-12-14 18:52:313It's possible to build most parts of the codebase on a Linux or Mac host while
4targeting Windows. This document describes how to set that up, and current
5restrictions.
Nico Weberbf97a6d12017-10-13 17:40:026
7What does *not* work:
8
Takashi Toyoshima0dab2f02017-10-31 09:10:589* goma. Sorry. ([internal bug](http://b/64390790)) You can use the
Nico Weber495e9552017-10-23 20:03:0710 [jumbo build](jumbo.md) for faster build times.
Nico Weber1f05f162018-01-22 19:06:4211* renderer processes crash at startup ([bug](https://crbug.com/803591))
Nico Weberce96b4702017-12-14 18:52:3112* on Mac hosts, building a 32-bit chrome ([bug](https://crbug.com/794838))
Nico Weberbf97a6d12017-10-13 17:40:0213
Nico Weber495e9552017-10-23 20:03:0714All other targets build fine (including `chrome`, `browser_tests`, ...).
15
Lei Zhang4d34c1fb2017-10-23 22:29:3716Uses of `.asm` files have been stubbed out. As a result, some of Skia's
17software rendering paths are not present in cross builds, Crashpad cannot
Nico Weber495e9552017-10-23 20:03:0718report crashes, and NaCl defaults to disabled and cannot be enabled in
Nico Webera3a4b222017-10-23 20:08:4519cross builds ([.asm bug](https://crbug.com/762167)).
Nico Weberbf97a6d12017-10-13 17:40:0220
21## .gclient setup
22
231. Tell gclient that you need Windows build dependencies by adding
24 `target_os = ['win']` to the end of your `.gclient`. (If you already
Lei Zhang4d34c1fb2017-10-23 22:29:3725 have a `target_os` line in there, just add `'win'` to the list.) e.g.
26
27 solutions = [
28 {
29 ...
30 }
31 ]
32 target_os = ['android', 'win']
33
Nico Weberbf97a6d12017-10-13 17:40:02341. `gclient sync`, follow instructions on screen.
35
36If you're at Google, this will automatically download the Windows SDK for you.
Tom Sepez3e3f0ceda2017-10-23 21:18:0237If this fails with an error: Please follow the instructions at
38https://www.chromium.org/developers/how-tos/build-instructions-windows
39then you may need to re-authenticate via:
40
41 cd path/to/chrome/src
42 # Follow instructions, enter 0 as project id.
43 download_from_google_storage --config
44
Nico Weberbf97a6d12017-10-13 17:40:0245If you are not at Google, you'll have to figure out how to get the SDK, and
46you'll need to put a JSON file describing the SDK layout in a certain location.
47
Nico Webera001bab2017-10-23 20:11:1048## GN setup
Nico Weberbf97a6d12017-10-13 17:40:0249
50Add `target_os = "win"` to your args.gn. Then just build, e.g.
51
52 ninja -C out/gnwin base_unittests.exe
53
Nico Weber1f05f162018-01-22 19:06:4254## Copying and running chrome
55
56A convenient way to copy chrome over to a Windows box is to build the
57`mini_installer` target. Then, copy just `mini_installer.exe` over
58to the Windows box and run it to install the chrome you just built.
59
Nico Webera001bab2017-10-23 20:11:1060## Running tests on swarming
Nico Weberbf97a6d12017-10-13 17:40:0261
62You can run the Windows binaries you built on swarming, like so:
63
64 tools/mb/mb.py isolate //out/gnwin base_unittests
65 tools/swarming_client/isolate.py archive \
66 -I https://isolateserver.appspot.com \
67 -i out/gnwin/base_unittests.isolate \
68 -s out/gnwin/base_unittests.isolated
69 tools/swarming_client/swarming.py trigger \
70 -S https://chromium-swarm.appspot.com \
71 -I https://isolateserver.appspot.com \
72 -d os Windows -d pool Chrome -s <hash printed by previous command>
Ali Tofighdc1376e2017-10-30 16:44:5773 [ -- <flag to target process, for example --gtest_filter>... ]
Nico Weberbf97a6d12017-10-13 17:40:0274
75Most tests that build should pass. However, the cross build uses
76the lld linker, and a couple of tests fail when using lld. You can look at
77https://build.chromium.org/p/chromium.clang/builders/CrWinClangLLD%20tester
78to get an idea of which tests fail with lld.
79
80TODO(thakis): It'd be nice if there was a script for doing this. Maybe make
81tools/fuchsa/run-swarmed.py work for win cross builds too, or create
82`run_base_unittests` script targets during the build (like Android).