blob: 63e06cd11aea196b0d2874e3621302e0c1422e56 [file] [log] [blame] [view]
dpranke0ae7cad2016-11-30 07:47:581# Checking out and building Chromium on Linux
andybons3322f762015-08-24 21:37:092
Victor Costan44af72b2017-11-13 20:01:303There are instructions for other platforms linked from the
Nicolas Norvezba040062020-01-15 01:17:264[get the code](../get_the_code.md) page.
dpranke1a70d0c2016-12-01 02:42:295
dpranke1a70d0c2016-12-01 02:42:296## Instructions for Google Employees
7
8Are you a Google employee? See
9[go/building-chrome](https://goto.google.com/building-chrome) instead.
andybons8c02a1f2015-09-04 17:02:3210
dpranke0ae7cad2016-11-30 07:47:5811[TOC]
andybonsad92aa32015-08-31 02:27:4412
dpranke0ae7cad2016-11-30 07:47:5813## System requirements
andybonsad92aa32015-08-31 02:27:4414
Bruce Dawsonc2661722024-06-12 19:44:2915* An x86-64 machine with at least 8GB of RAM. More than 16GB is highly
Omar Shawky971848ce2024-04-17 21:47:3016 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.
zhoupeng6ebd49d2025-04-03 20:45:0020* 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 Pranke8766b622c2023-08-30 23:19:3622 of Python in `$depot_tools/python-bin`, if you don't have an appropriate
23 version already on your system.
Junji Watanabedab18d12025-04-09 04:04:0124* 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 Kastingbeb265c2024-10-31 20:22:5627* `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 Pastened89a45b2023-06-28 22:57:3431
32Most development is done on Ubuntu (Chromium's build infrastructure currently
33runs 22.04, Jammy Jellyfish). There are some instructions for other distros
Omar Shawky08b259c2024-03-27 19:52:1734below, but they are mostly unsupported, but installation instructions can be found in [Docker](#docker).
andybons3322f762015-08-24 21:37:0935
dpranke0ae7cad2016-11-30 07:47:5836## Install `depot_tools`
andybonsad92aa32015-08-31 02:27:4437
sdy93387fa2016-12-01 01:03:4438Clone the `depot_tools` repository:
andybons3322f762015-08-24 21:37:0939
sdy93387fa2016-12-01 01:03:4440```shell
41$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
42```
andybonsad92aa32015-08-31 02:27:4443
mark a. foltz89670afb2023-08-20 18:14:0744Add `depot_tools` to the beginning of your `PATH` (you will probably want to put
45this in your `~/.bashrc` or `~/.zshrc`). Assuming you cloned `depot_tools` to
sdy93387fa2016-12-01 01:03:4446`/path/to/depot_tools`:
andybonsad92aa32015-08-31 02:27:4447
sdy93387fa2016-12-01 01:03:4448```shell
mark a. foltz89670afb2023-08-20 18:14:0749$ export PATH="/path/to/depot_tools:$PATH"
sdy93387fa2016-12-01 01:03:4450```
andybons3322f762015-08-24 21:37:0951
Claudio DeSouzaae44ac12018-02-13 16:11:4552When cloning `depot_tools` to your home directory **do not** use `~` on PATH,
53otherwise `gclient runhooks` will fail to run. Rather, you should use either
54`$HOME` or the absolute path:
55
56```shell
mark a. foltz89670afb2023-08-20 18:14:0757$ export PATH="${HOME}/depot_tools:$PATH"
Claudio DeSouzaae44ac12018-02-13 16:11:4558```
59
dpranke0ae7cad2016-11-30 07:47:5860## Get the code
andybonsad92aa32015-08-31 02:27:4461
sdy93387fa2016-12-01 01:03:4462Create a `chromium` directory for the checkout and change to it (you can call
63this whatever you like and put it wherever you like, as long as the full path
64has no spaces):
65
66```shell
67$ mkdir ~/chromium && cd ~/chromium
68```
andybons3322f762015-08-24 21:37:0969
dpranke0ae7cad2016-11-30 07:47:5870Run the `fetch` tool from depot_tools to check out the code and its
71dependencies.
andybonsad92aa32015-08-31 02:27:4472
sdy93387fa2016-12-01 01:03:4473```shell
74$ fetch --nohooks chromium
75```
andybonsad92aa32015-08-31 02:27:4476
Delan Azabani43eefa3d2024-05-09 03:39:3377*** note
78**NixOS users:** tools like `fetch` won’t work without a Nix shell. Clone [the
79tools repo](https://chromium.googlesource.com/chromium/src/tools) with `git`,
80then run `nix-shell tools/nix/shell.nix`.
81***
82
dpranke0ae7cad2016-11-30 07:47:5883If you don't want the full repo history, you can save a lot of time by
sdy93387fa2016-12-01 01:03:4484adding the `--no-history` flag to `fetch`.
andybons3322f762015-08-24 21:37:0985
dpranke0ae7cad2016-11-30 07:47:5886Expect the command to take 30 minutes on even a fast connection, and many
87hours on slower ones.
andybonsad92aa32015-08-31 02:27:4488
dpranke0ae7cad2016-11-30 07:47:5889If you've already installed the build dependencies on the machine (from another
sdy93387fa2016-12-01 01:03:4490checkout, for example), you can omit the `--nohooks` flag and `fetch`
dpranke0ae7cad2016-11-30 07:47:5891will automatically execute `gclient runhooks` at the end.
andybons3322f762015-08-24 21:37:0992
sdy93387fa2016-12-01 01:03:4493When `fetch` completes, it will have created a hidden `.gclient` file and a
94directory called `src` in the working directory. The remaining instructions
95assume you have switched to the `src` directory:
andybons3322f762015-08-24 21:37:0996
sdy93387fa2016-12-01 01:03:4497```shell
98$ cd src
99```
andybons3322f762015-08-24 21:37:09100
dpranke0ae7cad2016-11-30 07:47:58101### Install additional build dependencies
andybons3322f762015-08-24 21:37:09102
dpranke0ae7cad2016-11-30 07:47:58103Once you have checked out the code, and assuming you're using Ubuntu, run
104[build/install-build-deps.sh](/build/install-build-deps.sh)
andybons3322f762015-08-24 21:37:09105
Aaron Gable3bc93682019-01-11 02:16:07106```shell
107$ ./build/install-build-deps.sh
108```
109
dpranke2989a782016-12-02 02:57:12110You may need to adjust the build dependencies for other distros. There are
Omar Shawky971848ce2024-04-17 21:47:30111some [notes](#notes-for-other-distros) at the end of this document, but we make no guarantees
dpranke2989a782016-12-02 02:57:12112for their accuracy.
andybonsad92aa32015-08-31 02:27:44113
dpranke0ae7cad2016-11-30 07:47:58114### Run the hooks
andybons3322f762015-08-24 21:37:09115
dpranke0ae7cad2016-11-30 07:47:58116Once you've run `install-build-deps` at least once, you can now run the
sdy93387fa2016-12-01 01:03:44117Chromium-specific hooks, which will download additional binaries and other
dpranke0ae7cad2016-11-30 07:47:58118things you might need:
andybonsad92aa32015-08-31 02:27:44119
sdy93387fa2016-12-01 01:03:44120```shell
121$ gclient runhooks
122```
andybonsad92aa32015-08-31 02:27:44123
sdy93387fa2016-12-01 01:03:44124*Optional*: You can also [install API
125keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your
126build to talk to some Google services, but this is not necessary for most
127development and testing purposes.
andybons3322f762015-08-24 21:37:09128
dpranke1a70d0c2016-12-01 02:42:29129## Setting up the build
andybonsad92aa32015-08-31 02:27:44130
Fumitoshi Ukaic9f326d2025-04-24 01:06:28131Chromium uses [Siso](https://pkg.go.dev/go.chromium.org/infra/build/siso#section-readme)
132as its main build tool along with
Andrew Williamsbbc1a1e2021-07-21 01:51:22133a tool called [GN](https://gn.googlesource.com/gn/+/main/docs/quick_start.md)
Tom Bridgwatereef401542018-08-17 00:54:43134to generate `.ninja` files. You can create any number of *build directories*
135with different configurations. To create a build directory, run:
andybons8c02a1f2015-09-04 17:02:32136
sdy93387fa2016-12-01 01:03:44137```shell
138$ gn gen out/Default
139```
dpranke0ae7cad2016-11-30 07:47:58140
Fumitoshi Ukaic9f326d2025-04-24 01:06:28141* You only have to run this once for each new build directory, Siso will
sdy93387fa2016-12-01 01:03:44142 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).
dpranke0ae7cad2016-11-30 07:47:58147 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 Williamsbbc1a1e2021-07-21 01:51:22150 [quick start guide](https://gn.googlesource.com/gn/+/main/docs/quick_start.md).
dpranke0ae7cad2016-11-30 07:47:58151
Omar Shawky971848ce2024-04-17 21:47:30152### Faster builds
dpranke0ae7cad2016-11-30 07:47:58153
dpranke2989a782016-12-02 02:57:12154This section contains some things you can change to speed up your builds,
155sorted so that the things that make the biggest difference are first.
156
Fumitoshi Ukai334658572025-04-09 00:59:30157#### Use Remote Execution
Takuto Ikuta66f5de82023-09-08 03:55:44158
Takuto Ikuta776547282023-11-10 01:42:33159*** note
Philipp Wollermann43f9cb82023-11-27 05:33:19160**Warning:** If you are a Google employee, do not follow the instructions below.
Andrew Williams54da9cc2024-01-09 17:32:23161See
162[go/chrome-linux-build#setup-remote-execution](https://goto.google.com/chrome-linux-build#setup-remote-execution)
Philipp Wollermann43f9cb82023-11-27 05:33:19163instead.
Takuto Ikuta776547282023-11-10 01:42:33164***
165
Philipp Wollermann43f9cb82023-11-27 05:33:19166Chromium's build can be sped up significantly by using a remote execution system
167compatible with [REAPI](https://github.com/bazelbuild/remote-apis). This allows
168you to benefit from remote caching and executing many build actions in parallel
169on a shared cluster of workers.
Fumitoshi Ukai8c123e92025-04-23 06:06:44170Chromium's build uses a client developed by Google called
171[Siso](https://pkg.go.dev/go.chromium.org/infra/build/siso#section-readme)
172to remotely execute build actions.
Philipp Wollermann43f9cb82023-11-27 05:33:19173
Fumitoshi Ukai8c123e92025-04-23 06:06:44174To get started, you need access to an REAPI-compatible backend.
175
176The following instructions assume that you received an invitation from Google
177to use Chromium's RBE service and were granted access to it.
Takuto Ikuta1b118a82023-11-28 05:55:25178For contributors who have
179[tryjob access](https://www.chromium.org/getting-involved/become-a-committer/#try-job-access)
180, please ask a Googler to email [email protected] on your behalf to access
Fumitoshi Ukai8c123e92025-04-23 06:06:44181RBE backend paid by Google. Note that remote execution for external
182contributors is a best-effort process. We do not guarantee when you will be
183invited.
Takuto Ikuta1b118a82023-11-28 05:55:25184
Fumitoshi Ukai8c123e92025-04-23 06:06:44185For others who have no access to Google's RBE backends, you are welcome
Philipp Wollermann43f9cb82023-11-27 05:33:19186to use any of the
187[other compatible backends](https://github.com/bazelbuild/remote-apis#servers),
188in which case you will have to adapt the following instructions regarding the
189authentication method, instance name, etc. to work with your backend.
190
Fumitoshi Ukai8c123e92025-04-23 06:06:44191If you would like to use `siso` with Google's RBE,
Fumitoshi Ukai334658572025-04-09 00:59:30192you'll first need to:
Philipp Wollermann43f9cb82023-11-27 05:33:19193
Fumitoshi Ukai334658572025-04-09 00:59:301941. Run `siso login` and login with your authorized account.
Fumitoshi Ukai8c123e92025-04-23 06:06:44195If it is blocked in OAuth2 flow, run `gcloud auth login` instead.
Philipp Wollermann43f9cb82023-11-27 05:33:19196
197Next, you'll have to specify your `rbe_instance` in your `.gclient`
198configuration to use the correct one for Chromium contributors:
199
Michael Savigny95600992024-04-10 13:59:10200*** note
201**Warning:** If you are a Google employee, do not follow the instructions below.
202See
203[go/chrome-linux-build#setup-remote-execution](https://goto.google.com/chrome-linux-build#setup-remote-execution)
204instead.
205***
206
Takuto Ikuta66f5de82023-09-08 03:55:44207```
208solutions = [
209 {
210 ...,
211 "custom_vars": {
Philipp Wollermann43f9cb82023-11-27 05:33:19212 # 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
214 # own REAPI-compatible backend, you will need to change this accordingly
215 # to its requirements.
216 "rbe_instance": "projects/rbe-chromium-untrusted/instances/default_instance",
Takuto Ikuta66f5de82023-09-08 03:55:44217 },
218 },
219]
220```
Philipp Wollermann43f9cb82023-11-27 05:33:19221
Omar Shawky971848ce2024-04-17 21:47:30222And run `gclient sync`. This will regenerate the config files in
Fumitoshi Ukai334658572025-04-09 00:59:30223`build/config/siso/backend_config/backend.star` to use the `rbe_instance`
224that you just added to your `.gclient` file.
Fumitoshi Ukai8c123e92025-04-23 06:06:44225
Fumitoshi Ukai334658572025-04-09 00:59:30226If `rbe_instance` is not owned by Google, you may need to create your
227own `backend.star`. See
228[build/config/siso/backend_config/README.md](../../build/config/siso/backend_config/README.md).
Philipp Wollermann43f9cb82023-11-27 05:33:19229
230Then, add the following GN args to your `args.gn`:
231
Takuto Ikuta66f5de82023-09-08 03:55:44232```
Philipp Wollermann43f9cb82023-11-27 05:33:19233use_remoteexec = true
Fumitoshi Ukai334658572025-04-09 00:59:30234use_siso = true
Takuto Ikuta66f5de82023-09-08 03:55:44235```
236
Fumitoshi Ukai8c123e92025-04-23 06:06:44237If `args.gn` contains `use_reclient=true`, drop it or replace it with
238`use_reclient=false`.
239
Philipp Wollermann43f9cb82023-11-27 05:33:19240That's it. Remember to always use `autoninja` for building Chromium as described
Fumitoshi Ukaic9f326d2025-04-24 01:06:28241below, instead of directly invoking `siso` or `ninja`.
Philipp Wollermann43f9cb82023-11-27 05:33:19242
Fumitoshi Ukai8c123e92025-04-23 06:06:44243Reach out to
244[[email protected]](https://groups.google.com/a/chromium.org/g/build)
245if you have any questions about remote execution usage.
246
dpranke2989a782016-12-02 02:57:12247#### Include fewer debug symbols
248
249By default GN produces a build with all of the debug assertions enabled
250(`is_debug=true`) and including full debug info (`symbol_level=2`). Setting
251`symbol_level=1` will produce enough information for stack traces, but not
252line-by-line debugging. Setting `symbol_level=0` will include no debug
253symbols at all. Either will speed up the build compared to full symbols.
254
Bruce Dawson63e0be72021-11-29 20:34:41255#### Disable debug symbols for Blink and v8
dpranke2989a782016-12-02 02:57:12256
257Due to its extensive use of templates, the Blink code produces about half
258of our debug symbols. If you don't ever need to debug Blink, you can set
Bruce Dawson63e0be72021-11-29 20:34:41259the GN arg `blink_symbol_level=0`. Similarly, if you don't need to debug v8 you
260can improve build speeds by setting the GN arg `v8_symbol_level=0`.
dpranke2989a782016-12-02 02:57:12261
262#### Use Icecc
263
264[Icecc](https://github.com/icecc/icecream) is the distributed compiler with a
265central scheduler to share build load. Currently, many external contributors use
Fumitoshi Ukai334658572025-04-09 00:59:30266it. e.g. Intel, Opera, Samsung (this is not useful if you're using Siso).
dpranke2989a782016-12-02 02:57:12267
268In order to use `icecc`, set the following GN args:
269
270```
dpranke2989a782016-12-02 02:57:12271use_debug_fission=false
272is_clang=false
dpranke2989a782016-12-02 02:57:12273```
274
Victor Costan44af72b2017-11-13 20:01:30275See these links for more on the
dpranke2989a782016-12-02 02:57:12276[bundled_binutils limitation](https://github.com/icecc/icecream/commit/b2ce5b9cc4bd1900f55c3684214e409fa81e7a92),
277the [debug fission limitation](http://gcc.gnu.org/wiki/DebugFission).
278
279Using the system linker may also be necessary when using glibc 2.21 or newer.
280See [related bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808181).
281
282#### ccache
283
David Sandersddc9a7f2022-01-28 03:19:19284You can use [ccache](https://ccache.dev) to speed up local builds (again,
Fumitoshi Ukai334658572025-04-09 00:59:30285this is not useful if you're using Siso).
dpranke2989a782016-12-02 02:57:12286
287Increase your ccache hit rate by setting `CCACHE_BASEDIR` to a parent directory
288that the working directories all have in common (e.g.,
289`/home/yourusername/development`). Consider using
290`CCACHE_SLOPPINESS=include_file_mtime` (since if you are using multiple working
291directories, header times in svn sync'ed portions of your trees will be
292different - see
David Sandersddc9a7f2022-01-28 03:19:19293[the ccache troubleshooting section](https://ccache.dev/manual/latest.html#_troubleshooting)
dpranke2989a782016-12-02 02:57:12294for additional information). If you use symbolic links from your home directory
295to get to the local physical disk directory where you keep those working
296development directories, consider putting
297
Omar Shawky971848ce2024-04-17 21:47:30298```
299alias cd="cd -P"
300```
dpranke2989a782016-12-02 02:57:12301
302in your `.bashrc` so that `$PWD` or `cwd` always refers to a physical, not
303logical directory (and make sure `CCACHE_BASEDIR` also refers to a physical
304parent).
305
306If you tune ccache correctly, a second working directory that uses a branch
307tracking trunk and is up to date with trunk and was gclient sync'ed at about the
308same time should build chrome in about 1/3 the time, and the cache misses as
309reported by `ccache -s` should barely increase.
310
Song Fangzhen4b68a6e32021-07-14 05:53:40311This is especially useful if you use
312[git-worktree](http://git-scm.com/docs/git-worktree) and keep multiple local
dpranke2989a782016-12-02 02:57:12313working directories going at once.
314
315#### Using tmpfs
316
317You can use tmpfs for the build output to reduce the amount of disk writes
318required. I.e. mount tmpfs to the output directory where the build output goes:
319
320As root:
Omar Shawky971848ce2024-04-17 21:47:30321```
322mount -t tmpfs -o size=20G,nr_inodes=40k,mode=1777 tmpfs /path/to/out
323```
dpranke2989a782016-12-02 02:57:12324
325*** note
326**Caveat:** You need to have enough RAM + swap to back the tmpfs. For a full
327debug build, you will need about 20 GB. Less for just building the chrome target
328or for a release build.
329***
330
331Quick and dirty benchmark numbers on a HP Z600 (Intel core i7, 16 cores
332hyperthreaded, 12 GB RAM)
333
Omar Shawky971848ce2024-04-17 21:47:30334* With tmpfs:
335 * 12m:20s
336* Without tmpfs
337 * 15m:40s
dpranke2989a782016-12-02 02:57:12338
Bruce Dawsonbe823202022-03-10 23:40:50339### Smaller builds
340
341The Chrome binary contains embedded symbols by default. You can reduce its size
342by using the Linux `strip` command to remove this debug information. You can
Peter Boström38748962023-05-08 21:24:26343also reduce binary size and turn on all optimizations by enabling official build
344mode, with the GN arg `is_official_build = true`.
Bruce Dawsonbe823202022-03-10 23:40:50345
dpranke0ae7cad2016-11-30 07:47:58346## Build Chromium
347
Fumitoshi Ukaic9f326d2025-04-24 01:06:28348Build Chromium (the "chrome" target) with Siso or Ninja using the command:
dpranke0ae7cad2016-11-30 07:47:58349
sdy93387fa2016-12-01 01:03:44350```shell
Max Morozf5b31fcd2018-08-10 21:55:48351$ autoninja -C out/Default chrome
sdy93387fa2016-12-01 01:03:44352```
dpranke0ae7cad2016-11-30 07:47:58353
Dirk Pranke8bd55f22018-10-24 21:22:10354(`autoninja` is a wrapper that automatically provides optimal values for the
Fumitoshi Ukaic9f326d2025-04-24 01:06:28355arguments passed to `siso` or `ninja`.)
Max Morozf5b31fcd2018-08-10 21:55:48356
sdy93387fa2016-12-01 01:03:44357You can get a list of all of the other build targets from GN by running `gn ls
Fumitoshi Ukaic9f326d2025-04-24 01:06:28358out/Default` from the command line. To compile one, pass the GN label to
359Siso/Ninja with no preceding "//" (so, for `//chrome/test:unit_tests` use
360`autoninja -C out/Default chrome/test:unit_tests`).
dpranke0ae7cad2016-11-30 07:47:58361
Junji Watanabe7037b95f2024-04-22 06:14:15362## Compile a single file
363
Fumitoshi Ukaic9f326d2025-04-24 01:06:28364Siso/Ninja supports a special [syntax `^`][ninja hat syntax] to compile a single object file specifying
Junji Watanabe7037b95f2024-04-22 06:14:15365the source file. For example, `autoninja -C out/Default ../../base/logging.cc^`
366compiles `obj/base/base/logging.o`.
367
368[ninja hat syntax]: https://ninja-build.org/manual.html#:~:text=There%20is%20also%20a%20special%20syntax%20target%5E%20for%20specifying%20a%20target%20as%20the%20first%20output%20of%20some%20rule%20containing%20the%20source%20you%20put%20in%20the%20command%20line%2C%20if%20one%20exists.%20For%20example%2C%20if%20you%20specify%20target%20as%20foo.c%5E%20then%20foo.o%20will%20get%20built%20(assuming%20you%20have%20those%20targets%20in%20your%20build%20files)
369
370In addition to `foo.cc^`, Siso also supports `foo.h^` syntax to compile
371the corresponding `foo.o` if it exists.
372
dpranke0ae7cad2016-11-30 07:47:58373## Run Chromium
374
375Once it is built, you can simply run the browser:
376
sdy93387fa2016-12-01 01:03:44377```shell
378$ out/Default/chrome
379```
dpranke0ae7cad2016-11-30 07:47:58380
Victor Viannaeda6fcc42023-03-14 17:18:22381If you're using a remote machine that supports Chrome Remote Desktop, you can
382add this to your .bashrc / .bash_profile.
383
384```shell
385if [[ -z "${DISPLAY}" ]]; then
Victor Hugo Vianna Silva451142c22024-07-08 21:37:41386 # In reality, Chrome Remote Desktop starts with 20 and increases until it
387 # finds an available ID [1]. So this isn't guaranteed to always work, but
388 # should work on the vast majoriy of cases.
389 #
390 # [1] https://source.chromium.org/chromium/chromium/src/+/main:remoting/host/linux/linux_me2me_host.py;l=112;drc=464a632e21bcec76c743930d4db8556613e21fd8
391 export DISPLAY=:20
Victor Viannaeda6fcc42023-03-14 17:18:22392fi
393```
394
395This means if you launch Chrome from an SSH session, the UI output will be
396available in Chrome Remote Desktop.
397
dpranke0ae7cad2016-11-30 07:47:58398## Running test targets
399
Andrew Williamsfa9b7d62023-03-20 15:48:28400Tests are split into multiple test targets based on their type and where they
401exist in the directory structure. To see what target a given unit test or
402browser test file corresponds to, the following command can be used:
403
404```shell
405$ gn refs out/Default --testonly=true --type=executable --all chrome/browser/ui/browser_list_unittest.cc
406//chrome/test:unit_tests
407```
408
409In the example above, the target is unit_tests. The unit_tests binary can be
410built by running the following command:
Fred Shih865fb8f2022-02-03 03:54:19411
412```shell
413$ autoninja -C out/Default unit_tests
414```
415
416You can run the tests by running the unit_tests binary. You can also limit which
417tests are run using the `--gtest_filter` arg, e.g.:
dpranke0ae7cad2016-11-30 07:47:58418
sdy93387fa2016-12-01 01:03:44419```shell
Andrew Williamsfa9b7d62023-03-20 15:48:28420$ out/Default/unit_tests --gtest_filter="BrowserListUnitTest.*"
sdy93387fa2016-12-01 01:03:44421```
dpranke0ae7cad2016-11-30 07:47:58422
423You can find out more about GoogleTest at its
424[GitHub page](https://github.com/google/googletest).
425
426## Update your checkout
427
428To update an existing checkout, you can run
429
sdy93387fa2016-12-01 01:03:44430```shell
431$ git rebase-update
432$ gclient sync
433```
dpranke0ae7cad2016-11-30 07:47:58434
435The first command updates the primary Chromium source repository and rebases
sdy93387fa2016-12-01 01:03:44436any of your local branches on top of tip-of-tree (aka the Git branch
Andrew Williamsbbc1a1e2021-07-21 01:51:22437`origin/main`). If you don't want to use this script, you can also just use
sdy93387fa2016-12-01 01:03:44438`git pull` or other common Git commands to update the repo.
dpranke0ae7cad2016-11-30 07:47:58439
sdy93387fa2016-12-01 01:03:44440The second command syncs dependencies to the appropriate versions and re-runs
441hooks as needed.
dpranke0ae7cad2016-11-30 07:47:58442
443## Tips, tricks, and troubleshooting
andybons3322f762015-08-24 21:37:09444
445### Linker Crashes
andybonsad92aa32015-08-31 02:27:44446
andybons3322f762015-08-24 21:37:09447If, during the final link stage:
andybonsad92aa32015-08-31 02:27:44448
sdy93387fa2016-12-01 01:03:44449```
450LINK out/Debug/chrome
451```
andybonsad92aa32015-08-31 02:27:44452
andybons3322f762015-08-24 21:37:09453You get an error like:
andybons3322f762015-08-24 21:37:09454
sdy93387fa2016-12-01 01:03:44455```
456collect2: ld terminated with signal 6 Aborted terminate called after throwing an instance of 'std::bad_alloc'
457collect2: ld terminated with signal 11 [Segmentation fault], core dumped
458```
andybonsad92aa32015-08-31 02:27:44459
Song Qinglin5ac3cf922022-11-09 04:12:22460or:
461
462```
463LLVM ERROR: out of memory
464```
465
brettwc25693b32016-05-26 01:11:52466you are probably running out of memory when linking. You *must* use a 64-bit
467system to build. Try the following build settings (see [GN build
468configuration](https://www.chromium.org/developers/gn-build-configuration) for
sdy93387fa2016-12-01 01:03:44469other settings):
andybonsad92aa32015-08-31 02:27:44470
Omar Shawky971848ce2024-04-17 21:47:30471* Build in release mode (debugging symbols require more memory):
brettwc25693b32016-05-26 01:11:52472 `is_debug = false`
Omar Shawky971848ce2024-04-17 21:47:30473* Turn off symbols: `symbol_level = 0`
474* Build in component mode (this is for development only, it will be slower and
sdy93387fa2016-12-01 01:03:44475 may have broken functionality): `is_component_build = true`
Omar Shawky971848ce2024-04-17 21:47:30476* For official (ThinLTO) builds on Linux, increase the vm.max_map_count kernel
Song Qinglin5ac3cf922022-11-09 04:12:22477 parameter: increase the `vm.max_map_count` value from default (like 65530)
478 to for example 262144. You can run the `sudo sysctl -w vm.max_map_count=262144`
479 command to set it in the current session from the shell, or add the
480 `vm.max_map_count=262144` to /etc/sysctl.conf to save it permanently.
andybons3322f762015-08-24 21:37:09481
dpranke0ae7cad2016-11-30 07:47:58482### More links
andybons3322f762015-08-24 21:37:09483
Omar Shawky971848ce2024-04-17 21:47:30484* Information about [building with Clang](../clang.md).
485* You may want to [use a chroot](using_a_chroot.md) to
dpranke0ae7cad2016-11-30 07:47:58486 isolate yourself from versioning or packaging conflicts.
Omar Shawky971848ce2024-04-17 21:47:30487* Cross-compiling for ARM? See [LinuxChromiumArm](chromium_arm.md).
488* Want to use Eclipse as your IDE? See
Tom Anderson93e49e492019-12-23 19:55:37489 [LinuxEclipseDev](eclipse_dev.md).
Omar Shawky971848ce2024-04-17 21:47:30490* Want to use your built version as your default browser? See
Tom Anderson93e49e492019-12-23 19:55:37491 [LinuxDevBuildAsDefaultBrowser](dev_build_as_default_browser.md).
andybons3322f762015-08-24 21:37:09492
dpranke2989a782016-12-02 02:57:12493## Next Steps
andybonsad92aa32015-08-31 02:27:44494
495If you want to contribute to the effort toward a Chromium-based browser for
Tom Anderson93e49e492019-12-23 19:55:37496Linux, please check out the [Linux Development page](development.md) for
andybonsad92aa32015-08-31 02:27:44497more information.
dpranke2989a782016-12-02 02:57:12498
Omar Shawky971848ce2024-04-17 21:47:30499## Notes for other distros
dpranke2989a782016-12-02 02:57:12500
501### Arch Linux
502
503Instead of running `install-build-deps.sh` to install build dependencies, run:
504
505```shell
506$ sudo pacman -S --needed python perl gcc gcc-libs bison flex gperf pkgconfig \
Tom Anderson761687a2023-06-14 17:27:39507nss alsa-lib glib2 gtk3 nspr freetype2 cairo dbus xorg-server-xvfb \
508xorg-xdpyinfo
dpranke2989a782016-12-02 02:57:12509```
510
511For the optional packages on Arch Linux:
512
Omar Shawky971848ce2024-04-17 21:47:30513* `php-cgi` is provided with `pacman`
514* `wdiff` is not in the main repository but `dwdiff` is. You can get `wdiff`
dpranke2989a782016-12-02 02:57:12515 in AUR/`yaourt`
dpranke2989a782016-12-02 02:57:12516
Kenneth Russell56293772018-09-21 01:46:15517### Crostini (Debian based)
518
David Munro9b5f4c4f2019-07-24 08:23:27519First install the `file` and `lsb-release` commands for the script to run properly:
Kenneth Russell56293772018-09-21 01:46:15520
521```shell
David Munro9b5f4c4f2019-07-24 08:23:27522$ sudo apt-get install file lsb-release
Kenneth Russell56293772018-09-21 01:46:15523```
524
525Then invoke install-build-deps.sh with the `--no-arm` argument,
526because the ARM toolchain doesn't exist for this configuration:
527
528```shell
529$ sudo install-build-deps.sh --no-arm
530```
531
dpranke2989a782016-12-02 02:57:12532### Fedora
533
534Instead of running `build/install-build-deps.sh`, run:
535
536```shell
537su -c 'yum install git python bzip2 tar pkgconfig atk-devel alsa-lib-devel \
538bison binutils brlapi-devel bluez-libs-devel bzip2-devel cairo-devel \
539cups-devel dbus-devel dbus-glib-devel expat-devel fontconfig-devel \
Tom Anderson287339e2018-08-22 21:52:02540freetype-devel gcc-c++ glib2-devel glibc.i686 gperf glib2-devel \
Tim Brown36312fc2017-12-15 22:56:20541gtk3-devel java-1.*.0-openjdk-devel libatomic libcap-devel libffi-devel \
Tom Anderson761687a2023-06-14 17:27:39542libgcc.i686 libjpeg-devel libstdc++.i686 libX11-devel libXScrnSaver-devel \
543libXtst-devel libxkbcommon-x11-devel ncurses-compat-libs nspr-devel nss-devel \
544pam-devel pango-devel pciutils-devel pulseaudio-libs-devel zlib.i686 httpd \
545mod_ssl php php-cli python-psutil wdiff xorg-x11-server-Xvfb'
dpranke2989a782016-12-02 02:57:12546```
547
Kent Tamura59ffb022018-11-27 05:30:56548The fonts needed by Blink's web tests can be obtained by following [these
Victor Costan44af72b2017-11-13 20:01:30549instructions](https://gist.github.com/pwnall/32a3b11c2b10f6ae5c6a6de66c1e12ae).
550For the optional packages:
dpranke2989a782016-12-02 02:57:12551
552* `php-cgi` is provided by the `php-cli` package.
Victor Costan44af72b2017-11-13 20:01:30553* `sun-java6-fonts` is covered by the instructions linked above.
dpranke2989a782016-12-02 02:57:12554
555### Gentoo
556
557You can just run `emerge www-client/chromium`.
558
Delan Azabani43eefa3d2024-05-09 03:39:33559### NixOS
560
561To get a shell with the dev environment:
562
563```sh
564$ nix-shell tools/nix/shell.nix
565```
566
567To run a command in the dev environment:
568
569```sh
570$ NIX_SHELL_RUN='autoninja -C out/Default chrome' nix-shell tools/nix/shell.nix
571```
572
573To set up clangd with remote indexing support, run the command below, then copy
574the path into your editor config:
575
576```sh
577$ NIX_SHELL_RUN='readlink /usr/bin/clangd' nix-shell tools/nix/shell.nix
578```
579
dpranke2989a782016-12-02 02:57:12580### OpenSUSE
581
582Use `zypper` command to install dependencies:
583
584(openSUSE 11.1 and higher)
585
586```shell
Tim Brown36312fc2017-12-15 22:56:20587sudo zypper in subversion pkg-config python perl bison flex gperf \
588 mozilla-nss-devel glib2-devel gtk-devel wdiff lighttpd gcc gcc-c++ \
589 mozilla-nspr mozilla-nspr-devel php5-fastcgi alsa-devel libexpat-devel \
dpranke2989a782016-12-02 02:57:12590 libjpeg-devel libbz2-devel
591```
592
593For 11.0, use `libnspr4-0d` and `libnspr4-dev` instead of `mozilla-nspr` and
Tom Anderson287339e2018-08-22 21:52:02594`mozilla-nspr-devel`, and use `php5-cgi` instead of `php5-fastcgi`.
dpranke2989a782016-12-02 02:57:12595
596(openSUSE 11.0)
597
598```shell
599sudo zypper in subversion pkg-config python perl \
600 bison flex gperf mozilla-nss-devel glib2-devel gtk-devel \
601 libnspr4-0d libnspr4-dev wdiff lighttpd gcc gcc-c++ libexpat-devel \
Tom Anderson287339e2018-08-22 21:52:02602 php5-cgi alsa-devel gtk3-devel jpeg-devel
dpranke2989a782016-12-02 02:57:12603```
604
605The Ubuntu package `sun-java6-fonts` contains a subset of Java of the fonts used.
606Since this package requires Java as a prerequisite anyway, we can do the same
607thing by just installing the equivalent openSUSE Sun Java package:
608
609```shell
610sudo zypper in java-1_6_0-sun
611```
612
613WebKit is currently hard-linked to the Microsoft fonts. To install these using `zypper`
614
615```shell
616sudo zypper in fetchmsttfonts pullin-msttf-fonts
617```
618
619To make the fonts installed above work, as the paths are hardcoded for Ubuntu,
620create symlinks to the appropriate locations:
621
622```shell
623sudo mkdir -p /usr/share/fonts/truetype/msttcorefonts
624sudo ln -s /usr/share/fonts/truetype/arial.ttf /usr/share/fonts/truetype/msttcorefonts/Arial.ttf
625sudo ln -s /usr/share/fonts/truetype/arialbd.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf
626sudo ln -s /usr/share/fonts/truetype/arialbi.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf
627sudo ln -s /usr/share/fonts/truetype/ariali.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf
628sudo ln -s /usr/share/fonts/truetype/comic.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf
629sudo ln -s /usr/share/fonts/truetype/comicbd.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf
630sudo ln -s /usr/share/fonts/truetype/cour.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf
631sudo ln -s /usr/share/fonts/truetype/courbd.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf
632sudo ln -s /usr/share/fonts/truetype/courbi.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf
633sudo ln -s /usr/share/fonts/truetype/couri.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf
634sudo ln -s /usr/share/fonts/truetype/impact.ttf /usr/share/fonts/truetype/msttcorefonts/Impact.ttf
635sudo ln -s /usr/share/fonts/truetype/times.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf
636sudo ln -s /usr/share/fonts/truetype/timesbd.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf
637sudo ln -s /usr/share/fonts/truetype/timesbi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf
638sudo ln -s /usr/share/fonts/truetype/timesi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf
639sudo ln -s /usr/share/fonts/truetype/verdana.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana.ttf
640sudo ln -s /usr/share/fonts/truetype/verdanab.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf
641sudo ln -s /usr/share/fonts/truetype/verdanai.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf
642sudo ln -s /usr/share/fonts/truetype/verdanaz.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf
643```
644
645The Ubuntu package `sun-java6-fonts` contains a subset of Java of the fonts used.
646Since this package requires Java as a prerequisite anyway, we can do the same
647thing by just installing the equivalent openSUSE Sun Java package:
648
649```shell
650sudo zypper in java-1_6_0-sun
651```
652
653WebKit is currently hard-linked to the Microsoft fonts. To install these using `zypper`
654
655```shell
656sudo zypper in fetchmsttfonts pullin-msttf-fonts
657```
658
659To make the fonts installed above work, as the paths are hardcoded for Ubuntu,
660create symlinks to the appropriate locations:
661
662```shell
663sudo mkdir -p /usr/share/fonts/truetype/msttcorefonts
664sudo ln -s /usr/share/fonts/truetype/arial.ttf /usr/share/fonts/truetype/msttcorefonts/Arial.ttf
665sudo ln -s /usr/share/fonts/truetype/arialbd.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf
666sudo ln -s /usr/share/fonts/truetype/arialbi.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf
667sudo ln -s /usr/share/fonts/truetype/ariali.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf
668sudo ln -s /usr/share/fonts/truetype/comic.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf
669sudo ln -s /usr/share/fonts/truetype/comicbd.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf
670sudo ln -s /usr/share/fonts/truetype/cour.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf
671sudo ln -s /usr/share/fonts/truetype/courbd.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf
672sudo ln -s /usr/share/fonts/truetype/courbi.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf
673sudo ln -s /usr/share/fonts/truetype/couri.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf
674sudo ln -s /usr/share/fonts/truetype/impact.ttf /usr/share/fonts/truetype/msttcorefonts/Impact.ttf
675sudo ln -s /usr/share/fonts/truetype/times.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf
676sudo ln -s /usr/share/fonts/truetype/timesbd.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf
677sudo ln -s /usr/share/fonts/truetype/timesbi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf
678sudo ln -s /usr/share/fonts/truetype/timesi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf
679sudo ln -s /usr/share/fonts/truetype/verdana.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana.ttf
680sudo ln -s /usr/share/fonts/truetype/verdanab.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf
681sudo ln -s /usr/share/fonts/truetype/verdanai.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf
682sudo ln -s /usr/share/fonts/truetype/verdanaz.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf
683```
684
685And then for the Java fonts:
686
687```shell
688sudo mkdir -p /usr/share/fonts/truetype/ttf-lucida
689sudo find /usr/lib*/jvm/java-1.6.*-sun-*/jre/lib -iname '*.ttf' -print \
690 -exec ln -s {} /usr/share/fonts/truetype/ttf-lucida \;
691```
Omar Shawky08b259c2024-03-27 19:52:17692
693### Docker
694
695#### Prerequisites
696
697While it is not a common setup, Chromium compilation should work from within a
698Docker container. If you choose to compile from within a container for whatever
699reason, you will need to make sure that the following tools are available:
700
701* `curl`
702* `git`
703* `lsb_release`
704* `python3`
705* `sudo`
706* `file`
707
708There may be additional Docker-specific issues during compilation. See
709[this bug](https://crbug.com/1377520) for additional details on this.
710
Omar Shawky971848ce2024-04-17 21:47:30711Note: [Clone depot_tools](#install-depot_tools) first.
Omar Shawky08b259c2024-03-27 19:52:17712
713#### Build Steps
714
7151. Put the following Dockerfile in `/path/to/chromium/`.
716
717```docker
718# Use an official Ubuntu base image with Docker already installed
719FROM ubuntu:22.04
720
721# Set environment variables
722ENV DEBIAN_FRONTEND=noninteractive
723
724# Install Mantatory tools (curl git python3) and optional tools (vim sudo)
725RUN apt-get update && \
726 apt-get install -y curl git lsb-release python3 git file vim sudo && \
727 rm -rf /var/lib/apt/lists/*
728
729# Export depot_tools path
730ENV PATH="/depot_tools:${PATH}"
731
732# Configure git for safe.directory
Ho Cheung7c53eaf2024-05-31 00:31:26733RUN git config --global --add safe.directory /depot_tools && \
734 git config --global --add safe.directory /chromium/src
Omar Shawky08b259c2024-03-27 19:52:17735
Ho Cheung7c53eaf2024-05-31 00:31:26736# Set the working directory to the existing Chromium source directory.
737# This can be either "/chromium/src" or "/chromium".
738WORKDIR /chromium/src
Omar Shawky08b259c2024-03-27 19:52:17739
740# Expose any necessary ports (if needed)
741# EXPOSE 8080
mohamedhany015ae34802024-10-16 16:34:41742
743# Create a dummy user and group to avoid permission issues
744RUN groupadd -g 1001 chrom-d && \
745 useradd -u 1000 -g 1001 -m chrom-d
Ho Cheung7c53eaf2024-05-31 00:31:26746
747# Create normal user with name "chrom-d". Optional and you can use root but
748# not advised.
749USER chrom-d
Omar Shawky08b259c2024-03-27 19:52:17750
Omar Shawky971848ce2024-04-17 21:47:30751# Start Chromium Builder "chrom-d" (modify this command as needed)
Omar Shawky08b259c2024-03-27 19:52:17752# CMD ["autoninja -C out/Default chrome"]
753CMD ["bash"]
754```
755
7562. Build Container
757
758```shell
759# chrom-b is just a name; You can change it but you must reflect the renaming
760# in all commands below
761$ docker build -t chrom-b .
762```
763
7643. Run container as root to install dependencies
765
766```shell
mohamedhany015ae34802024-10-16 16:34:41767$ docker run
Omar Shawky08b259c2024-03-27 19:52:17768 -it \ # Run docker interactively
Omar Shawky971848ce2024-04-17 21:47:30769 --name chrom-b \ # with name "chrom-b"
770 -u root \ # with user root
771 -v /path/on/machine/to/chromium:/chromium \ # With chromium folder mounted
772 -v /path/on/machine/to/depot_tools:/depot_tools \ # With depot_tools mounted
773 chrom-b # Run container with image name "chrom-b"
Omar Shawky08b259c2024-03-27 19:52:17774```
775
mohamedhany015ae34802024-10-16 16:34:41776*** note
777**Note:** When running the command as a single line in bash, please remove the
778comments (after the `#`) to avoid breaking the command.
779***
780
Omar Shawky971848ce2024-04-17 21:47:307814. Install dependencies:
Omar Shawky08b259c2024-03-27 19:52:17782
783```shell
Ho Cheung7c53eaf2024-05-31 00:31:26784./build/install-build-deps.sh
Omar Shawky08b259c2024-03-27 19:52:17785```
786
Ho Cheung7c53eaf2024-05-31 00:31:267875. [Run hooks](#run-the-hooks) (On docker or machine if you installed depot_tools on machine)
788
mohamedhany015ae34802024-10-16 16:34:41789*** note
790**Before running hooks:** Ensure that all directories within
791`third_party` are added as safe directories in Git. This is required
792when running in the container because the ownership of the `src/`
793directory (e.g., `chrom-b`) differs from the current user
794(e.g., `root`). To prevent Git **warnings** about "dubious ownership"
795run the following command after installing the dependencies:
796
797```shell
798# Loop through each directory in /chromium/src/third_party and add
799# them as safe directories in Git
800$ for dir in /chromium/src/third_party/*; do
801 if [ -d "$dir" ]; then
802 git config --global --add safe.directory "$dir"
803 fi
804done
805```
806***
807
Ho Cheung7c53eaf2024-05-31 00:31:268086. Exit container
809
8107. Save container image with tag-id name `dpv1.0`. Run this on the machine, not in container
Omar Shawky971848ce2024-04-17 21:47:30811
Omar Shawky08b259c2024-03-27 19:52:17812```shell
mohamedhany015ae34802024-10-16 16:34:41813# Get docker running/stopped containers, copy the "chrom-b" id
814$ docker container ls -a
Omar Shawky971848ce2024-04-17 21:47:30815# Save/tag running docker container with name "chrom-b" with "dpv1.0"
816# You can choose any tag name you want but propagate name accordingly
817# You will need to create new tags when working on different parts of
818# chromium which requires installing additional dependencies
Omar Shawky08b259c2024-03-27 19:52:17819$ docker commit <ID from above step> chrom-b:dpv1.0
820# Optional, just saves space by deleting unnecessary images
821$ docker image rmi chrom-b:latest && docker image prune \
822 && docker container prune && docker builder prune
823```
824
Omar Shawky08b259c2024-03-27 19:52:17825#### Run container
826
827```shell
828$ docker run --rm \ # close instance upon exit
829 -it \ # Run docker interactively
Omar Shawky971848ce2024-04-17 21:47:30830 --name chrom-b \ # with name "chrom-b"
Omar Shawky08b259c2024-03-27 19:52:17831 -u $(id -u):$(id -g) \ # Run container as a non-root user with same UID & GID
Omar Shawky971848ce2024-04-17 21:47:30832 -v /path/on/machine/to/chromium:/chromium \ # With chromium folder mounted
833 -v /path/on/machine/to/depot_tools:/depot_tools \ # With depot_tools mounted
834 chrom-b:dpv1.0 # Run container with image name "chrom-b" and tag dpv1.0
Omar Shawky08b259c2024-03-27 19:52:17835```
mohamedhany015ae34802024-10-16 16:34:41836
837*** note
838**Note:** When running the command as a single line in bash, please remove the
839comments (after the `#`) to avoid breaking the command.
840***