blob: 2ba25add7ba4ea63c2fe6af256226f092964b913 [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.
Sebastien Marchand2ab12682018-02-27 21:19:5211* 64-bit renderer processes don't use V8 snapshots, slowing down their startup
12 ([bug](https://crbug.com/803591))
Nico Weberce96b4702017-12-14 18:52:3113* on Mac hosts, building a 32-bit chrome ([bug](https://crbug.com/794838))
Nico Weberbf97a6d12017-10-13 17:40:0214
Nico Weber495e9552017-10-23 20:03:0715All other targets build fine (including `chrome`, `browser_tests`, ...).
16
Lei Zhang4d34c1fb2017-10-23 22:29:3717Uses of `.asm` files have been stubbed out. As a result, some of Skia's
Sebastien Marchand2ab12682018-02-27 21:19:5218software rendering fast paths are not present in cross builds, Crashpad cannot
Nico Weber495e9552017-10-23 20:03:0719report crashes, and NaCl defaults to disabled and cannot be enabled in
Nico Webera3a4b222017-10-23 20:08:4520cross builds ([.asm bug](https://crbug.com/762167)).
Nico Weberbf97a6d12017-10-13 17:40:0221
22## .gclient setup
23
241. Tell gclient that you need Windows build dependencies by adding
25 `target_os = ['win']` to the end of your `.gclient`. (If you already
Lei Zhang4d34c1fb2017-10-23 22:29:3726 have a `target_os` line in there, just add `'win'` to the list.) e.g.
27
28 solutions = [
29 {
30 ...
31 }
32 ]
33 target_os = ['android', 'win']
34
Nico Weberbf97a6d12017-10-13 17:40:02351. `gclient sync`, follow instructions on screen.
36
37If you're at Google, this will automatically download the Windows SDK for you.
Tom Sepez3e3f0ceda2017-10-23 21:18:0238If this fails with an error: Please follow the instructions at
39https://www.chromium.org/developers/how-tos/build-instructions-windows
40then you may need to re-authenticate via:
41
42 cd path/to/chrome/src
43 # Follow instructions, enter 0 as project id.
44 download_from_google_storage --config
45
Nico Weberbf97a6d12017-10-13 17:40:0246If you are not at Google, you'll have to figure out how to get the SDK, and
47you'll need to put a JSON file describing the SDK layout in a certain location.
48
Nico Webera001bab2017-10-23 20:11:1049## GN setup
Nico Weberbf97a6d12017-10-13 17:40:0250
51Add `target_os = "win"` to your args.gn. Then just build, e.g.
52
53 ninja -C out/gnwin base_unittests.exe
54
Nico Weber1f05f162018-01-22 19:06:4255## Copying and running chrome
56
57A convenient way to copy chrome over to a Windows box is to build the
58`mini_installer` target. Then, copy just `mini_installer.exe` over
59to the Windows box and run it to install the chrome you just built.
60
Nico Webera001bab2017-10-23 20:11:1061## Running tests on swarming
Nico Weberbf97a6d12017-10-13 17:40:0262
63You can run the Windows binaries you built on swarming, like so:
64
Sebastien Marchand2ab12682018-02-27 21:19:5265 tools/run_swarmed.py -C out/gnwin -t base_unittests [ --gtest_filter=... ]
Nico Weberbf97a6d12017-10-13 17:40:0266
Sebastien Marchand2ab12682018-02-27 21:19:5267See the contents of run_swarmed.py for how to do this manually.
Nico Weberbf97a6d12017-10-13 17:40:0268
Sebastien Marchand2ab12682018-02-27 21:19:5269There's a bot doing 64-bit release cross builds at
70https://ci.chromium.org/buildbot/chromium.clang/linux-win_cross-rel/
71which also runs tests. You can look at it to get an idea of which tests pass in
72the cross build.