dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 1 | # Checking out and building Chromium on Linux |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 2 | |
Victor Costan | 44af72b | 2017-11-13 20:01:30 | [diff] [blame] | 3 | There are instructions for other platforms linked from the |
Nicolas Norvez | ba04006 | 2020-01-15 01:17:26 | [diff] [blame] | 4 | [get the code](../get_the_code.md) page. |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 5 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 6 | ## Instructions for Google Employees |
| 7 | |
| 8 | Are you a Google employee? See |
| 9 | [go/building-chrome](https://goto.google.com/building-chrome) instead. |
andybons | 8c02a1f | 2015-09-04 17:02:32 | [diff] [blame] | 10 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 11 | [TOC] |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 12 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 13 | ## System requirements |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 14 | |
Bruce Dawson | c266172 | 2024-06-12 19:44:29 | [diff] [blame] | 15 | * An x86-64 machine with at least 8GB of RAM. More than 16GB is highly |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 16 | recommended. If your machine has an SSD, it is recommended to have |
| 17 | \>=32GB/>=16GB of swap for machines with 8GB/16GB of RAM respectively. |
| 18 | * At least 100GB of free disk space. It does not have to be on the same drive; |
| 19 | Allocate ~50-80GB on HDD for build. |
zhoupeng | 6ebd49d | 2025-04-03 20:45:00 | [diff] [blame] | 20 | * You must have Git and Python v3.9+ installed already (and `python3` must point |
| 21 | to a Python v3.9+ binary). Depot_tools bundles an appropriate version |
Dirk Pranke | 8766b622c | 2023-08-30 23:19:36 | [diff] [blame] | 22 | of Python in `$depot_tools/python-bin`, if you don't have an appropriate |
| 23 | version already on your system. |
Junji Watanabe | dab18d13 | 2025-04-09 04:04:01 | [diff] [blame] | 24 | * Chromium's build infrastructure and `depot_tools` currently use Python 3.11. |
| 25 | If something is broken with an older Python version, feel free to report or |
| 26 | send us fixes. |
Peter Kasting | beb265c | 2024-10-31 20:22:56 | [diff] [blame] | 27 | * `libc++` is currently the only supported STL. `clang` is the only |
| 28 | officially-supported compiler, though external community members generally |
| 29 | keep things building with `gcc`. For more details, see the |
| 30 | [supported toolchains doc](../toolchain_support.md). |
Ben Pastene | d89a45b | 2023-06-28 22:57:34 | [diff] [blame] | 31 | |
| 32 | Most development is done on Ubuntu (Chromium's build infrastructure currently |
| 33 | runs 22.04, Jammy Jellyfish). There are some instructions for other distros |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 34 | below, but they are mostly unsupported, but installation instructions can be found in [Docker](#docker). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 35 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 36 | ## Install `depot_tools` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 37 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 38 | Clone the `depot_tools` repository: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 39 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 40 | ```shell |
| 41 | $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
| 42 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 43 | |
mark a. foltz | 89670afb | 2023-08-20 18:14:07 | [diff] [blame] | 44 | Add `depot_tools` to the beginning of your `PATH` (you will probably want to put |
| 45 | this in your `~/.bashrc` or `~/.zshrc`). Assuming you cloned `depot_tools` to |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 46 | `/path/to/depot_tools`: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 47 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 48 | ```shell |
mark a. foltz | 89670afb | 2023-08-20 18:14:07 | [diff] [blame] | 49 | $ export PATH="/path/to/depot_tools:$PATH" |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 50 | ``` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 51 | |
Claudio DeSouza | ae44ac1 | 2018-02-13 16:11:45 | [diff] [blame] | 52 | When cloning `depot_tools` to your home directory **do not** use `~` on PATH, |
| 53 | otherwise `gclient runhooks` will fail to run. Rather, you should use either |
| 54 | `$HOME` or the absolute path: |
| 55 | |
| 56 | ```shell |
mark a. foltz | 89670afb | 2023-08-20 18:14:07 | [diff] [blame] | 57 | $ export PATH="${HOME}/depot_tools:$PATH" |
Claudio DeSouza | ae44ac1 | 2018-02-13 16:11:45 | [diff] [blame] | 58 | ``` |
| 59 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 60 | ## Get the code |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 61 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 62 | Create a `chromium` directory for the checkout and change to it (you can call |
| 63 | this whatever you like and put it wherever you like, as long as the full path |
| 64 | has no spaces): |
| 65 | |
| 66 | ```shell |
| 67 | $ mkdir ~/chromium && cd ~/chromium |
| 68 | ``` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 69 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 70 | Run the `fetch` tool from depot_tools to check out the code and its |
| 71 | dependencies. |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 72 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 73 | ```shell |
| 74 | $ fetch --nohooks chromium |
| 75 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 76 | |
Delan Azabani | 43eefa3d | 2024-05-09 03:39:33 | [diff] [blame] | 77 | *** note |
| 78 | **NixOS users:** tools like `fetch` wonât work without a Nix shell. Clone [the |
| 79 | tools repo](https://chromium.googlesource.com/chromium/src/tools) with `git`, |
| 80 | then run `nix-shell tools/nix/shell.nix`. |
| 81 | *** |
| 82 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 83 | If you don't want the full repo history, you can save a lot of time by |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 84 | adding the `--no-history` flag to `fetch`. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 85 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 86 | Expect the command to take 30 minutes on even a fast connection, and many |
| 87 | hours on slower ones. |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 88 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 89 | If you've already installed the build dependencies on the machine (from another |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 90 | checkout, for example), you can omit the `--nohooks` flag and `fetch` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 91 | will automatically execute `gclient runhooks` at the end. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 92 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 93 | When `fetch` completes, it will have created a hidden `.gclient` file and a |
| 94 | directory called `src` in the working directory. The remaining instructions |
| 95 | assume you have switched to the `src` directory: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 96 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 97 | ```shell |
| 98 | $ cd src |
| 99 | ``` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 100 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 101 | ### Install additional build dependencies |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 102 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 103 | Once you have checked out the code, and assuming you're using Ubuntu, run |
| 104 | [build/install-build-deps.sh](/build/install-build-deps.sh) |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 105 | |
Aaron Gable | 3bc9368 | 2019-01-11 02:16:07 | [diff] [blame] | 106 | ```shell |
| 107 | $ ./build/install-build-deps.sh |
| 108 | ``` |
| 109 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 110 | You may need to adjust the build dependencies for other distros. There are |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 111 | some [notes](#notes-for-other-distros) at the end of this document, but we make no guarantees |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 112 | for their accuracy. |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 113 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 114 | ### Run the hooks |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 115 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 116 | Once you've run `install-build-deps` at least once, you can now run the |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 117 | Chromium-specific hooks, which will download additional binaries and other |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 118 | things you might need: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 119 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 120 | ```shell |
| 121 | $ gclient runhooks |
| 122 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 123 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 124 | *Optional*: You can also [install API |
| 125 | keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your |
| 126 | build to talk to some Google services, but this is not necessary for most |
| 127 | development and testing purposes. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 128 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 129 | ## Setting up the build |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 130 | |
Richard Wang | 01a39171 | 2025-08-21 06:37:10 | [diff] [blame] | 131 | Chromium uses [Siso](https://pkg.go.dev/go.chromium.org/build/siso#section-readme) |
Fumitoshi Ukai | c9f326d | 2025-04-24 01:06:28 | [diff] [blame] | 132 | as its main build tool along with |
Andrew Williams | bbc1a1e | 2021-07-21 01:51:22 | [diff] [blame] | 133 | a tool called [GN](https://gn.googlesource.com/gn/+/main/docs/quick_start.md) |
Tom Bridgwater | eef40154 | 2018-08-17 00:54:43 | [diff] [blame] | 134 | to generate `.ninja` files. You can create any number of *build directories* |
| 135 | with different configurations. To create a build directory, run: |
andybons | 8c02a1f | 2015-09-04 17:02:32 | [diff] [blame] | 136 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 137 | ```shell |
| 138 | $ gn gen out/Default |
| 139 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 140 | |
Fumitoshi Ukai | c9f326d | 2025-04-24 01:06:28 | [diff] [blame] | 141 | * You only have to run this once for each new build directory, Siso will |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 142 | update the build files as needed. |
| 143 | * You can replace `Default` with another name, but |
| 144 | it should be a subdirectory of `out`. |
| 145 | * For other build arguments, including release settings, see [GN build |
| 146 | configuration](https://www.chromium.org/developers/gn-build-configuration). |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 147 | The default will be a debug component build matching the current host |
| 148 | operating system and CPU. |
| 149 | * For more info on GN, run `gn help` on the command line or read the |
Andrew Williams | bbc1a1e | 2021-07-21 01:51:22 | [diff] [blame] | 150 | [quick start guide](https://gn.googlesource.com/gn/+/main/docs/quick_start.md). |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 151 | |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 152 | ### Faster builds |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 153 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 154 | This section contains some things you can change to speed up your builds, |
| 155 | sorted so that the things that make the biggest difference are first. |
| 156 | |
Fumitoshi Ukai | 33465857 | 2025-04-09 00:59:30 | [diff] [blame] | 157 | #### Use Remote Execution |
Takuto Ikuta | 66f5de8 | 2023-09-08 03:55:44 | [diff] [blame] | 158 | |
Takuto Ikuta | 77654728 | 2023-11-10 01:42:33 | [diff] [blame] | 159 | *** note |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 160 | **Warning:** If you are a Google employee, do not follow the instructions below. |
Andrew Williams | 54da9cc | 2024-01-09 17:32:23 | [diff] [blame] | 161 | See |
Fumitoshi Ukai | 633b1c7 | 2025-06-30 09:08:00 | [diff] [blame] | 162 | [go/chrome-linux-build#set-up-remote-execution](https://goto.google.com/chrome-linux-build#set-up-remote-execution) |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 163 | instead. |
Takuto Ikuta | 77654728 | 2023-11-10 01:42:33 | [diff] [blame] | 164 | *** |
| 165 | |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 166 | Chromium's build can be sped up significantly by using a remote execution system |
| 167 | compatible with [REAPI](https://github.com/bazelbuild/remote-apis). This allows |
| 168 | you to benefit from remote caching and executing many build actions in parallel |
| 169 | on a shared cluster of workers. |
Fumitoshi Ukai | 8c123e9 | 2025-04-23 06:06:44 | [diff] [blame] | 170 | Chromium's build uses a client developed by Google called |
Richard Wang | 01a39171 | 2025-08-21 06:37:10 | [diff] [blame] | 171 | [Siso](https://pkg.go.dev/go.chromium.org/build/siso#section-readme) |
Fumitoshi Ukai | 8c123e9 | 2025-04-23 06:06:44 | [diff] [blame] | 172 | to remotely execute build actions. |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 173 | |
Fumitoshi Ukai | 8c123e9 | 2025-04-23 06:06:44 | [diff] [blame] | 174 | To get started, you need access to an REAPI-compatible backend. |
| 175 | |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 176 | ##### Google RBE |
| 177 | |
Fumitoshi Ukai | 8c123e9 | 2025-04-23 06:06:44 | [diff] [blame] | 178 | The following instructions assume that you received an invitation from Google |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 179 | to use Chromium's Google RBE service and were granted access to it. |
| 180 | Otherwise, see [non Google RBE](#non-google-rbe) instead. |
| 181 | |
Takuto Ikuta | 1b118a8 | 2023-11-28 05:55:25 | [diff] [blame] | 182 | For contributors who have |
| 183 | [tryjob access](https://www.chromium.org/getting-involved/become-a-committer/#try-job-access) |
| 184 | , please ask a Googler to email accounts@chromium.org on your behalf to access |
Fumitoshi Ukai | 8c123e9 | 2025-04-23 06:06:44 | [diff] [blame] | 185 | RBE backend paid by Google. Note that remote execution for external |
| 186 | contributors is a best-effort process. We do not guarantee when you will be |
| 187 | invited. |
Takuto Ikuta | 1b118a8 | 2023-11-28 05:55:25 | [diff] [blame] | 188 | |
Fumitoshi Ukai | 8c123e9 | 2025-04-23 06:06:44 | [diff] [blame] | 189 | If you would like to use `siso` with Google's RBE, |
Fumitoshi Ukai | 33465857 | 2025-04-09 00:59:30 | [diff] [blame] | 190 | you'll first need to: |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 191 | |
Fumitoshi Ukai | 33465857 | 2025-04-09 00:59:30 | [diff] [blame] | 192 | 1. Run `siso login` and login with your authorized account. |
Fumitoshi Ukai | 349627a | 2025-08-08 02:15:16 | [diff] [blame] | 193 | If it is blocked in OAuth2 flow, run `gcloud auth login` (and |
| 194 | export environment variable `SISO_CREDENTIAL_HELPER=gcloud` |
| 195 | since siso v1.3.12). |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 196 | |
| 197 | Next, you'll have to specify your `rbe_instance` in your `.gclient` |
| 198 | configuration to use the correct one for Chromium contributors: |
| 199 | |
Michael Savigny | 9560099 | 2024-04-10 13:59:10 | [diff] [blame] | 200 | *** note |
| 201 | **Warning:** If you are a Google employee, do not follow the instructions below. |
| 202 | See |
Fumitoshi Ukai | 633b1c7 | 2025-06-30 09:08:00 | [diff] [blame] | 203 | [go/chrome-linux-build#set-up-remote-execution](https://goto.google.com/chrome-linux-build#set-up-remote-execution) |
Michael Savigny | 9560099 | 2024-04-10 13:59:10 | [diff] [blame] | 204 | instead. |
| 205 | *** |
| 206 | |
Takuto Ikuta | 66f5de8 | 2023-09-08 03:55:44 | [diff] [blame] | 207 | ``` |
| 208 | solutions = [ |
| 209 | { |
| 210 | ..., |
| 211 | "custom_vars": { |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 212 | # This is the correct instance name for using Chromium's RBE service. |
| 213 | # You can only use it if you were granted access to it. If you use your |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 214 | # own REAPI-compatible backend, you will need to set reapi_address, |
| 215 | # reapi_instance and reapi_backend_config_path instead. |
| 216 | # see [non Google RBE](#non-google-rbe) below. |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 217 | "rbe_instance": "projects/rbe-chromium-untrusted/instances/default_instance", |
Takuto Ikuta | 66f5de8 | 2023-09-08 03:55:44 | [diff] [blame] | 218 | }, |
| 219 | }, |
| 220 | ] |
| 221 | ``` |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 222 | |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 223 | And run `gclient sync`. This will regenerate the config files in |
| 224 | `build/config/siso/.sisoenv` and |
| 225 | `build/config/siso/backend_config/backend.star` to use the Google RBE |
| 226 | that you just added to your `.gclient` file. |
| 227 | |
| 228 | ##### non Google RBE |
| 229 | |
| 230 | For others who have no access to Google's RBE backends, you are welcome |
| 231 | to use any of the |
| 232 | [other compatible backends](https://github.com/bazelbuild/remote-apis#servers), |
| 233 | in which case you will have to adapt the following instructions regarding the |
| 234 | authentication method, instance name, etc. to work with your backend. |
| 235 | |
| 236 | - If it is in closed network and no authentication, export environment variable |
| 237 | `RBE_service_no_security=true`. |
| 238 | - If it uses mTLS, export environment variable `RBE_tls_client_auth_key` and |
| 239 | `RBE_tls_client_auth_cert`. |
Fumitoshi Ukai | 8befc28b | 2025-09-03 01:49:20 | [diff] [blame] | 240 | - If it uses Google OAuth2, you may use `gcloud`. run `gcloud auth login` |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 241 | (and export environment variable `SISO_CREDENTIAL_HELPER=gcloud` since |
| 242 | siso v1.3.12). |
| 243 | - Otherwise, you may need to use your own |
| 244 | [credential helper](https://github.com/EngFlow/credential-helper-spec/blob/main/spec.md). |
| 245 | export environment variable |
| 246 | `SISO_CREDENTIAL_HELPER=/path/to/your/credhelper`. |
| 247 | |
| 248 | For own REAPI backend other than Google RBE, you need to prepare own |
| 249 | backend.star. |
| 250 | |
| 251 | e.g. for backend with no large worker pool |
| 252 | ``` |
| 253 | load("@builtin//struct.star", "module") |
| 254 | |
| 255 | def __platform_properties(ctx): |
Fumitoshi Ukai | 3901d6b | 2025-09-02 07:06:51 | [diff] [blame] | 256 | # fyi: this image is created by |
| 257 | # https://chromium.googlesource.com/infra/infra/+/refs/heads/main/rbe/images/siso-chromium/linux/Dockerfile |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 258 | container_image = "docker://gcr.io/chops-public-images-prod/rbe/siso-chromium/linux@sha256:d7cb1ab14a0f20aa669c23f22c15a9dead761dcac19f43985bf9dd5f41fbef3a" |
| 259 | return { |
| 260 | "default": { |
Fumitoshi Ukai | 3901d6b | 2025-09-02 07:06:51 | [diff] [blame] | 261 | # set platform properties for your worker. |
| 262 | # it depends on how you configure your workers. |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 263 | "OSFamily": "Linux", |
| 264 | "container-image": container_image, |
Fumitoshi Ukai | 3901d6b | 2025-09-02 07:06:51 | [diff] [blame] | 265 | # e.g. to use worker in worker pool "linux_x64". |
| 266 | # "Pool": "linux_x64", |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 267 | }, |
Fumitoshi Ukai | 3901d6b | 2025-09-02 07:06:51 | [diff] [blame] | 268 | # no Large workers. empty platform properties will run locally. |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 269 | "large": {}, |
| 270 | } |
| 271 | |
| 272 | backend = module( |
| 273 | "backend", |
| 274 | platform_properties = __platform_properties, |
| 275 | ) |
| 276 | ``` |
| 277 | See |
Fumitoshi Ukai | 3901d6b | 2025-09-02 07:06:51 | [diff] [blame] | 278 | [build/config/siso/backend_config/README.md](../../build/config/siso/backend_config/README.md), |
| 279 | [remote apis platform lexicon](https://github.com/bazelbuild/remote-apis/blob/main/build/bazel/remote/execution/v2/platform.md). |
| 280 | Also check your REAPI documentations. |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 281 | |
| 282 | Set `reapi_address`, `reapi_instance` and `reapi_backend_config_path` which |
| 283 | is the path name for the your backend.star above. |
Fumitoshi Ukai | dd41b903 | 2025-08-12 05:23:46 | [diff] [blame] | 284 | |
| 285 | ``` |
| 286 | solutions = [ |
| 287 | { |
| 288 | "custom_vars": { |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 289 | "reapi_instance": "default", # your instance name |
| 290 | "reapi_address": "remotebuild.example.com:443", # your backend address |
| 291 | "reapi_backend_config_path": "/path/to/your/backend.star", |
Fumitoshi Ukai | dd41b903 | 2025-08-12 05:23:46 | [diff] [blame] | 292 | }, |
| 293 | } |
| 294 | ] |
| 295 | ``` |
| 296 | |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 297 | And run `gclient sync`. This will regenerate the config files in |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 298 | `build/config/siso/.sisoenv` and |
Fumitoshi Ukai | dd41b903 | 2025-08-12 05:23:46 | [diff] [blame] | 299 | `build/config/siso/backend_config/backend.star` to use the REAPI instance |
Fumitoshi Ukai | 33465857 | 2025-04-09 00:59:30 | [diff] [blame] | 300 | that you just added to your `.gclient` file. |
Fumitoshi Ukai | 8c123e9 | 2025-04-23 06:06:44 | [diff] [blame] | 301 | |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 302 | Tip: you may want to use `--reapi_grpc_conn_pool=1` or so to limit |
| 303 | connection pool for reapi access. |
| 304 | |
| 305 | Tip: you may want to use `--reapi_keep_exec_stream` if your backend |
| 306 | terminates action when grpc stream is cancelled or closed, and |
| 307 | doesn't work with WaitExecution. |
| 308 | |
Fumitoshi Ukai | 913b8fe | 2025-09-04 05:15:42 | [diff] [blame] | 309 | Tip: you can put these flags in `build/config/siso/.sisorc` like |
| 310 | |
| 311 | ```shell |
| 312 | ninja --reapi_grpc_conn_pool=1 --reapi_keep_exec_stream |
| 313 | ``` |
| 314 | so siso will use these flags for `siso ninja`, or `autoninja`. |
| 315 | |
Fumitoshi Ukai | d65112d7 | 2025-09-02 01:43:53 | [diff] [blame] | 316 | ##### gn setup for remote execution |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 317 | |
| 318 | Then, add the following GN args to your `args.gn`: |
| 319 | |
Takuto Ikuta | 66f5de8 | 2023-09-08 03:55:44 | [diff] [blame] | 320 | ``` |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 321 | use_remoteexec = true |
Fumitoshi Ukai | 33465857 | 2025-04-09 00:59:30 | [diff] [blame] | 322 | use_siso = true |
Takuto Ikuta | 66f5de8 | 2023-09-08 03:55:44 | [diff] [blame] | 323 | ``` |
| 324 | |
Fumitoshi Ukai | 8c123e9 | 2025-04-23 06:06:44 | [diff] [blame] | 325 | If `args.gn` contains `use_reclient=true`, drop it or replace it with |
| 326 | `use_reclient=false`. |
| 327 | |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 328 | That's it. Remember to always use `autoninja` for building Chromium as described |
Fumitoshi Ukai | c9f326d | 2025-04-24 01:06:28 | [diff] [blame] | 329 | below, instead of directly invoking `siso` or `ninja`. |
Philipp Wollermann | 43f9cb8 | 2023-11-27 05:33:19 | [diff] [blame] | 330 | |
Fumitoshi Ukai | 8c123e9 | 2025-04-23 06:06:44 | [diff] [blame] | 331 | Reach out to |
| 332 | [build@chromium.org](https://groups.google.com/a/chromium.org/g/build) |
| 333 | if you have any questions about remote execution usage. |
| 334 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 335 | #### Include fewer debug symbols |
| 336 | |
| 337 | By default GN produces a build with all of the debug assertions enabled |
| 338 | (`is_debug=true`) and including full debug info (`symbol_level=2`). Setting |
| 339 | `symbol_level=1` will produce enough information for stack traces, but not |
| 340 | line-by-line debugging. Setting `symbol_level=0` will include no debug |
| 341 | symbols at all. Either will speed up the build compared to full symbols. |
| 342 | |
Bruce Dawson | 63e0be7 | 2021-11-29 20:34:41 | [diff] [blame] | 343 | #### Disable debug symbols for Blink and v8 |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 344 | |
| 345 | Due to its extensive use of templates, the Blink code produces about half |
| 346 | of our debug symbols. If you don't ever need to debug Blink, you can set |
Bruce Dawson | 63e0be7 | 2021-11-29 20:34:41 | [diff] [blame] | 347 | the GN arg `blink_symbol_level=0`. Similarly, if you don't need to debug v8 you |
| 348 | can improve build speeds by setting the GN arg `v8_symbol_level=0`. |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 349 | |
| 350 | #### Use Icecc |
| 351 | |
| 352 | [Icecc](https://github.com/icecc/icecream) is the distributed compiler with a |
| 353 | central scheduler to share build load. Currently, many external contributors use |
Fumitoshi Ukai | 33465857 | 2025-04-09 00:59:30 | [diff] [blame] | 354 | it. e.g. Intel, Opera, Samsung (this is not useful if you're using Siso). |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 355 | |
| 356 | In order to use `icecc`, set the following GN args: |
| 357 | |
| 358 | ``` |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 359 | use_debug_fission=false |
| 360 | is_clang=false |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 361 | ``` |
| 362 | |
Victor Costan | 44af72b | 2017-11-13 20:01:30 | [diff] [blame] | 363 | See these links for more on the |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 364 | [bundled_binutils limitation](https://github.com/icecc/icecream/commit/b2ce5b9cc4bd1900f55c3684214e409fa81e7a92), |
| 365 | the [debug fission limitation](http://gcc.gnu.org/wiki/DebugFission). |
| 366 | |
| 367 | Using the system linker may also be necessary when using glibc 2.21 or newer. |
| 368 | See [related bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808181). |
| 369 | |
| 370 | #### ccache |
| 371 | |
David Sanders | ddc9a7f | 2022-01-28 03:19:19 | [diff] [blame] | 372 | You can use [ccache](https://ccache.dev) to speed up local builds (again, |
Fumitoshi Ukai | 33465857 | 2025-04-09 00:59:30 | [diff] [blame] | 373 | this is not useful if you're using Siso). |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 374 | |
| 375 | Increase your ccache hit rate by setting `CCACHE_BASEDIR` to a parent directory |
| 376 | that the working directories all have in common (e.g., |
| 377 | `/home/yourusername/development`). Consider using |
| 378 | `CCACHE_SLOPPINESS=include_file_mtime` (since if you are using multiple working |
| 379 | directories, header times in svn sync'ed portions of your trees will be |
| 380 | different - see |
David Sanders | ddc9a7f | 2022-01-28 03:19:19 | [diff] [blame] | 381 | [the ccache troubleshooting section](https://ccache.dev/manual/latest.html#_troubleshooting) |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 382 | for additional information). If you use symbolic links from your home directory |
| 383 | to get to the local physical disk directory where you keep those working |
| 384 | development directories, consider putting |
| 385 | |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 386 | ``` |
| 387 | alias cd="cd -P" |
| 388 | ``` |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 389 | |
| 390 | in your `.bashrc` so that `$PWD` or `cwd` always refers to a physical, not |
| 391 | logical directory (and make sure `CCACHE_BASEDIR` also refers to a physical |
| 392 | parent). |
| 393 | |
| 394 | If you tune ccache correctly, a second working directory that uses a branch |
| 395 | tracking trunk and is up to date with trunk and was gclient sync'ed at about the |
| 396 | same time should build chrome in about 1/3 the time, and the cache misses as |
| 397 | reported by `ccache -s` should barely increase. |
| 398 | |
Song Fangzhen | 4b68a6e3 | 2021-07-14 05:53:40 | [diff] [blame] | 399 | This is especially useful if you use |
| 400 | [git-worktree](http://git-scm.com/docs/git-worktree) and keep multiple local |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 401 | working directories going at once. |
| 402 | |
| 403 | #### Using tmpfs |
| 404 | |
| 405 | You can use tmpfs for the build output to reduce the amount of disk writes |
| 406 | required. I.e. mount tmpfs to the output directory where the build output goes: |
| 407 | |
| 408 | As root: |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 409 | ``` |
| 410 | mount -t tmpfs -o size=20G,nr_inodes=40k,mode=1777 tmpfs /path/to/out |
| 411 | ``` |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 412 | |
| 413 | *** note |
| 414 | **Caveat:** You need to have enough RAM + swap to back the tmpfs. For a full |
| 415 | debug build, you will need about 20 GB. Less for just building the chrome target |
| 416 | or for a release build. |
| 417 | *** |
| 418 | |
| 419 | Quick and dirty benchmark numbers on a HP Z600 (Intel core i7, 16 cores |
| 420 | hyperthreaded, 12 GB RAM) |
| 421 | |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 422 | * With tmpfs: |
| 423 | * 12m:20s |
| 424 | * Without tmpfs |
| 425 | * 15m:40s |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 426 | |
Bruce Dawson | be82320 | 2022-03-10 23:40:50 | [diff] [blame] | 427 | ### Smaller builds |
| 428 | |
| 429 | The Chrome binary contains embedded symbols by default. You can reduce its size |
| 430 | by using the Linux `strip` command to remove this debug information. You can |
Peter BostrÃļm | 3874896 | 2023-05-08 21:24:26 | [diff] [blame] | 431 | also reduce binary size and turn on all optimizations by enabling official build |
| 432 | mode, with the GN arg `is_official_build = true`. |
Bruce Dawson | be82320 | 2022-03-10 23:40:50 | [diff] [blame] | 433 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 434 | ## Build Chromium |
| 435 | |
Fumitoshi Ukai | c9f326d | 2025-04-24 01:06:28 | [diff] [blame] | 436 | Build Chromium (the "chrome" target) with Siso or Ninja using the command: |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 437 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 438 | ```shell |
Max Moroz | f5b31fcd | 2018-08-10 21:55:48 | [diff] [blame] | 439 | $ autoninja -C out/Default chrome |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 440 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 441 | |
Dirk Pranke | 8bd55f2 | 2018-10-24 21:22:10 | [diff] [blame] | 442 | (`autoninja` is a wrapper that automatically provides optimal values for the |
Fumitoshi Ukai | c9f326d | 2025-04-24 01:06:28 | [diff] [blame] | 443 | arguments passed to `siso` or `ninja`.) |
Max Moroz | f5b31fcd | 2018-08-10 21:55:48 | [diff] [blame] | 444 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 445 | You can get a list of all of the other build targets from GN by running `gn ls |
Fumitoshi Ukai | c9f326d | 2025-04-24 01:06:28 | [diff] [blame] | 446 | out/Default` from the command line. To compile one, pass the GN label to |
| 447 | Siso/Ninja with no preceding "//" (so, for `//chrome/test:unit_tests` use |
| 448 | `autoninja -C out/Default chrome/test:unit_tests`). |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 449 | |
Fumitoshi Ukai | 8a88885 | 2025-09-05 01:42:55 | [diff] [blame] | 450 | Tips: See [Siso tips](../siso_tips.md). |
Junji Watanabe | 7037b95f | 2024-04-22 06:14:15 | [diff] [blame] | 451 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 452 | ## Run Chromium |
| 453 | |
| 454 | Once it is built, you can simply run the browser: |
| 455 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 456 | ```shell |
| 457 | $ out/Default/chrome |
| 458 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 459 | |
Victor Vianna | eda6fcc4 | 2023-03-14 17:18:22 | [diff] [blame] | 460 | If you're using a remote machine that supports Chrome Remote Desktop, you can |
| 461 | add this to your .bashrc / .bash_profile. |
| 462 | |
| 463 | ```shell |
| 464 | if [[ -z "${DISPLAY}" ]]; then |
Victor Hugo Vianna Silva | 451142c2 | 2024-07-08 21:37:41 | [diff] [blame] | 465 | # In reality, Chrome Remote Desktop starts with 20 and increases until it |
| 466 | # finds an available ID [1]. So this isn't guaranteed to always work, but |
| 467 | # should work on the vast majoriy of cases. |
| 468 | # |
| 469 | # [1] https://source.chromium.org/chromium/chromium/src/+/main:remoting/host/linux/linux_me2me_host.py;l=112;drc=464a632e21bcec76c743930d4db8556613e21fd8 |
| 470 | export DISPLAY=:20 |
Victor Vianna | eda6fcc4 | 2023-03-14 17:18:22 | [diff] [blame] | 471 | fi |
| 472 | ``` |
| 473 | |
| 474 | This means if you launch Chrome from an SSH session, the UI output will be |
| 475 | available in Chrome Remote Desktop. |
| 476 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 477 | ## Running test targets |
| 478 | |
Andrew Williams | fa9b7d6 | 2023-03-20 15:48:28 | [diff] [blame] | 479 | Tests are split into multiple test targets based on their type and where they |
| 480 | exist in the directory structure. To see what target a given unit test or |
| 481 | browser test file corresponds to, the following command can be used: |
| 482 | |
| 483 | ```shell |
| 484 | $ gn refs out/Default --testonly=true --type=executable --all chrome/browser/ui/browser_list_unittest.cc |
| 485 | //chrome/test:unit_tests |
| 486 | ``` |
| 487 | |
| 488 | In the example above, the target is unit_tests. The unit_tests binary can be |
| 489 | built by running the following command: |
Fred Shih | 865fb8f | 2022-02-03 03:54:19 | [diff] [blame] | 490 | |
| 491 | ```shell |
| 492 | $ autoninja -C out/Default unit_tests |
| 493 | ``` |
| 494 | |
| 495 | You can run the tests by running the unit_tests binary. You can also limit which |
| 496 | tests are run using the `--gtest_filter` arg, e.g.: |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 497 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 498 | ```shell |
Andrew Williams | fa9b7d6 | 2023-03-20 15:48:28 | [diff] [blame] | 499 | $ out/Default/unit_tests --gtest_filter="BrowserListUnitTest.*" |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 500 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 501 | |
| 502 | You can find out more about GoogleTest at its |
| 503 | [GitHub page](https://github.com/google/googletest). |
| 504 | |
| 505 | ## Update your checkout |
| 506 | |
| 507 | To update an existing checkout, you can run |
| 508 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 509 | ```shell |
| 510 | $ git rebase-update |
| 511 | $ gclient sync |
| 512 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 513 | |
| 514 | The first command updates the primary Chromium source repository and rebases |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 515 | any of your local branches on top of tip-of-tree (aka the Git branch |
Andrew Williams | bbc1a1e | 2021-07-21 01:51:22 | [diff] [blame] | 516 | `origin/main`). If you don't want to use this script, you can also just use |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 517 | `git pull` or other common Git commands to update the repo. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 518 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 519 | The second command syncs dependencies to the appropriate versions and re-runs |
| 520 | hooks as needed. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 521 | |
| 522 | ## Tips, tricks, and troubleshooting |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 523 | |
| 524 | ### Linker Crashes |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 525 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 526 | If, during the final link stage: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 527 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 528 | ``` |
| 529 | LINK out/Debug/chrome |
| 530 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 531 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 532 | You get an error like: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 533 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 534 | ``` |
| 535 | collect2: ld terminated with signal 6 Aborted terminate called after throwing an instance of 'std::bad_alloc' |
| 536 | collect2: ld terminated with signal 11 [Segmentation fault], core dumped |
| 537 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 538 | |
Song Qinglin | 5ac3cf92 | 2022-11-09 04:12:22 | [diff] [blame] | 539 | or: |
| 540 | |
| 541 | ``` |
| 542 | LLVM ERROR: out of memory |
| 543 | ``` |
| 544 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 545 | you are probably running out of memory when linking. You *must* use a 64-bit |
| 546 | system to build. Try the following build settings (see [GN build |
| 547 | configuration](https://www.chromium.org/developers/gn-build-configuration) for |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 548 | other settings): |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 549 | |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 550 | * Build in release mode (debugging symbols require more memory): |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 551 | `is_debug = false` |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 552 | * Turn off symbols: `symbol_level = 0` |
| 553 | * Build in component mode (this is for development only, it will be slower and |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 554 | may have broken functionality): `is_component_build = true` |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 555 | * For official (ThinLTO) builds on Linux, increase the vm.max_map_count kernel |
Song Qinglin | 5ac3cf92 | 2022-11-09 04:12:22 | [diff] [blame] | 556 | parameter: increase the `vm.max_map_count` value from default (like 65530) |
| 557 | to for example 262144. You can run the `sudo sysctl -w vm.max_map_count=262144` |
| 558 | command to set it in the current session from the shell, or add the |
| 559 | `vm.max_map_count=262144` to /etc/sysctl.conf to save it permanently. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 560 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 561 | ### More links |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 562 | |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 563 | * Information about [building with Clang](../clang.md). |
| 564 | * You may want to [use a chroot](using_a_chroot.md) to |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 565 | isolate yourself from versioning or packaging conflicts. |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 566 | * Cross-compiling for ARM? See [LinuxChromiumArm](chromium_arm.md). |
| 567 | * Want to use Eclipse as your IDE? See |
Tom Anderson | 93e49e49 | 2019-12-23 19:55:37 | [diff] [blame] | 568 | [LinuxEclipseDev](eclipse_dev.md). |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 569 | * Want to use your built version as your default browser? See |
Tom Anderson | 93e49e49 | 2019-12-23 19:55:37 | [diff] [blame] | 570 | [LinuxDevBuildAsDefaultBrowser](dev_build_as_default_browser.md). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 571 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 572 | ## Next Steps |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 573 | |
| 574 | If you want to contribute to the effort toward a Chromium-based browser for |
Tom Anderson | 93e49e49 | 2019-12-23 19:55:37 | [diff] [blame] | 575 | Linux, please check out the [Linux Development page](development.md) for |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 576 | more information. |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 577 | |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 578 | ## Notes for other distros |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 579 | |
| 580 | ### Arch Linux |
| 581 | |
| 582 | Instead of running `install-build-deps.sh` to install build dependencies, run: |
| 583 | |
| 584 | ```shell |
| 585 | $ sudo pacman -S --needed python perl gcc gcc-libs bison flex gperf pkgconfig \ |
Tom Anderson | 761687a | 2023-06-14 17:27:39 | [diff] [blame] | 586 | nss alsa-lib glib2 gtk3 nspr freetype2 cairo dbus xorg-server-xvfb \ |
| 587 | xorg-xdpyinfo |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 588 | ``` |
| 589 | |
| 590 | For the optional packages on Arch Linux: |
| 591 | |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 592 | * `php-cgi` is provided with `pacman` |
| 593 | * `wdiff` is not in the main repository but `dwdiff` is. You can get `wdiff` |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 594 | in AUR/`yaourt` |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 595 | |
Kenneth Russell | 5629377 | 2018-09-21 01:46:15 | [diff] [blame] | 596 | ### Crostini (Debian based) |
| 597 | |
David Munro | 9b5f4c4f | 2019-07-24 08:23:27 | [diff] [blame] | 598 | First install the `file` and `lsb-release` commands for the script to run properly: |
Kenneth Russell | 5629377 | 2018-09-21 01:46:15 | [diff] [blame] | 599 | |
| 600 | ```shell |
David Munro | 9b5f4c4f | 2019-07-24 08:23:27 | [diff] [blame] | 601 | $ sudo apt-get install file lsb-release |
Kenneth Russell | 5629377 | 2018-09-21 01:46:15 | [diff] [blame] | 602 | ``` |
| 603 | |
| 604 | Then invoke install-build-deps.sh with the `--no-arm` argument, |
| 605 | because the ARM toolchain doesn't exist for this configuration: |
| 606 | |
| 607 | ```shell |
| 608 | $ sudo install-build-deps.sh --no-arm |
| 609 | ``` |
| 610 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 611 | ### Fedora |
| 612 | |
| 613 | Instead of running `build/install-build-deps.sh`, run: |
| 614 | |
| 615 | ```shell |
| 616 | su -c 'yum install git python bzip2 tar pkgconfig atk-devel alsa-lib-devel \ |
| 617 | bison binutils brlapi-devel bluez-libs-devel bzip2-devel cairo-devel \ |
| 618 | cups-devel dbus-devel dbus-glib-devel expat-devel fontconfig-devel \ |
Tom Anderson | 287339e | 2018-08-22 21:52:02 | [diff] [blame] | 619 | freetype-devel gcc-c++ glib2-devel glibc.i686 gperf glib2-devel \ |
Tim Brown | 36312fc | 2017-12-15 22:56:20 | [diff] [blame] | 620 | gtk3-devel java-1.*.0-openjdk-devel libatomic libcap-devel libffi-devel \ |
Tom Anderson | 761687a | 2023-06-14 17:27:39 | [diff] [blame] | 621 | libgcc.i686 libjpeg-devel libstdc++.i686 libX11-devel libXScrnSaver-devel \ |
| 622 | libXtst-devel libxkbcommon-x11-devel ncurses-compat-libs nspr-devel nss-devel \ |
| 623 | pam-devel pango-devel pciutils-devel pulseaudio-libs-devel zlib.i686 httpd \ |
| 624 | mod_ssl php php-cli python-psutil wdiff xorg-x11-server-Xvfb' |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 625 | ``` |
| 626 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 627 | The fonts needed by Blink's web tests can be obtained by following [these |
Victor Costan | 44af72b | 2017-11-13 20:01:30 | [diff] [blame] | 628 | instructions](https://gist.github.com/pwnall/32a3b11c2b10f6ae5c6a6de66c1e12ae). |
| 629 | For the optional packages: |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 630 | |
| 631 | * `php-cgi` is provided by the `php-cli` package. |
Victor Costan | 44af72b | 2017-11-13 20:01:30 | [diff] [blame] | 632 | * `sun-java6-fonts` is covered by the instructions linked above. |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 633 | |
| 634 | ### Gentoo |
| 635 | |
| 636 | You can just run `emerge www-client/chromium`. |
| 637 | |
Delan Azabani | 43eefa3d | 2024-05-09 03:39:33 | [diff] [blame] | 638 | ### NixOS |
| 639 | |
| 640 | To get a shell with the dev environment: |
| 641 | |
| 642 | ```sh |
| 643 | $ nix-shell tools/nix/shell.nix |
| 644 | ``` |
| 645 | |
| 646 | To run a command in the dev environment: |
| 647 | |
| 648 | ```sh |
| 649 | $ NIX_SHELL_RUN='autoninja -C out/Default chrome' nix-shell tools/nix/shell.nix |
| 650 | ``` |
| 651 | |
| 652 | To set up clangd with remote indexing support, run the command below, then copy |
| 653 | the path into your editor config: |
| 654 | |
| 655 | ```sh |
| 656 | $ NIX_SHELL_RUN='readlink /usr/bin/clangd' nix-shell tools/nix/shell.nix |
| 657 | ``` |
| 658 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 659 | ### OpenSUSE |
| 660 | |
| 661 | Use `zypper` command to install dependencies: |
| 662 | |
| 663 | (openSUSE 11.1 and higher) |
| 664 | |
| 665 | ```shell |
Tim Brown | 36312fc | 2017-12-15 22:56:20 | [diff] [blame] | 666 | sudo zypper in subversion pkg-config python perl bison flex gperf \ |
| 667 | mozilla-nss-devel glib2-devel gtk-devel wdiff lighttpd gcc gcc-c++ \ |
| 668 | mozilla-nspr mozilla-nspr-devel php5-fastcgi alsa-devel libexpat-devel \ |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 669 | libjpeg-devel libbz2-devel |
| 670 | ``` |
| 671 | |
| 672 | For 11.0, use `libnspr4-0d` and `libnspr4-dev` instead of `mozilla-nspr` and |
Tom Anderson | 287339e | 2018-08-22 21:52:02 | [diff] [blame] | 673 | `mozilla-nspr-devel`, and use `php5-cgi` instead of `php5-fastcgi`. |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 674 | |
| 675 | (openSUSE 11.0) |
| 676 | |
| 677 | ```shell |
| 678 | sudo zypper in subversion pkg-config python perl \ |
| 679 | bison flex gperf mozilla-nss-devel glib2-devel gtk-devel \ |
| 680 | libnspr4-0d libnspr4-dev wdiff lighttpd gcc gcc-c++ libexpat-devel \ |
Tom Anderson | 287339e | 2018-08-22 21:52:02 | [diff] [blame] | 681 | php5-cgi alsa-devel gtk3-devel jpeg-devel |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 682 | ``` |
| 683 | |
| 684 | The Ubuntu package `sun-java6-fonts` contains a subset of Java of the fonts used. |
| 685 | Since this package requires Java as a prerequisite anyway, we can do the same |
| 686 | thing by just installing the equivalent openSUSE Sun Java package: |
| 687 | |
| 688 | ```shell |
| 689 | sudo zypper in java-1_6_0-sun |
| 690 | ``` |
| 691 | |
| 692 | WebKit is currently hard-linked to the Microsoft fonts. To install these using `zypper` |
| 693 | |
| 694 | ```shell |
| 695 | sudo zypper in fetchmsttfonts pullin-msttf-fonts |
| 696 | ``` |
| 697 | |
| 698 | To make the fonts installed above work, as the paths are hardcoded for Ubuntu, |
| 699 | create symlinks to the appropriate locations: |
| 700 | |
| 701 | ```shell |
| 702 | sudo mkdir -p /usr/share/fonts/truetype/msttcorefonts |
| 703 | sudo ln -s /usr/share/fonts/truetype/arial.ttf /usr/share/fonts/truetype/msttcorefonts/Arial.ttf |
| 704 | sudo ln -s /usr/share/fonts/truetype/arialbd.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf |
| 705 | sudo ln -s /usr/share/fonts/truetype/arialbi.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf |
| 706 | sudo ln -s /usr/share/fonts/truetype/ariali.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf |
| 707 | sudo ln -s /usr/share/fonts/truetype/comic.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf |
| 708 | sudo ln -s /usr/share/fonts/truetype/comicbd.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf |
| 709 | sudo ln -s /usr/share/fonts/truetype/cour.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf |
| 710 | sudo ln -s /usr/share/fonts/truetype/courbd.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf |
| 711 | sudo ln -s /usr/share/fonts/truetype/courbi.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf |
| 712 | sudo ln -s /usr/share/fonts/truetype/couri.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf |
| 713 | sudo ln -s /usr/share/fonts/truetype/impact.ttf /usr/share/fonts/truetype/msttcorefonts/Impact.ttf |
| 714 | sudo ln -s /usr/share/fonts/truetype/times.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf |
| 715 | sudo ln -s /usr/share/fonts/truetype/timesbd.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf |
| 716 | sudo ln -s /usr/share/fonts/truetype/timesbi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf |
| 717 | sudo ln -s /usr/share/fonts/truetype/timesi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf |
| 718 | sudo ln -s /usr/share/fonts/truetype/verdana.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana.ttf |
| 719 | sudo ln -s /usr/share/fonts/truetype/verdanab.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf |
| 720 | sudo ln -s /usr/share/fonts/truetype/verdanai.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf |
| 721 | sudo ln -s /usr/share/fonts/truetype/verdanaz.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf |
| 722 | ``` |
| 723 | |
| 724 | The Ubuntu package `sun-java6-fonts` contains a subset of Java of the fonts used. |
| 725 | Since this package requires Java as a prerequisite anyway, we can do the same |
| 726 | thing by just installing the equivalent openSUSE Sun Java package: |
| 727 | |
| 728 | ```shell |
| 729 | sudo zypper in java-1_6_0-sun |
| 730 | ``` |
| 731 | |
| 732 | WebKit is currently hard-linked to the Microsoft fonts. To install these using `zypper` |
| 733 | |
| 734 | ```shell |
| 735 | sudo zypper in fetchmsttfonts pullin-msttf-fonts |
| 736 | ``` |
| 737 | |
| 738 | To make the fonts installed above work, as the paths are hardcoded for Ubuntu, |
| 739 | create symlinks to the appropriate locations: |
| 740 | |
| 741 | ```shell |
| 742 | sudo mkdir -p /usr/share/fonts/truetype/msttcorefonts |
| 743 | sudo ln -s /usr/share/fonts/truetype/arial.ttf /usr/share/fonts/truetype/msttcorefonts/Arial.ttf |
| 744 | sudo ln -s /usr/share/fonts/truetype/arialbd.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf |
| 745 | sudo ln -s /usr/share/fonts/truetype/arialbi.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf |
| 746 | sudo ln -s /usr/share/fonts/truetype/ariali.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf |
| 747 | sudo ln -s /usr/share/fonts/truetype/comic.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf |
| 748 | sudo ln -s /usr/share/fonts/truetype/comicbd.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf |
| 749 | sudo ln -s /usr/share/fonts/truetype/cour.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf |
| 750 | sudo ln -s /usr/share/fonts/truetype/courbd.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf |
| 751 | sudo ln -s /usr/share/fonts/truetype/courbi.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf |
| 752 | sudo ln -s /usr/share/fonts/truetype/couri.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf |
| 753 | sudo ln -s /usr/share/fonts/truetype/impact.ttf /usr/share/fonts/truetype/msttcorefonts/Impact.ttf |
| 754 | sudo ln -s /usr/share/fonts/truetype/times.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf |
| 755 | sudo ln -s /usr/share/fonts/truetype/timesbd.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf |
| 756 | sudo ln -s /usr/share/fonts/truetype/timesbi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf |
| 757 | sudo ln -s /usr/share/fonts/truetype/timesi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf |
| 758 | sudo ln -s /usr/share/fonts/truetype/verdana.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana.ttf |
| 759 | sudo ln -s /usr/share/fonts/truetype/verdanab.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf |
| 760 | sudo ln -s /usr/share/fonts/truetype/verdanai.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf |
| 761 | sudo ln -s /usr/share/fonts/truetype/verdanaz.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf |
| 762 | ``` |
| 763 | |
| 764 | And then for the Java fonts: |
| 765 | |
| 766 | ```shell |
| 767 | sudo mkdir -p /usr/share/fonts/truetype/ttf-lucida |
| 768 | sudo find /usr/lib*/jvm/java-1.6.*-sun-*/jre/lib -iname '*.ttf' -print \ |
| 769 | -exec ln -s {} /usr/share/fonts/truetype/ttf-lucida \; |
| 770 | ``` |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 771 | |
| 772 | ### Docker |
| 773 | |
| 774 | #### Prerequisites |
| 775 | |
| 776 | While it is not a common setup, Chromium compilation should work from within a |
| 777 | Docker container. If you choose to compile from within a container for whatever |
| 778 | reason, you will need to make sure that the following tools are available: |
| 779 | |
| 780 | * `curl` |
| 781 | * `git` |
| 782 | * `lsb_release` |
| 783 | * `python3` |
| 784 | * `sudo` |
| 785 | * `file` |
| 786 | |
| 787 | There may be additional Docker-specific issues during compilation. See |
| 788 | [this bug](https://crbug.com/1377520) for additional details on this. |
| 789 | |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 790 | Note: [Clone depot_tools](#install-depot_tools) first. |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 791 | |
| 792 | #### Build Steps |
| 793 | |
| 794 | 1. Put the following Dockerfile in `/path/to/chromium/`. |
| 795 | |
| 796 | ```docker |
| 797 | # Use an official Ubuntu base image with Docker already installed |
| 798 | FROM ubuntu:22.04 |
| 799 | |
| 800 | # Set environment variables |
| 801 | ENV DEBIAN_FRONTEND=noninteractive |
| 802 | |
| 803 | # Install Mantatory tools (curl git python3) and optional tools (vim sudo) |
| 804 | RUN apt-get update && \ |
| 805 | apt-get install -y curl git lsb-release python3 git file vim sudo && \ |
| 806 | rm -rf /var/lib/apt/lists/* |
| 807 | |
| 808 | # Export depot_tools path |
| 809 | ENV PATH="/depot_tools:${PATH}" |
| 810 | |
| 811 | # Configure git for safe.directory |
Ho Cheung | 7c53eaf | 2024-05-31 00:31:26 | [diff] [blame] | 812 | RUN git config --global --add safe.directory /depot_tools && \ |
| 813 | git config --global --add safe.directory /chromium/src |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 814 | |
Ho Cheung | 7c53eaf | 2024-05-31 00:31:26 | [diff] [blame] | 815 | # Set the working directory to the existing Chromium source directory. |
| 816 | # This can be either "/chromium/src" or "/chromium". |
| 817 | WORKDIR /chromium/src |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 818 | |
| 819 | # Expose any necessary ports (if needed) |
| 820 | # EXPOSE 8080 |
mohamedhany01 | 5ae3480 | 2024-10-16 16:34:41 | [diff] [blame] | 821 | |
| 822 | # Create a dummy user and group to avoid permission issues |
| 823 | RUN groupadd -g 1001 chrom-d && \ |
| 824 | useradd -u 1000 -g 1001 -m chrom-d |
Ho Cheung | 7c53eaf | 2024-05-31 00:31:26 | [diff] [blame] | 825 | |
| 826 | # Create normal user with name "chrom-d". Optional and you can use root but |
| 827 | # not advised. |
| 828 | USER chrom-d |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 829 | |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 830 | # Start Chromium Builder "chrom-d" (modify this command as needed) |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 831 | # CMD ["autoninja -C out/Default chrome"] |
| 832 | CMD ["bash"] |
| 833 | ``` |
| 834 | |
| 835 | 2. Build Container |
| 836 | |
| 837 | ```shell |
| 838 | # chrom-b is just a name; You can change it but you must reflect the renaming |
| 839 | # in all commands below |
| 840 | $ docker build -t chrom-b . |
| 841 | ``` |
| 842 | |
| 843 | 3. Run container as root to install dependencies |
| 844 | |
| 845 | ```shell |
mohamedhany01 | 5ae3480 | 2024-10-16 16:34:41 | [diff] [blame] | 846 | $ docker run |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 847 | -it \ # Run docker interactively |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 848 | --name chrom-b \ # with name "chrom-b" |
| 849 | -u root \ # with user root |
| 850 | -v /path/on/machine/to/chromium:/chromium \ # With chromium folder mounted |
| 851 | -v /path/on/machine/to/depot_tools:/depot_tools \ # With depot_tools mounted |
| 852 | chrom-b # Run container with image name "chrom-b" |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 853 | ``` |
| 854 | |
mohamedhany01 | 5ae3480 | 2024-10-16 16:34:41 | [diff] [blame] | 855 | *** note |
| 856 | **Note:** When running the command as a single line in bash, please remove the |
| 857 | comments (after the `#`) to avoid breaking the command. |
| 858 | *** |
| 859 | |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 860 | 4. Install dependencies: |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 861 | |
| 862 | ```shell |
Ho Cheung | 7c53eaf | 2024-05-31 00:31:26 | [diff] [blame] | 863 | ./build/install-build-deps.sh |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 864 | ``` |
| 865 | |
Ho Cheung | 7c53eaf | 2024-05-31 00:31:26 | [diff] [blame] | 866 | 5. [Run hooks](#run-the-hooks) (On docker or machine if you installed depot_tools on machine) |
| 867 | |
mohamedhany01 | 5ae3480 | 2024-10-16 16:34:41 | [diff] [blame] | 868 | *** note |
| 869 | **Before running hooks:** Ensure that all directories within |
| 870 | `third_party` are added as safe directories in Git. This is required |
| 871 | when running in the container because the ownership of the `src/` |
| 872 | directory (e.g., `chrom-b`) differs from the current user |
| 873 | (e.g., `root`). To prevent Git **warnings** about "dubious ownership" |
| 874 | run the following command after installing the dependencies: |
| 875 | |
| 876 | ```shell |
| 877 | # Loop through each directory in /chromium/src/third_party and add |
| 878 | # them as safe directories in Git |
| 879 | $ for dir in /chromium/src/third_party/*; do |
| 880 | if [ -d "$dir" ]; then |
| 881 | git config --global --add safe.directory "$dir" |
| 882 | fi |
| 883 | done |
| 884 | ``` |
| 885 | *** |
| 886 | |
Ho Cheung | 7c53eaf | 2024-05-31 00:31:26 | [diff] [blame] | 887 | 6. Exit container |
| 888 | |
| 889 | 7. Save container image with tag-id name `dpv1.0`. Run this on the machine, not in container |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 890 | |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 891 | ```shell |
mohamedhany01 | 5ae3480 | 2024-10-16 16:34:41 | [diff] [blame] | 892 | # Get docker running/stopped containers, copy the "chrom-b" id |
| 893 | $ docker container ls -a |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 894 | # Save/tag running docker container with name "chrom-b" with "dpv1.0" |
| 895 | # You can choose any tag name you want but propagate name accordingly |
| 896 | # You will need to create new tags when working on different parts of |
| 897 | # chromium which requires installing additional dependencies |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 898 | $ docker commit <ID from above step> chrom-b:dpv1.0 |
| 899 | # Optional, just saves space by deleting unnecessary images |
| 900 | $ docker image rmi chrom-b:latest && docker image prune \ |
| 901 | && docker container prune && docker builder prune |
| 902 | ``` |
| 903 | |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 904 | #### Run container |
| 905 | |
| 906 | ```shell |
| 907 | $ docker run --rm \ # close instance upon exit |
| 908 | -it \ # Run docker interactively |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 909 | --name chrom-b \ # with name "chrom-b" |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 910 | -u $(id -u):$(id -g) \ # Run container as a non-root user with same UID & GID |
Omar Shawky | 971848ce | 2024-04-17 21:47:30 | [diff] [blame] | 911 | -v /path/on/machine/to/chromium:/chromium \ # With chromium folder mounted |
| 912 | -v /path/on/machine/to/depot_tools:/depot_tools \ # With depot_tools mounted |
| 913 | chrom-b:dpv1.0 # Run container with image name "chrom-b" and tag dpv1.0 |
Omar Shawky | 08b259c | 2024-03-27 19:52:17 | [diff] [blame] | 914 | ``` |
mohamedhany01 | 5ae3480 | 2024-10-16 16:34:41 | [diff] [blame] | 915 | |
| 916 | *** note |
| 917 | **Note:** When running the command as a single line in bash, please remove the |
| 918 | comments (after the `#`) to avoid breaking the command. |
| 919 | *** |