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 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 15 | * A 64-bit Intel machine with at least 8GB of RAM. More than 16GB is highly |
| 16 | recommended. |
| 17 | * At least 100GB of free disk space. |
Dirk Pranke | d7da6f3 | 2021-04-22 19:30:55 | [diff] [blame] | 18 | * You must have Git and Python v3 installed already (and `python3` must point |
| 19 | to a Python v3 binary). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 20 | |
Johann | 112b198b | 2021-07-01 00:25:33 | [diff] [blame] | 21 | Most development is done on Ubuntu (currently 18.04, Bionic Beaver). There are |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 22 | some instructions for other distros below, but they are mostly unsupported. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 23 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 24 | ## Install `depot_tools` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 25 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 26 | Clone the `depot_tools` repository: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 27 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 28 | ```shell |
| 29 | $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
| 30 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 31 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 32 | Add `depot_tools` to the end of your PATH (you will probably want to put this |
| 33 | in your `~/.bashrc` or `~/.zshrc`). Assuming you cloned `depot_tools` to |
| 34 | `/path/to/depot_tools`: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 35 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 36 | ```shell |
| 37 | $ export PATH="$PATH:/path/to/depot_tools" |
| 38 | ``` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 39 | |
Claudio DeSouza | ae44ac1 | 2018-02-13 16:11:45 | [diff] [blame] | 40 | When cloning `depot_tools` to your home directory **do not** use `~` on PATH, |
| 41 | otherwise `gclient runhooks` will fail to run. Rather, you should use either |
| 42 | `$HOME` or the absolute path: |
| 43 | |
| 44 | ```shell |
| 45 | $ export PATH="$PATH:${HOME}/depot_tools" |
| 46 | ``` |
| 47 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 48 | ## Get the code |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 49 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 50 | Create a `chromium` directory for the checkout and change to it (you can call |
| 51 | this whatever you like and put it wherever you like, as long as the full path |
| 52 | has no spaces): |
| 53 | |
| 54 | ```shell |
| 55 | $ mkdir ~/chromium && cd ~/chromium |
| 56 | ``` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 57 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 58 | Run the `fetch` tool from depot_tools to check out the code and its |
| 59 | dependencies. |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 60 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 61 | ```shell |
| 62 | $ fetch --nohooks chromium |
| 63 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 64 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 65 | 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] | 66 | adding the `--no-history` flag to `fetch`. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 67 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 68 | Expect the command to take 30 minutes on even a fast connection, and many |
| 69 | hours on slower ones. |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 70 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 71 | If you've already installed the build dependencies on the machine (from another |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 72 | checkout, for example), you can omit the `--nohooks` flag and `fetch` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 73 | will automatically execute `gclient runhooks` at the end. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 74 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 75 | When `fetch` completes, it will have created a hidden `.gclient` file and a |
| 76 | directory called `src` in the working directory. The remaining instructions |
| 77 | assume you have switched to the `src` directory: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 78 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 79 | ```shell |
| 80 | $ cd src |
| 81 | ``` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 82 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 83 | ### Install additional build dependencies |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 84 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 85 | Once you have checked out the code, and assuming you're using Ubuntu, run |
| 86 | [build/install-build-deps.sh](/build/install-build-deps.sh) |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 87 | |
Aaron Gable | 3bc9368 | 2019-01-11 02:16:07 | [diff] [blame] | 88 | ```shell |
| 89 | $ ./build/install-build-deps.sh |
| 90 | ``` |
| 91 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 92 | You may need to adjust the build dependencies for other distros. There are |
| 93 | some [notes](#notes) at the end of this document, but we make no guarantees |
| 94 | for their accuracy. |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 95 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 96 | ### Run the hooks |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 97 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 98 | 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] | 99 | Chromium-specific hooks, which will download additional binaries and other |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 100 | things you might need: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 101 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 102 | ```shell |
| 103 | $ gclient runhooks |
| 104 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 105 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 106 | *Optional*: You can also [install API |
| 107 | keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your |
| 108 | build to talk to some Google services, but this is not necessary for most |
| 109 | development and testing purposes. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 110 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 111 | ## Setting up the build |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 112 | |
Tom Bridgwater | eef40154 | 2018-08-17 00:54:43 | [diff] [blame] | 113 | Chromium uses [Ninja](https://ninja-build.org) as its main build tool along with |
Andrew Williams | bbc1a1e | 2021-07-21 01:51:22 | [diff] [blame] | 114 | 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] | 115 | to generate `.ninja` files. You can create any number of *build directories* |
| 116 | with different configurations. To create a build directory, run: |
andybons | 8c02a1f | 2015-09-04 17:02:32 | [diff] [blame] | 117 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 118 | ```shell |
| 119 | $ gn gen out/Default |
| 120 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 121 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 122 | * You only have to run this once for each new build directory, Ninja will |
| 123 | update the build files as needed. |
| 124 | * You can replace `Default` with another name, but |
| 125 | it should be a subdirectory of `out`. |
| 126 | * For other build arguments, including release settings, see [GN build |
| 127 | configuration](https://www.chromium.org/developers/gn-build-configuration). |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 128 | The default will be a debug component build matching the current host |
| 129 | operating system and CPU. |
| 130 | * 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] | 131 | [quick start guide](https://gn.googlesource.com/gn/+/main/docs/quick_start.md). |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 132 | |
amoylan | a960fa5 | 2016-12-09 22:47:28 | [diff] [blame] | 133 | ### <a name="faster-builds"></a>Faster builds |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 134 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 135 | This section contains some things you can change to speed up your builds, |
| 136 | sorted so that the things that make the biggest difference are first. |
| 137 | |
Fumitoshi Ukai | e15fd78 | 2019-10-15 05:52:48 | [diff] [blame] | 138 | #### Use Goma |
| 139 | |
| 140 | Google developed the distributed compiler called |
| 141 | [Goma](https://chromium.googlesource.com/infra/goma/client). |
Fumitoshi Ukai | e15fd78 | 2019-10-15 05:52:48 | [diff] [blame] | 142 | |
Yoshisato Yanagisawa | b66864e | 2021-03-11 21:22:48 | [diff] [blame] | 143 | If you would like to use `Goma` provisioned by Google, |
| 144 | please follow [Goma for Chromium contributors](https://chromium.googlesource.com/infra/goma/client/+/HEAD/doc/early-access-guide.md). |
Fumitoshi Ukai | e15fd78 | 2019-10-15 05:52:48 | [diff] [blame] | 145 | |
Yoshisato Yanagisawa | b66864e | 2021-03-11 21:22:48 | [diff] [blame] | 146 | If you are a Google employee, see |
| 147 | [go/building-chrome](https://goto.google.com/building-chrome) instead. |
Fumitoshi Ukai | e15fd78 | 2019-10-15 05:52:48 | [diff] [blame] | 148 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 149 | #### Disable NaCl |
| 150 | |
| 151 | By default, the build includes support for |
| 152 | [Native Client (NaCl)](https://developer.chrome.com/native-client), but |
Victor Costan | 44af72b | 2017-11-13 20:01:30 | [diff] [blame] | 153 | most of the time you won't need it. You can set the GN argument |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 154 | `enable_nacl=false` and it won't be built. |
| 155 | |
| 156 | #### Include fewer debug symbols |
| 157 | |
| 158 | By default GN produces a build with all of the debug assertions enabled |
| 159 | (`is_debug=true`) and including full debug info (`symbol_level=2`). Setting |
| 160 | `symbol_level=1` will produce enough information for stack traces, but not |
| 161 | line-by-line debugging. Setting `symbol_level=0` will include no debug |
| 162 | symbols at all. Either will speed up the build compared to full symbols. |
| 163 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 164 | #### Disable debug symbols for Blink |
| 165 | |
| 166 | Due to its extensive use of templates, the Blink code produces about half |
| 167 | of our debug symbols. If you don't ever need to debug Blink, you can set |
James Cook | 26699a9 | 2019-03-12 22:23:10 | [diff] [blame] | 168 | the GN arg `blink_symbol_level=0`. |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 169 | |
| 170 | #### Use Icecc |
| 171 | |
| 172 | [Icecc](https://github.com/icecc/icecream) is the distributed compiler with a |
| 173 | central scheduler to share build load. Currently, many external contributors use |
Fumitoshi Ukai | e15fd78 | 2019-10-15 05:52:48 | [diff] [blame] | 174 | it. e.g. Intel, Opera, Samsung (this is not useful if you're using Goma). |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 175 | |
| 176 | In order to use `icecc`, set the following GN args: |
| 177 | |
| 178 | ``` |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 179 | use_debug_fission=false |
| 180 | is_clang=false |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 181 | ``` |
| 182 | |
Victor Costan | 44af72b | 2017-11-13 20:01:30 | [diff] [blame] | 183 | See these links for more on the |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 184 | [bundled_binutils limitation](https://github.com/icecc/icecream/commit/b2ce5b9cc4bd1900f55c3684214e409fa81e7a92), |
| 185 | the [debug fission limitation](http://gcc.gnu.org/wiki/DebugFission). |
| 186 | |
| 187 | Using the system linker may also be necessary when using glibc 2.21 or newer. |
| 188 | See [related bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808181). |
| 189 | |
| 190 | #### ccache |
| 191 | |
| 192 | You can use [ccache](https://ccache.samba.org) to speed up local builds (again, |
Fumitoshi Ukai | e15fd78 | 2019-10-15 05:52:48 | [diff] [blame] | 193 | this is not useful if you're using Goma). |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 194 | |
| 195 | Increase your ccache hit rate by setting `CCACHE_BASEDIR` to a parent directory |
| 196 | that the working directories all have in common (e.g., |
| 197 | `/home/yourusername/development`). Consider using |
| 198 | `CCACHE_SLOPPINESS=include_file_mtime` (since if you are using multiple working |
| 199 | directories, header times in svn sync'ed portions of your trees will be |
| 200 | different - see |
| 201 | [the ccache troubleshooting section](http://ccache.samba.org/manual.html#_troubleshooting) |
| 202 | for additional information). If you use symbolic links from your home directory |
| 203 | to get to the local physical disk directory where you keep those working |
| 204 | development directories, consider putting |
| 205 | |
| 206 | alias cd="cd -P" |
| 207 | |
| 208 | in your `.bashrc` so that `$PWD` or `cwd` always refers to a physical, not |
| 209 | logical directory (and make sure `CCACHE_BASEDIR` also refers to a physical |
| 210 | parent). |
| 211 | |
| 212 | If you tune ccache correctly, a second working directory that uses a branch |
| 213 | tracking trunk and is up to date with trunk and was gclient sync'ed at about the |
| 214 | same time should build chrome in about 1/3 the time, and the cache misses as |
| 215 | reported by `ccache -s` should barely increase. |
| 216 | |
Song Fangzhen | 4b68a6e3 | 2021-07-14 05:53:40 | [diff] [blame] | 217 | This is especially useful if you use |
| 218 | [git-worktree](http://git-scm.com/docs/git-worktree) and keep multiple local |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 219 | working directories going at once. |
| 220 | |
| 221 | #### Using tmpfs |
| 222 | |
| 223 | You can use tmpfs for the build output to reduce the amount of disk writes |
| 224 | required. I.e. mount tmpfs to the output directory where the build output goes: |
| 225 | |
| 226 | As root: |
| 227 | |
| 228 | mount -t tmpfs -o size=20G,nr_inodes=40k,mode=1777 tmpfs /path/to/out |
| 229 | |
| 230 | *** note |
| 231 | **Caveat:** You need to have enough RAM + swap to back the tmpfs. For a full |
| 232 | debug build, you will need about 20 GB. Less for just building the chrome target |
| 233 | or for a release build. |
| 234 | *** |
| 235 | |
| 236 | Quick and dirty benchmark numbers on a HP Z600 (Intel core i7, 16 cores |
| 237 | hyperthreaded, 12 GB RAM) |
| 238 | |
| 239 | * With tmpfs: |
| 240 | * 12m:20s |
| 241 | * Without tmpfs |
| 242 | * 15m:40s |
| 243 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 244 | ## Build Chromium |
| 245 | |
| 246 | Build Chromium (the "chrome" target) with Ninja using the command: |
| 247 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 248 | ```shell |
Max Moroz | f5b31fcd | 2018-08-10 21:55:48 | [diff] [blame] | 249 | $ autoninja -C out/Default chrome |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 250 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 251 | |
Dirk Pranke | 8bd55f2 | 2018-10-24 21:22:10 | [diff] [blame] | 252 | (`autoninja` is a wrapper that automatically provides optimal values for the |
| 253 | arguments passed to `ninja`.) |
Max Moroz | f5b31fcd | 2018-08-10 21:55:48 | [diff] [blame] | 254 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 255 | You can get a list of all of the other build targets from GN by running `gn ls |
| 256 | out/Default` from the command line. To compile one, pass the GN label to Ninja |
Max Moroz | f5b31fcd | 2018-08-10 21:55:48 | [diff] [blame] | 257 | with no preceding "//" (so, for `//chrome/test:unit_tests` use `autoninja -C |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 258 | out/Default chrome/test:unit_tests`). |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 259 | |
| 260 | ## Run Chromium |
| 261 | |
| 262 | Once it is built, you can simply run the browser: |
| 263 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 264 | ```shell |
| 265 | $ out/Default/chrome |
| 266 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 267 | |
| 268 | ## Running test targets |
| 269 | |
| 270 | You can run the tests in the same way. You can also limit which tests are |
| 271 | run using the `--gtest_filter` arg, e.g.: |
| 272 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 273 | ```shell |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 274 | $ out/Default/unit_tests --gtest_filter="PushClientTest.*" |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 275 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 276 | |
| 277 | You can find out more about GoogleTest at its |
| 278 | [GitHub page](https://github.com/google/googletest). |
| 279 | |
| 280 | ## Update your checkout |
| 281 | |
| 282 | To update an existing checkout, you can run |
| 283 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 284 | ```shell |
| 285 | $ git rebase-update |
| 286 | $ gclient sync |
| 287 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 288 | |
| 289 | The first command updates the primary Chromium source repository and rebases |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 290 | 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] | 291 | `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] | 292 | `git pull` or other common Git commands to update the repo. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 293 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 294 | The second command syncs dependencies to the appropriate versions and re-runs |
| 295 | hooks as needed. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 296 | |
| 297 | ## Tips, tricks, and troubleshooting |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 298 | |
| 299 | ### Linker Crashes |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 300 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 301 | If, during the final link stage: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 302 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 303 | ``` |
| 304 | LINK out/Debug/chrome |
| 305 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 306 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 307 | You get an error like: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 308 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 309 | ``` |
| 310 | collect2: ld terminated with signal 6 Aborted terminate called after throwing an instance of 'std::bad_alloc' |
| 311 | collect2: ld terminated with signal 11 [Segmentation fault], core dumped |
| 312 | ``` |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 313 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 314 | you are probably running out of memory when linking. You *must* use a 64-bit |
| 315 | system to build. Try the following build settings (see [GN build |
| 316 | configuration](https://www.chromium.org/developers/gn-build-configuration) for |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 317 | other settings): |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 318 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 319 | * Build in release mode (debugging symbols require more memory): |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 320 | `is_debug = false` |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 321 | * Turn off symbols: `symbol_level = 0` |
| 322 | * Build in component mode (this is for development only, it will be slower and |
| 323 | may have broken functionality): `is_component_build = true` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 324 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 325 | ### More links |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 326 | |
Nicolas Norvez | ba04006 | 2020-01-15 01:17:26 | [diff] [blame] | 327 | * Information about [building with Clang](../clang.md). |
Tom Anderson | abdbd6a | 2020-01-09 16:59:27 | [diff] [blame] | 328 | * You may want to [use a chroot](using_a_chroot.md) to |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 329 | isolate yourself from versioning or packaging conflicts. |
Tom Anderson | 93e49e49 | 2019-12-23 19:55:37 | [diff] [blame] | 330 | * Cross-compiling for ARM? See [LinuxChromiumArm](chromium_arm.md). |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 331 | * Want to use Eclipse as your IDE? See |
Tom Anderson | 93e49e49 | 2019-12-23 19:55:37 | [diff] [blame] | 332 | [LinuxEclipseDev](eclipse_dev.md). |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 333 | * Want to use your built version as your default browser? See |
Tom Anderson | 93e49e49 | 2019-12-23 19:55:37 | [diff] [blame] | 334 | [LinuxDevBuildAsDefaultBrowser](dev_build_as_default_browser.md). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 335 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 336 | ## Next Steps |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 337 | |
| 338 | 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] | 339 | Linux, please check out the [Linux Development page](development.md) for |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 340 | more information. |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 341 | |
| 342 | ## Notes for other distros <a name="notes"></a> |
| 343 | |
| 344 | ### Arch Linux |
| 345 | |
| 346 | Instead of running `install-build-deps.sh` to install build dependencies, run: |
| 347 | |
| 348 | ```shell |
| 349 | $ sudo pacman -S --needed python perl gcc gcc-libs bison flex gperf pkgconfig \ |
Timothy Gu | fe67f0b | 2021-05-20 22:07:04 | [diff] [blame] | 350 | nss alsa-lib glib2 gtk3 nspr freetype2 cairo dbus libgnome-keyring \ |
| 351 | xorg-server-xvfb xorg-xdpyinfo |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 352 | ``` |
| 353 | |
| 354 | For the optional packages on Arch Linux: |
| 355 | |
| 356 | * `php-cgi` is provided with `pacman` |
| 357 | * `wdiff` is not in the main repository but `dwdiff` is. You can get `wdiff` |
| 358 | in AUR/`yaourt` |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 359 | |
Kenneth Russell | 5629377 | 2018-09-21 01:46:15 | [diff] [blame] | 360 | ### Crostini (Debian based) |
| 361 | |
David Munro | 9b5f4c4f | 2019-07-24 08:23:27 | [diff] [blame] | 362 | 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] | 363 | |
| 364 | ```shell |
David Munro | 9b5f4c4f | 2019-07-24 08:23:27 | [diff] [blame] | 365 | $ sudo apt-get install file lsb-release |
Kenneth Russell | 5629377 | 2018-09-21 01:46:15 | [diff] [blame] | 366 | ``` |
| 367 | |
| 368 | Then invoke install-build-deps.sh with the `--no-arm` argument, |
| 369 | because the ARM toolchain doesn't exist for this configuration: |
| 370 | |
| 371 | ```shell |
| 372 | $ sudo install-build-deps.sh --no-arm |
| 373 | ``` |
| 374 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 375 | ### Fedora |
| 376 | |
| 377 | Instead of running `build/install-build-deps.sh`, run: |
| 378 | |
| 379 | ```shell |
| 380 | su -c 'yum install git python bzip2 tar pkgconfig atk-devel alsa-lib-devel \ |
| 381 | bison binutils brlapi-devel bluez-libs-devel bzip2-devel cairo-devel \ |
| 382 | cups-devel dbus-devel dbus-glib-devel expat-devel fontconfig-devel \ |
Tom Anderson | 287339e | 2018-08-22 21:52:02 | [diff] [blame] | 383 | freetype-devel gcc-c++ glib2-devel glibc.i686 gperf glib2-devel \ |
Tim Brown | 36312fc | 2017-12-15 22:56:20 | [diff] [blame] | 384 | gtk3-devel java-1.*.0-openjdk-devel libatomic libcap-devel libffi-devel \ |
| 385 | libgcc.i686 libgnome-keyring-devel libjpeg-devel libstdc++.i686 libX11-devel \ |
| 386 | libXScrnSaver-devel libXtst-devel libxkbcommon-x11-devel ncurses-compat-libs \ |
| 387 | nspr-devel nss-devel pam-devel pango-devel pciutils-devel \ |
| 388 | pulseaudio-libs-devel zlib.i686 httpd mod_ssl php php-cli python-psutil wdiff \ |
| 389 | xorg-x11-server-Xvfb' |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 390 | ``` |
| 391 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 392 | 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] | 393 | instructions](https://gist.github.com/pwnall/32a3b11c2b10f6ae5c6a6de66c1e12ae). |
| 394 | For the optional packages: |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 395 | |
| 396 | * `php-cgi` is provided by the `php-cli` package. |
Victor Costan | 44af72b | 2017-11-13 20:01:30 | [diff] [blame] | 397 | * `sun-java6-fonts` is covered by the instructions linked above. |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 398 | |
| 399 | ### Gentoo |
| 400 | |
| 401 | You can just run `emerge www-client/chromium`. |
| 402 | |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 403 | ### OpenSUSE |
| 404 | |
| 405 | Use `zypper` command to install dependencies: |
| 406 | |
| 407 | (openSUSE 11.1 and higher) |
| 408 | |
| 409 | ```shell |
Tim Brown | 36312fc | 2017-12-15 22:56:20 | [diff] [blame] | 410 | sudo zypper in subversion pkg-config python perl bison flex gperf \ |
| 411 | mozilla-nss-devel glib2-devel gtk-devel wdiff lighttpd gcc gcc-c++ \ |
| 412 | mozilla-nspr mozilla-nspr-devel php5-fastcgi alsa-devel libexpat-devel \ |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 413 | libjpeg-devel libbz2-devel |
| 414 | ``` |
| 415 | |
| 416 | 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] | 417 | `mozilla-nspr-devel`, and use `php5-cgi` instead of `php5-fastcgi`. |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 418 | |
| 419 | (openSUSE 11.0) |
| 420 | |
| 421 | ```shell |
| 422 | sudo zypper in subversion pkg-config python perl \ |
| 423 | bison flex gperf mozilla-nss-devel glib2-devel gtk-devel \ |
| 424 | libnspr4-0d libnspr4-dev wdiff lighttpd gcc gcc-c++ libexpat-devel \ |
Tom Anderson | 287339e | 2018-08-22 21:52:02 | [diff] [blame] | 425 | php5-cgi alsa-devel gtk3-devel jpeg-devel |
dpranke | 2989a78 | 2016-12-02 02:57:12 | [diff] [blame] | 426 | ``` |
| 427 | |
| 428 | The Ubuntu package `sun-java6-fonts` contains a subset of Java of the fonts used. |
| 429 | Since this package requires Java as a prerequisite anyway, we can do the same |
| 430 | thing by just installing the equivalent openSUSE Sun Java package: |
| 431 | |
| 432 | ```shell |
| 433 | sudo zypper in java-1_6_0-sun |
| 434 | ``` |
| 435 | |
| 436 | WebKit is currently hard-linked to the Microsoft fonts. To install these using `zypper` |
| 437 | |
| 438 | ```shell |
| 439 | sudo zypper in fetchmsttfonts pullin-msttf-fonts |
| 440 | ``` |
| 441 | |
| 442 | To make the fonts installed above work, as the paths are hardcoded for Ubuntu, |
| 443 | create symlinks to the appropriate locations: |
| 444 | |
| 445 | ```shell |
| 446 | sudo mkdir -p /usr/share/fonts/truetype/msttcorefonts |
| 447 | sudo ln -s /usr/share/fonts/truetype/arial.ttf /usr/share/fonts/truetype/msttcorefonts/Arial.ttf |
| 448 | sudo ln -s /usr/share/fonts/truetype/arialbd.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf |
| 449 | sudo ln -s /usr/share/fonts/truetype/arialbi.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf |
| 450 | sudo ln -s /usr/share/fonts/truetype/ariali.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf |
| 451 | sudo ln -s /usr/share/fonts/truetype/comic.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf |
| 452 | sudo ln -s /usr/share/fonts/truetype/comicbd.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf |
| 453 | sudo ln -s /usr/share/fonts/truetype/cour.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf |
| 454 | sudo ln -s /usr/share/fonts/truetype/courbd.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf |
| 455 | sudo ln -s /usr/share/fonts/truetype/courbi.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf |
| 456 | sudo ln -s /usr/share/fonts/truetype/couri.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf |
| 457 | sudo ln -s /usr/share/fonts/truetype/impact.ttf /usr/share/fonts/truetype/msttcorefonts/Impact.ttf |
| 458 | sudo ln -s /usr/share/fonts/truetype/times.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf |
| 459 | sudo ln -s /usr/share/fonts/truetype/timesbd.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf |
| 460 | sudo ln -s /usr/share/fonts/truetype/timesbi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf |
| 461 | sudo ln -s /usr/share/fonts/truetype/timesi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf |
| 462 | sudo ln -s /usr/share/fonts/truetype/verdana.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana.ttf |
| 463 | sudo ln -s /usr/share/fonts/truetype/verdanab.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf |
| 464 | sudo ln -s /usr/share/fonts/truetype/verdanai.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf |
| 465 | sudo ln -s /usr/share/fonts/truetype/verdanaz.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf |
| 466 | ``` |
| 467 | |
| 468 | The Ubuntu package `sun-java6-fonts` contains a subset of Java of the fonts used. |
| 469 | Since this package requires Java as a prerequisite anyway, we can do the same |
| 470 | thing by just installing the equivalent openSUSE Sun Java package: |
| 471 | |
| 472 | ```shell |
| 473 | sudo zypper in java-1_6_0-sun |
| 474 | ``` |
| 475 | |
| 476 | WebKit is currently hard-linked to the Microsoft fonts. To install these using `zypper` |
| 477 | |
| 478 | ```shell |
| 479 | sudo zypper in fetchmsttfonts pullin-msttf-fonts |
| 480 | ``` |
| 481 | |
| 482 | To make the fonts installed above work, as the paths are hardcoded for Ubuntu, |
| 483 | create symlinks to the appropriate locations: |
| 484 | |
| 485 | ```shell |
| 486 | sudo mkdir -p /usr/share/fonts/truetype/msttcorefonts |
| 487 | sudo ln -s /usr/share/fonts/truetype/arial.ttf /usr/share/fonts/truetype/msttcorefonts/Arial.ttf |
| 488 | sudo ln -s /usr/share/fonts/truetype/arialbd.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf |
| 489 | sudo ln -s /usr/share/fonts/truetype/arialbi.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf |
| 490 | sudo ln -s /usr/share/fonts/truetype/ariali.ttf /usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf |
| 491 | sudo ln -s /usr/share/fonts/truetype/comic.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf |
| 492 | sudo ln -s /usr/share/fonts/truetype/comicbd.ttf /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf |
| 493 | sudo ln -s /usr/share/fonts/truetype/cour.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf |
| 494 | sudo ln -s /usr/share/fonts/truetype/courbd.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf |
| 495 | sudo ln -s /usr/share/fonts/truetype/courbi.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf |
| 496 | sudo ln -s /usr/share/fonts/truetype/couri.ttf /usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf |
| 497 | sudo ln -s /usr/share/fonts/truetype/impact.ttf /usr/share/fonts/truetype/msttcorefonts/Impact.ttf |
| 498 | sudo ln -s /usr/share/fonts/truetype/times.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf |
| 499 | sudo ln -s /usr/share/fonts/truetype/timesbd.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf |
| 500 | sudo ln -s /usr/share/fonts/truetype/timesbi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf |
| 501 | sudo ln -s /usr/share/fonts/truetype/timesi.ttf /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf |
| 502 | sudo ln -s /usr/share/fonts/truetype/verdana.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana.ttf |
| 503 | sudo ln -s /usr/share/fonts/truetype/verdanab.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf |
| 504 | sudo ln -s /usr/share/fonts/truetype/verdanai.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf |
| 505 | sudo ln -s /usr/share/fonts/truetype/verdanaz.ttf /usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf |
| 506 | ``` |
| 507 | |
| 508 | And then for the Java fonts: |
| 509 | |
| 510 | ```shell |
| 511 | sudo mkdir -p /usr/share/fonts/truetype/ttf-lucida |
| 512 | sudo find /usr/lib*/jvm/java-1.6.*-sun-*/jre/lib -iname '*.ttf' -print \ |
| 513 | -exec ln -s {} /usr/share/fonts/truetype/ttf-lucida \; |
| 514 | ``` |