OLD | NEW |
1 # Checking out and building Chromium on Linux | 1 # Checking out and building Chromium on Linux |
2 | 2 |
3 There are instructions for other platforms linked from the | 3 There are instructions for other platforms linked from the |
4 [get the code](get_the_code.md) page. | 4 [get the code](get_the_code.md) page. |
5 | 5 |
6 ## Instructions for Google Employees | 6 ## Instructions for Google Employees |
7 | 7 |
8 Are you a Google employee? See | 8 Are you a Google employee? See |
9 [go/building-chrome](https://goto.google.com/building-chrome) instead. | 9 [go/building-chrome](https://goto.google.com/building-chrome) instead. |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 ```shell | 70 ```shell |
71 $ cd src | 71 $ cd src |
72 ``` | 72 ``` |
73 | 73 |
74 ### Install additional build dependencies | 74 ### Install additional build dependencies |
75 | 75 |
76 Once you have checked out the code, and assuming you're using Ubuntu, run | 76 Once you have checked out the code, and assuming you're using Ubuntu, run |
77 [build/install-build-deps.sh](/build/install-build-deps.sh) | 77 [build/install-build-deps.sh](/build/install-build-deps.sh) |
78 | 78 |
79 Here are some instructions for what to do instead for | 79 You may need to adjust the build dependencies for other distros. There are |
80 | 80 some [notes](#notes) at the end of this document, but we make no guarantees |
81 * [Debian](linux_debian_build_instructions.md) | 81 for their accuracy. |
82 * [Fedora](linux_fedora_build_instructions.md) | |
83 * [Arch Linux](linux_arch_build_instructions.md) | |
84 * [Open SUSE](linux_open_suse_build_instrctions.md) | |
85 * [Mandriva](linux_mandriva_build_instrctions.md) | |
86 | |
87 For Gentoo, you can just run `emerge www-client/chromium`. | |
88 | 82 |
89 ### Run the hooks | 83 ### Run the hooks |
90 | 84 |
91 Once you've run `install-build-deps` at least once, you can now run the | 85 Once you've run `install-build-deps` at least once, you can now run the |
92 Chromium-specific hooks, which will download additional binaries and other | 86 Chromium-specific hooks, which will download additional binaries and other |
93 things you might need: | 87 things you might need: |
94 | 88 |
95 ```shell | 89 ```shell |
96 $ gclient runhooks | 90 $ gclient runhooks |
97 ``` | 91 ``` |
(...skipping 20 matching lines...) Expand all Loading... |
118 it should be a subdirectory of `out`. | 112 it should be a subdirectory of `out`. |
119 * For other build arguments, including release settings, see [GN build | 113 * For other build arguments, including release settings, see [GN build |
120 configuration](https://www.chromium.org/developers/gn-build-configuration). | 114 configuration](https://www.chromium.org/developers/gn-build-configuration). |
121 The default will be a debug component build matching the current host | 115 The default will be a debug component build matching the current host |
122 operating system and CPU. | 116 operating system and CPU. |
123 * For more info on GN, run `gn help` on the command line or read the | 117 * For more info on GN, run `gn help` on the command line or read the |
124 [quick start guide](../tools/gn/docs/quick_start.md). | 118 [quick start guide](../tools/gn/docs/quick_start.md). |
125 | 119 |
126 ### Faster builds | 120 ### Faster builds |
127 | 121 |
| 122 This section contains some things you can change to speed up your builds, |
| 123 sorted so that the things that make the biggest difference are first. |
| 124 |
| 125 #### Disable NaCl |
| 126 |
| 127 By default, the build includes support for |
| 128 [Native Client (NaCl)](https://developer.chrome.com/native-client), but |
| 129 most of the time you won't need it. You can set the GN argument |
| 130 `enable_nacl=false` and it won't be built. |
| 131 |
| 132 #### Include fewer debug symbols |
| 133 |
| 134 By default GN produces a build with all of the debug assertions enabled |
| 135 (`is_debug=true`) and including full debug info (`symbol_level=2`). Setting |
| 136 `symbol_level=1` will produce enough information for stack traces, but not |
| 137 line-by-line debugging. Setting `symbol_level=0` will include no debug |
| 138 symbols at all. Either will speed up the build compared to full symbols. |
| 139 |
128 See [faster builds on Linux](linux_faster_builds.md) for various tips and | 140 See [faster builds on Linux](linux_faster_builds.md) for various tips and |
129 settings that may speed up your build. | 141 settings that may speed up your build. |
130 | 142 |
| 143 #### Disable debug symbols for Blink |
| 144 |
| 145 Due to its extensive use of templates, the Blink code produces about half |
| 146 of our debug symbols. If you don't ever need to debug Blink, you can set |
| 147 the GN arg `remove_webcore_debug_symbols=true`. |
| 148 |
| 149 #### Use Icecc |
| 150 |
| 151 [Icecc](https://github.com/icecc/icecream) is the distributed compiler with a |
| 152 central scheduler to share build load. Currently, many external contributors use |
| 153 it. e.g. Intel, Opera, Samsung (Googlers use an internal system called Goma). |
| 154 |
| 155 In order to use `icecc`, set the following GN args: |
| 156 |
| 157 ``` |
| 158 linux_use_bundled_binutils=false |
| 159 use_debug_fission=false |
| 160 is_clang=false |
| 161 use_sysroot=false |
| 162 ``` |
| 163 |
| 164 See these links for more on the |
| 165 [bundled_binutils limitation](https://github.com/icecc/icecream/commit/b2ce5b9cc
4bd1900f55c3684214e409fa81e7a92), |
| 166 the [debug fission limitation](http://gcc.gnu.org/wiki/DebugFission). |
| 167 |
| 168 Using the system linker may also be necessary when using glibc 2.21 or newer. |
| 169 See [related bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808181). |
| 170 |
| 171 #### ccache |
| 172 |
| 173 You can use [ccache](https://ccache.samba.org) to speed up local builds (again, |
| 174 this is not useful if you're using a Googler using Goma). |
| 175 |
| 176 Increase your ccache hit rate by setting `CCACHE_BASEDIR` to a parent directory |
| 177 that the working directories all have in common (e.g., |
| 178 `/home/yourusername/development`). Consider using |
| 179 `CCACHE_SLOPPINESS=include_file_mtime` (since if you are using multiple working |
| 180 directories, header times in svn sync'ed portions of your trees will be |
| 181 different - see |
| 182 [the ccache troubleshooting section](http://ccache.samba.org/manual.html#_troubl
eshooting) |
| 183 for additional information). If you use symbolic links from your home directory |
| 184 to get to the local physical disk directory where you keep those working |
| 185 development directories, consider putting |
| 186 |
| 187 alias cd="cd -P" |
| 188 |
| 189 in your `.bashrc` so that `$PWD` or `cwd` always refers to a physical, not |
| 190 logical directory (and make sure `CCACHE_BASEDIR` also refers to a physical |
| 191 parent). |
| 192 |
| 193 If you tune ccache correctly, a second working directory that uses a branch |
| 194 tracking trunk and is up to date with trunk and was gclient sync'ed at about the |
| 195 same time should build chrome in about 1/3 the time, and the cache misses as |
| 196 reported by `ccache -s` should barely increase. |
| 197 |
| 198 This is especially useful if you use `git-new-workdir` and keep multiple local |
| 199 working directories going at once. |
| 200 |
| 201 #### Using tmpfs |
| 202 |
| 203 You can use tmpfs for the build output to reduce the amount of disk writes |
| 204 required. I.e. mount tmpfs to the output directory where the build output goes: |
| 205 |
| 206 As root: |
| 207 |
| 208 mount -t tmpfs -o size=20G,nr_inodes=40k,mode=1777 tmpfs /path/to/out |
| 209 |
| 210 *** note |
| 211 **Caveat:** You need to have enough RAM + swap to back the tmpfs. For a full |
| 212 debug build, you will need about 20 GB. Less for just building the chrome target |
| 213 or for a release build. |
| 214 *** |
| 215 |
| 216 Quick and dirty benchmark numbers on a HP Z600 (Intel core i7, 16 cores |
| 217 hyperthreaded, 12 GB RAM) |
| 218 |
| 219 * With tmpfs: |
| 220 * 12m:20s |
| 221 * Without tmpfs |
| 222 * 15m:40s |
| 223 |
131 ## Build Chromium | 224 ## Build Chromium |
132 | 225 |
133 Build Chromium (the "chrome" target) with Ninja using the command: | 226 Build Chromium (the "chrome" target) with Ninja using the command: |
134 | 227 |
135 ```shell | 228 ```shell |
136 $ ninja -C out/Default chrome | 229 $ ninja -C out/Default chrome |
137 ``` | 230 ``` |
138 | 231 |
139 You can get a list of all of the other build targets from GN by running `gn ls | 232 You can get a list of all of the other build targets from GN by running `gn ls |
140 out/Default` from the command line. To compile one, pass the GN label to Ninja | 233 out/Default` from the command line. To compile one, pass the GN label to Ninja |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 303 |
211 * Information about [building with Clang](clang.md). | 304 * Information about [building with Clang](clang.md). |
212 * You may want to [use a chroot](using_a_linux_chroot.md) to | 305 * You may want to [use a chroot](using_a_linux_chroot.md) to |
213 isolate yourself from versioning or packaging conflicts. | 306 isolate yourself from versioning or packaging conflicts. |
214 * Cross-compiling for ARM? See [LinuxChromiumArm](linux_chromium_arm.md). | 307 * Cross-compiling for ARM? See [LinuxChromiumArm](linux_chromium_arm.md). |
215 * Want to use Eclipse as your IDE? See | 308 * Want to use Eclipse as your IDE? See |
216 [LinuxEclipseDev](linux_eclipse_dev.md). | 309 [LinuxEclipseDev](linux_eclipse_dev.md). |
217 * Want to use your built version as your default browser? See | 310 * Want to use your built version as your default browser? See |
218 [LinuxDevBuildAsDefaultBrowser](linux_dev_build_as_default_browser.md). | 311 [LinuxDevBuildAsDefaultBrowser](linux_dev_build_as_default_browser.md). |
219 | 312 |
220 ### Next Steps | 313 ## Next Steps |
221 | 314 |
222 If you want to contribute to the effort toward a Chromium-based browser for | 315 If you want to contribute to the effort toward a Chromium-based browser for |
223 Linux, please check out the [Linux Development page](linux_development.md) for | 316 Linux, please check out the [Linux Development page](linux_development.md) for |
224 more information. | 317 more information. |
| 318 |
| 319 ## Notes for other distros <a name="notes"></a> |
| 320 |
| 321 ### Arch Linux |
| 322 |
| 323 Instead of running `install-build-deps.sh` to install build dependencies, run: |
| 324 |
| 325 ```shell |
| 326 $ sudo pacman -S --needed python perl gcc gcc-libs bison flex gperf pkgconfig \ |
| 327 nss alsa-lib gconf glib2 gtk2 nspr ttf-ms-fonts freetype2 cairo dbus \ |
| 328 libgnome-keyring |
| 329 ``` |
| 330 |
| 331 For the optional packages on Arch Linux: |
| 332 |
| 333 * `php-cgi` is provided with `pacman` |
| 334 * `wdiff` is not in the main repository but `dwdiff` is. You can get `wdiff` |
| 335 in AUR/`yaourt` |
| 336 * `sun-java6-fonts` do not seem to be in main repository or AUR. |
| 337 |
| 338 ### Debian |
| 339 |
| 340 `build/install-build-deps.sh` doesn't currently run on Debian, but you can |
| 341 probably hack it to get it to work. You will probably need to update the |
| 342 following package names: |
| 343 |
| 344 * `libexpat-dev` → `libexpat1-dev` |
| 345 * `freetype-dev` → `libfreetype6-dev` |
| 346 * `libbzip2-dev` → `libbz2-dev` |
| 347 * `libcupsys2-dev` → `libcups2-dev` |
| 348 |
| 349 ### Fedora |
| 350 |
| 351 Instead of running `build/install-build-deps.sh`, run: |
| 352 |
| 353 ```shell |
| 354 su -c 'yum install git python bzip2 tar pkgconfig atk-devel alsa-lib-devel \ |
| 355 bison binutils brlapi-devel bluez-libs-devel bzip2-devel cairo-devel \ |
| 356 cups-devel dbus-devel dbus-glib-devel expat-devel fontconfig-devel \ |
| 357 freetype-devel gcc-c++ GConf2-devel glib2-devel glibc.i686 gperf \ |
| 358 glib2-devel gtk2-devel gtk3-devel java-1.*.0-openjdk-devel libatomic \ |
| 359 libcap-devel libffi-devel libgcc.i686 libgnome-keyring-devel libjpeg-devel \ |
| 360 libstdc++.i686 libX11-devel libXScrnSaver-devel libXtst-devel \ |
| 361 libxkbcommon-x11-devel ncurses-compat-libs nspr-devel nss-devel pam-devel \ |
| 362 pango-devel pciutils-devel pulseaudio-libs-devel zlib.i686 httpd mod_ssl \ |
| 363 php php-cli python-psutil wdiff' |
| 364 ``` |
| 365 |
| 366 The `msttcorefonts` packages can be obtained by following [these |
| 367 instructions](http://www.fedorafaq.org/#installfonts). For the optional |
| 368 packages: |
| 369 |
| 370 * `php-cgi` is provided by the `php-cli` package. |
| 371 * `sun-java6-fonts` doesn't exist in Fedora repositories, needs investigating. |
| 372 |
| 373 ### Gentoo |
| 374 |
| 375 You can just run `emerge www-client/chromium`. |
| 376 |
| 377 ### Mandriva |
| 378 |
| 379 Instead of running `build/install-build-deps.sh`, run: |
| 380 |
| 381 ```shell |
| 382 urpmi lib64fontconfig-devel lib64alsa2-devel lib64dbus-1-devel \ |
| 383 lib64GConf2-devel lib64freetype6-devel lib64atk1.0-devel lib64gtk+2.0_0-devel \ |
| 384 lib64pango1.0-devel lib64cairo-devel lib64nss-devel lib64nspr-devel g++ python \ |
| 385 perl bison flex subversion gperf |
| 386 ``` |
| 387 |
| 388 * `msttcorefonts` are not available, you will need to build your own (see |
| 389 instructions, not hard to do, see |
| 390 [mandriva_msttcorefonts.md](mandriva_msttcorefonts.md)) or use `drakfont` to |
| 391 import the fonts from a Windows installation. |
| 392 |
| 393 ### OpenSUSE |
| 394 |
| 395 Use `zypper` command to install dependencies: |
| 396 |
| 397 (openSUSE 11.1 and higher) |
| 398 |
| 399 ```shell |
| 400 sudo zypper in subversion pkg-config python perl \ |
| 401 bison flex gperf mozilla-nss-devel glib2-devel gtk-devel \ |
| 402 wdiff lighttpd gcc gcc-c++ gconf2-devel mozilla-nspr \ |
| 403 mozilla-nspr-devel php5-fastcgi alsa-devel libexpat-devel \ |
| 404 libjpeg-devel libbz2-devel |
| 405 ``` |
| 406 |
| 407 For 11.0, use `libnspr4-0d` and `libnspr4-dev` instead of `mozilla-nspr` and |
| 408 `mozilla-nspr-devel`, and use `php5-cgi` instead of `php5-fastcgi`. And need |
| 409 `gtk2-devel`. |
| 410 |
| 411 (openSUSE 11.0) |
| 412 |
| 413 ```shell |
| 414 sudo zypper in subversion pkg-config python perl \ |
| 415 bison flex gperf mozilla-nss-devel glib2-devel gtk-devel \ |
| 416 libnspr4-0d libnspr4-dev wdiff lighttpd gcc gcc-c++ libexpat-devel \ |
| 417 php5-cgi gconf2-devel alsa-devel gtk2-devel jpeg-devel |
| 418 ``` |
| 419 |
| 420 The Ubuntu package `sun-java6-fonts` contains a subset of Java of the fonts used
. |
| 421 Since this package requires Java as a prerequisite anyway, we can do the same |
| 422 thing by just installing the equivalent openSUSE Sun Java package: |
| 423 |
| 424 ```shell |
| 425 sudo zypper in java-1_6_0-sun |
| 426 ``` |
| 427 |
| 428 WebKit is currently hard-linked to the Microsoft fonts. To install these using `
zypper` |
| 429 |
| 430 ```shell |
| 431 sudo zypper in fetchmsttfonts pullin-msttf-fonts |
| 432 ``` |
| 433 |
| 434 To make the fonts installed above work, as the paths are hardcoded for Ubuntu, |
| 435 create symlinks to the appropriate locations: |
| 436 |
| 437 ```shell |
| 438 sudo mkdir -p /usr/share/fonts/truetype/msttcorefonts |
| 439 sudo ln -s /usr/share/fonts/truetype/arial.ttf /usr/share/fonts/truetype/msttcor
efonts/Arial.ttf |
| 440 sudo ln -s /usr/share/fonts/truetype/arialbd.ttf /usr/share/fonts/truetype/msttc
orefonts/Arial_Bold.ttf |
| 441 sudo ln -s /usr/share/fonts/truetype/arialbi.ttf /usr/share/fonts/truetype/msttc
orefonts/Arial_Bold_Italic.ttf |
| 442 sudo ln -s /usr/share/fonts/truetype/ariali.ttf /usr/share/fonts/truetype/msttco
refonts/Arial_Italic.ttf |
| 443 sudo ln -s /usr/share/fonts/truetype/comic.ttf /usr/share/fonts/truetype/msttcor
efonts/Comic_Sans_MS.ttf |
| 444 sudo ln -s /usr/share/fonts/truetype/comicbd.ttf /usr/share/fonts/truetype/msttc
orefonts/Comic_Sans_MS_Bold.ttf |
| 445 sudo ln -s /usr/share/fonts/truetype/cour.ttf /usr/share/fonts/truetype/msttcore
fonts/Courier_New.ttf |
| 446 sudo ln -s /usr/share/fonts/truetype/courbd.ttf /usr/share/fonts/truetype/msttco
refonts/Courier_New_Bold.ttf |
| 447 sudo ln -s /usr/share/fonts/truetype/courbi.ttf /usr/share/fonts/truetype/msttco
refonts/Courier_New_Bold_Italic.ttf |
| 448 sudo ln -s /usr/share/fonts/truetype/couri.ttf /usr/share/fonts/truetype/msttcor
efonts/Courier_New_Italic.ttf |
| 449 sudo ln -s /usr/share/fonts/truetype/impact.ttf /usr/share/fonts/truetype/msttco
refonts/Impact.ttf |
| 450 sudo ln -s /usr/share/fonts/truetype/times.ttf /usr/share/fonts/truetype/msttcor
efonts/Times_New_Roman.ttf |
| 451 sudo ln -s /usr/share/fonts/truetype/timesbd.ttf /usr/share/fonts/truetype/msttc
orefonts/Times_New_Roman_Bold.ttf |
| 452 sudo ln -s /usr/share/fonts/truetype/timesbi.ttf /usr/share/fonts/truetype/msttc
orefonts/Times_New_Roman_Bold_Italic.ttf |
| 453 sudo ln -s /usr/share/fonts/truetype/timesi.ttf /usr/share/fonts/truetype/msttco
refonts/Times_New_Roman_Italic.ttf |
| 454 sudo ln -s /usr/share/fonts/truetype/verdana.ttf /usr/share/fonts/truetype/msttc
orefonts/Verdana.ttf |
| 455 sudo ln -s /usr/share/fonts/truetype/verdanab.ttf /usr/share/fonts/truetype/mstt
corefonts/Verdana_Bold.ttf |
| 456 sudo ln -s /usr/share/fonts/truetype/verdanai.ttf /usr/share/fonts/truetype/mstt
corefonts/Verdana_Italic.ttf |
| 457 sudo ln -s /usr/share/fonts/truetype/verdanaz.ttf /usr/share/fonts/truetype/mstt
corefonts/Verdana_Bold_Italic.ttf |
| 458 ``` |
| 459 |
| 460 The Ubuntu package `sun-java6-fonts` contains a subset of Java of the fonts used
. |
| 461 Since this package requires Java as a prerequisite anyway, we can do the same |
| 462 thing by just installing the equivalent openSUSE Sun Java package: |
| 463 |
| 464 ```shell |
| 465 sudo zypper in java-1_6_0-sun |
| 466 ``` |
| 467 |
| 468 WebKit is currently hard-linked to the Microsoft fonts. To install these using `
zypper` |
| 469 |
| 470 ```shell |
| 471 sudo zypper in fetchmsttfonts pullin-msttf-fonts |
| 472 ``` |
| 473 |
| 474 To make the fonts installed above work, as the paths are hardcoded for Ubuntu, |
| 475 create symlinks to the appropriate locations: |
| 476 |
| 477 ```shell |
| 478 sudo mkdir -p /usr/share/fonts/truetype/msttcorefonts |
| 479 sudo ln -s /usr/share/fonts/truetype/arial.ttf /usr/share/fonts/truetype/msttcor
efonts/Arial.ttf |
| 480 sudo ln -s /usr/share/fonts/truetype/arialbd.ttf /usr/share/fonts/truetype/msttc
orefonts/Arial_Bold.ttf |
| 481 sudo ln -s /usr/share/fonts/truetype/arialbi.ttf /usr/share/fonts/truetype/msttc
orefonts/Arial_Bold_Italic.ttf |
| 482 sudo ln -s /usr/share/fonts/truetype/ariali.ttf /usr/share/fonts/truetype/msttco
refonts/Arial_Italic.ttf |
| 483 sudo ln -s /usr/share/fonts/truetype/comic.ttf /usr/share/fonts/truetype/msttcor
efonts/Comic_Sans_MS.ttf |
| 484 sudo ln -s /usr/share/fonts/truetype/comicbd.ttf /usr/share/fonts/truetype/msttc
orefonts/Comic_Sans_MS_Bold.ttf |
| 485 sudo ln -s /usr/share/fonts/truetype/cour.ttf /usr/share/fonts/truetype/msttcore
fonts/Courier_New.ttf |
| 486 sudo ln -s /usr/share/fonts/truetype/courbd.ttf /usr/share/fonts/truetype/msttco
refonts/Courier_New_Bold.ttf |
| 487 sudo ln -s /usr/share/fonts/truetype/courbi.ttf /usr/share/fonts/truetype/msttco
refonts/Courier_New_Bold_Italic.ttf |
| 488 sudo ln -s /usr/share/fonts/truetype/couri.ttf /usr/share/fonts/truetype/msttcor
efonts/Courier_New_Italic.ttf |
| 489 sudo ln -s /usr/share/fonts/truetype/impact.ttf /usr/share/fonts/truetype/msttco
refonts/Impact.ttf |
| 490 sudo ln -s /usr/share/fonts/truetype/times.ttf /usr/share/fonts/truetype/msttcor
efonts/Times_New_Roman.ttf |
| 491 sudo ln -s /usr/share/fonts/truetype/timesbd.ttf /usr/share/fonts/truetype/msttc
orefonts/Times_New_Roman_Bold.ttf |
| 492 sudo ln -s /usr/share/fonts/truetype/timesbi.ttf /usr/share/fonts/truetype/msttc
orefonts/Times_New_Roman_Bold_Italic.ttf |
| 493 sudo ln -s /usr/share/fonts/truetype/timesi.ttf /usr/share/fonts/truetype/msttco
refonts/Times_New_Roman_Italic.ttf |
| 494 sudo ln -s /usr/share/fonts/truetype/verdana.ttf /usr/share/fonts/truetype/msttc
orefonts/Verdana.ttf |
| 495 sudo ln -s /usr/share/fonts/truetype/verdanab.ttf /usr/share/fonts/truetype/mstt
corefonts/Verdana_Bold.ttf |
| 496 sudo ln -s /usr/share/fonts/truetype/verdanai.ttf /usr/share/fonts/truetype/mstt
corefonts/Verdana_Italic.ttf |
| 497 sudo ln -s /usr/share/fonts/truetype/verdanaz.ttf /usr/share/fonts/truetype/mstt
corefonts/Verdana_Bold_Italic.ttf |
| 498 ``` |
| 499 |
| 500 And then for the Java fonts: |
| 501 |
| 502 ```shell |
| 503 sudo mkdir -p /usr/share/fonts/truetype/ttf-lucida |
| 504 sudo find /usr/lib*/jvm/java-1.6.*-sun-*/jre/lib -iname '*.ttf' -print \ |
| 505 -exec ln -s {} /usr/share/fonts/truetype/ttf-lucida \; |
| 506 ``` |
OLD | NEW |