Nico Weber | bf97a6d1 | 2017-10-13 17:40:02 | [diff] [blame] | 1 | # Cross-compiling Chrome/win |
| 2 | |
Nico Weber | ce96b470 | 2017-12-14 18:52:31 | [diff] [blame] | 3 | It's possible to build most parts of the codebase on a Linux or Mac host while |
| 4 | targeting Windows. This document describes how to set that up, and current |
| 5 | restrictions. |
Nico Weber | bf97a6d1 | 2017-10-13 17:40:02 | [diff] [blame] | 6 | |
| 7 | What does *not* work: |
| 8 | |
Takashi Toyoshima | 0dab2f0 | 2017-10-31 09:10:58 | [diff] [blame] | 9 | * goma. Sorry. ([internal bug](http://b/64390790)) You can use the |
Nico Weber | 495e955 | 2017-10-23 20:03:07 | [diff] [blame] | 10 | [jumbo build](jumbo.md) for faster build times. |
Sebastien Marchand | 2ab1268 | 2018-02-27 21:19:52 | [diff] [blame] | 11 | * 64-bit renderer processes don't use V8 snapshots, slowing down their startup |
| 12 | ([bug](https://crbug.com/803591)) |
Nico Weber | ce96b470 | 2017-12-14 18:52:31 | [diff] [blame] | 13 | * on Mac hosts, building a 32-bit chrome ([bug](https://crbug.com/794838)) |
Nico Weber | bf97a6d1 | 2017-10-13 17:40:02 | [diff] [blame] | 14 | |
Nico Weber | 495e955 | 2017-10-23 20:03:07 | [diff] [blame] | 15 | All other targets build fine (including `chrome`, `browser_tests`, ...). |
| 16 | |
Lei Zhang | 4d34c1fb | 2017-10-23 22:29:37 | [diff] [blame] | 17 | Uses of `.asm` files have been stubbed out. As a result, some of Skia's |
Sebastien Marchand | 2ab1268 | 2018-02-27 21:19:52 | [diff] [blame] | 18 | software rendering fast paths are not present in cross builds, Crashpad cannot |
Nico Weber | 495e955 | 2017-10-23 20:03:07 | [diff] [blame] | 19 | report crashes, and NaCl defaults to disabled and cannot be enabled in |
Nico Weber | a3a4b22 | 2017-10-23 20:08:45 | [diff] [blame] | 20 | cross builds ([.asm bug](https://crbug.com/762167)). |
Nico Weber | bf97a6d1 | 2017-10-13 17:40:02 | [diff] [blame] | 21 | |
| 22 | ## .gclient setup |
| 23 | |
| 24 | 1. Tell gclient that you need Windows build dependencies by adding |
| 25 | `target_os = ['win']` to the end of your `.gclient`. (If you already |
Lei Zhang | 4d34c1fb | 2017-10-23 22:29:37 | [diff] [blame] | 26 | 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 Weber | bf97a6d1 | 2017-10-13 17:40:02 | [diff] [blame] | 35 | 1. `gclient sync`, follow instructions on screen. |
| 36 | |
| 37 | If you're at Google, this will automatically download the Windows SDK for you. |
Tom Sepez | 3e3f0ceda | 2017-10-23 21:18:02 | [diff] [blame] | 38 | If this fails with an error: Please follow the instructions at |
| 39 | https://www.chromium.org/developers/how-tos/build-instructions-windows |
| 40 | then 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 Weber | bf97a6d1 | 2017-10-13 17:40:02 | [diff] [blame] | 46 | If you are not at Google, you'll have to figure out how to get the SDK, and |
| 47 | you'll need to put a JSON file describing the SDK layout in a certain location. |
| 48 | |
Nico Weber | a001bab | 2017-10-23 20:11:10 | [diff] [blame] | 49 | ## GN setup |
Nico Weber | bf97a6d1 | 2017-10-13 17:40:02 | [diff] [blame] | 50 | |
| 51 | Add `target_os = "win"` to your args.gn. Then just build, e.g. |
| 52 | |
| 53 | ninja -C out/gnwin base_unittests.exe |
| 54 | |
Nico Weber | 1f05f16 | 2018-01-22 19:06:42 | [diff] [blame] | 55 | ## Copying and running chrome |
| 56 | |
| 57 | A 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 |
| 59 | to the Windows box and run it to install the chrome you just built. |
| 60 | |
Nico Weber | a001bab | 2017-10-23 20:11:10 | [diff] [blame] | 61 | ## Running tests on swarming |
Nico Weber | bf97a6d1 | 2017-10-13 17:40:02 | [diff] [blame] | 62 | |
| 63 | You can run the Windows binaries you built on swarming, like so: |
| 64 | |
Sebastien Marchand | 2ab1268 | 2018-02-27 21:19:52 | [diff] [blame] | 65 | tools/run_swarmed.py -C out/gnwin -t base_unittests [ --gtest_filter=... ] |
Nico Weber | bf97a6d1 | 2017-10-13 17:40:02 | [diff] [blame] | 66 | |
Sebastien Marchand | 2ab1268 | 2018-02-27 21:19:52 | [diff] [blame] | 67 | See the contents of run_swarmed.py for how to do this manually. |
Nico Weber | bf97a6d1 | 2017-10-13 17:40:02 | [diff] [blame] | 68 | |
Sebastien Marchand | 2ab1268 | 2018-02-27 21:19:52 | [diff] [blame] | 69 | There's a bot doing 64-bit release cross builds at |
| 70 | https://ci.chromium.org/buildbot/chromium.clang/linux-win_cross-rel/ |
| 71 | which also runs tests. You can look at it to get an idea of which tests pass in |
| 72 | the cross build. |