andybons | 8c02a1f | 2015-09-04 17:02:32 | [diff] [blame] | 1 | # Linux-specific build instructions |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 2 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 3 | ## Common checkout instructions |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 4 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 5 | This page covers Linux-specific setup and configuration. The |
| 6 | [general checkout |
| 7 | instructions](http://dev.chromium.org/developers/how-tos/get-the-code) cover |
| 8 | installing depot tools and checking out the code via git. |
andybons | 8c02a1f | 2015-09-04 17:02:32 | [diff] [blame] | 9 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 10 | ## Overview |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 11 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 12 | Due its complexity, Chromium uses a set of custom tools to check out and build |
| 13 | rather than configure/make like most projects. You _must_ use gclient and |
| 14 | ninja, and there is no "install" step provided. |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 15 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 16 | ### System requirements |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 17 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 18 | * **64-bits**: x86 builds are not supported on Linux. |
| 19 | * **Memory**: >16GB is highly recommended. |
| 20 | * **Disk space**: Expect a full checkout and build to take nearly 100GB. |
| 21 | * **Distribution**: You should be able to build Chromium on any reasonably modern Linux |
| 22 | distribution, but there are a lot of distributions and we sometimes break |
| 23 | things on one or another. Internally, our development platform has been a |
| 24 | variant of Ubuntu 14.04 (Trusty Tahr); we expect you will have the most |
| 25 | luck on this platform. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 26 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 27 | ## Software setup |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 28 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 29 | Non-Ubuntu distributions are not officially supported for building and the |
| 30 | instructions below might be outdated. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 31 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 32 | ### Ubuntu |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 33 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 34 | Once you have checked out the code, run |
| 35 | [build/install-build-deps.sh](/build/install-build-deps.sh) The script only |
| 36 | supports current releases as listed on https://wiki.ubuntu.com/Releases. |
| 37 | This script is used to set up the canonical builders, and as such is the most |
| 38 | up to date reference for the required prerequisites. |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 39 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 40 | ### Debian |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 41 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 42 | Follow the Ubuntu instructions above. If you want to install the build-deps |
| 43 | manually, note that the original packages are for Ubuntu. Here are the Debian |
| 44 | equivalents: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 45 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 46 | * libexpat-dev -> libexpat1-dev |
| 47 | * freetype-dev -> libfreetype6-dev |
| 48 | * libbzip2-dev -> libbz2-dev |
| 49 | * libcupsys2-dev -> libcups2-dev |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 50 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 51 | Additionally, if you're building Chromium components for Android, you'll need to |
| 52 | install the package: lib32z1 |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 53 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 54 | ### openSUSE |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 55 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 56 | For openSUSE 11.0 and later, see |
| 57 | [Linux openSUSE Build Instructions](linux_open_suse_build_instructions.md). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 58 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 59 | ### Fedora |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 60 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 61 | Recent systems: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 62 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 63 | su -c 'yum install subversion pkgconfig python perl gcc-c++ bison flex \ |
| 64 | gperf nss-devel nspr-devel gtk2-devel glib2-devel freetype-devel atk-devel \ |
| 65 | pango-devel cairo-devel fontconfig-devel GConf2-devel dbus-devel \ |
| 66 | alsa-lib-devel libX11-devel expat-devel bzip2-devel dbus-glib-devel \ |
| 67 | elfutils-libelf-devel libjpeg-devel mesa-libGLU-devel libXScrnSaver-devel \ |
| 68 | libgnome-keyring-devel cups-devel libXtst-devel libXt-devel pam-devel httpd \ |
| 69 | mod_ssl php php-cli wdiff' |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 70 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 71 | The msttcorefonts packages can be obtained by following the instructions |
| 72 | present [here](http://www.fedorafaq.org/#installfonts). For the optional |
| 73 | packages: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 74 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 75 | * php-cgi is provided by the php-cli package |
| 76 | * wdiff doesn't exist in Fedora repositories, a possible alternative would be |
| 77 | dwdiff |
| 78 | * sun-java6-fonts doesn't exist in Fedora repositories, needs investigating |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 79 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 80 | ### Arch Linux |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 81 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 82 | Most of these packages are probably already installed since they're often used, |
| 83 | and the parameter --needed ensures that packages up to date are not reinstalled. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 84 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 85 | sudo pacman -S --needed python perl gcc gcc-libs bison flex gperf pkgconfig \ |
| 86 | nss alsa-lib gconf glib2 gtk2 nspr ttf-ms-fonts freetype2 cairo dbus \ |
| 87 | libgnome-keyring |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 88 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 89 | For the optional packages on Arch Linux: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 90 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 91 | * php-cgi is provided with pacman |
| 92 | * wdiff is not in the main repository but dwdiff is. You can get wdiff in |
| 93 | AUR/yaourt |
| 94 | * sun-java6-fonts do not seem to be in main repository or AUR. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 95 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 96 | ### Mandriva |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 97 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 98 | urpmi lib64fontconfig-devel lib64alsa2-devel lib64dbus-1-devel \ |
| 99 | lib64GConf2-devel lib64freetype6-devel lib64atk1.0-devel lib64gtk+2.0_0-devel \ |
| 100 | lib64pango1.0-devel lib64cairo-devel lib64nss-devel lib64nspr-devel g++ python \ |
| 101 | perl bison flex subversion gperf |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 102 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 103 | * msttcorefonts are not available, you will need to build your own (see |
| 104 | instructions, not hard to do, see |
| 105 | [mandriva_msttcorefonts.md](mandriva_msttcorefonts.md)) or use drakfont to |
| 106 | import the fonts from a windows installation |
| 107 | * These packages are for 64 bit, to download the 32 bit packages, |
| 108 | substitute lib64 with lib |
| 109 | * Some of these packages might not be explicitly necessary as they come as |
| 110 | dependencies, there is no harm in including them however. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 111 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 112 | ### Gentoo |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 113 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 114 | emerge www-client/chromium |
andybons | 8c02a1f | 2015-09-04 17:02:32 | [diff] [blame] | 115 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 116 | ## Troubleshooting |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 117 | |
| 118 | ### Linker Crashes |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 119 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 120 | If, during the final link stage: |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 121 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 122 | LINK out/Debug/chrome |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 123 | |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 124 | You get an error like: |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 125 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 126 | collect2: ld terminated with signal 6 Aborted terminate called after throwing an |
| 127 | instance of 'std::bad_alloc' |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 128 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 129 | collect2: ld terminated with signal 11 [Segmentation fault], core dumped |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 130 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 131 | you are probably running out of memory when linking. You *must* use a 64-bit |
| 132 | system to build. Try the following build settings (see [GN build |
| 133 | configuration](https://www.chromium.org/developers/gn-build-configuration) for |
| 134 | setting): |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 135 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 136 | * Build in release mode (debugging symbols require more memory). |
| 137 | `is_debug = false` |
| 138 | * Turn off symbols. `symbol_level = 0` |
| 139 | * Build in component mode (this is for developers only, it will be slower and |
| 140 | may have broken functionality). `is_component_build = true` |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 141 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 142 | ## More links |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 143 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 144 | * [Faster builds on Linux](linux_faster_builds.md) |
| 145 | * Information about [building with Clang](clang.md). |
| 146 | * You may want to |
| 147 | [use a chroot](using_a_linux_chroot.md) to |
| 148 | isolate yourself from versioning or packaging conflicts (or to run the |
| 149 | layout tests). |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 150 | * Cross-compiling for ARM? See [LinuxChromiumArm](linux_chromium_arm.md). |
| 151 | * Want to use Eclipse as your IDE? See |
| 152 | [LinuxEclipseDev](linux_eclipse_dev.md). |
| 153 | * Built version as Default Browser? See |
| 154 | [LinuxDevBuildAsDefaultBrowser](linux_dev_build_as_default_browser.md). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 155 | |
| 156 | ## Next Steps |
andybons | ad92aa3 | 2015-08-31 02:27:44 | [diff] [blame] | 157 | |
| 158 | If you want to contribute to the effort toward a Chromium-based browser for |
| 159 | Linux, please check out the [Linux Development page](linux_development.md) for |
| 160 | more information. |