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