Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: docs/linux_build_instructions.md

Issue 2526563003: Update the build instructions to be consistent. (Closed)
Patch Set: more updates Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Linux-specific build instructions 1 # Checking out and building Chromium on Linux
2 2
3 ## Common checkout instructions 3 **See also [the old version of this page](old_linux_build_instructions.md).**
4 4
5 This page covers Linux-specific setup and configuration. The 5 Google employee? See [go/building-chrome](https://goto.google.com/building-chrom e) instead.
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.
9 6
10 ## Overview 7 [TOC]
11 8
12 Due its complexity, Chromium uses a set of custom tools to check out and build 9 ## System requirements
13 rather than configure/make like most projects. You _must_ use gclient and
14 ninja, and there is no "install" step provided.
15 10
16 ### System requirements 11 * A 64-bit Intel machine with at least 8GB of RAM. More than 16GB is highly
12 recommended.
13 * At least 100GB of free disk space.
14 * You must have Git and Python installed already.
17 15
18 * **64-bits**: x86 builds are not supported on Linux. 16 Most development is done on Ubuntu (currently 14.04, Trusty Tahr). There are
19 * **Memory**: >16GB is highly recommended. 17 some instructions for other distros below, but they are mostly unsupported.
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 mod ern 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.
26 18
27 ## Software setup 19 ## Install `depot_tools`
28 20
29 Non-Ubuntu distributions are not officially supported for building and the 21 Clone the depot_tools repository:
30 instructions below might be outdated.
31 22
32 ### Ubuntu 23 $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
33 24
34 Once you have checked out the code, run 25 Add depot_tools to the end of your PATH (you will probably want to put this
35 [build/install-build-deps.sh](/build/install-build-deps.sh) The script only 26 in your ~/.bashrc or ~/.zshrc). Assuming you cloned depot_tools
36 supports current releases as listed on https://wiki.ubuntu.com/Releases. 27 to /path/to/depot_tools:
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.
39 28
40 ### Debian 29 $ export PATH=$PATH:/path/to/depot_tools
41 30
42 Follow the Ubuntu instructions above. If you want to install the build-deps 31 ## Get the code
43 manually, note that the original packages are for Ubuntu. Here are the Debian
44 equivalents:
45 32
46 * libexpat-dev -> libexpat1-dev 33 Create a chromium directory for the checkout and change to it (you can call
47 * freetype-dev -> libfreetype6-dev 34 this whatever you like and put it wherever you like, as
48 * libbzip2-dev -> libbz2-dev 35 long as the full path has no spaces):
49 * libcupsys2-dev -> libcups2-dev 36
37 $ mkdir chromium
38 $ cd chromium
50 39
51 Additionally, if you're building Chromium components for Android, you'll need to 40 Run the `fetch` tool from depot_tools to check out the code and its
52 install the package: lib32z1 41 dependencies.
53 42
54 ### openSUSE 43 $ fetch --nohooks chromium
55 44
56 For openSUSE 11.0 and later, see 45 If you don't want the full repo history, you can save a lot of time by
57 [Linux openSUSE Build Instructions](linux_open_suse_build_instructions.md). 46 adding the `--no-history` flag to fetch.
58 47
59 ### Fedora 48 Expect the command to take 30 minutes on even a fast connection, and many
49 hours on slower ones.
60 50
61 Recent systems: 51 If you've already installed the build dependencies on the machine (from another
52 checkout, for example), you can omit the `--nohooks` flag and fetch
53 will automatically execute `gclient runhooks` at the end.
62 54
63 su -c 'yum install git python bzip2 tar pkgconfig atk-devel alsa-lib-devel \ 55 When fetch completes, it will have created a directory called `src`.
64 bison binutils brlapi-devel bluez-libs-devel bzip2-devel cairo-devel \ 56 The remaining instructions assume you are now in that directory:
65 cups-devel dbus-devel dbus-glib-devel expat-devel fontconfig-devel \
66 freetype-devel gcc-c++ GConf2-devel glib2-devel glibc.i686 gperf \
67 glib2-devel gtk2-devel gtk3-devel java-1.*.0-openjdk-devel libatomic \
68 libcap-devel libffi-devel libgcc.i686 libgnome-keyring-devel libjpeg-devel \
69 libstdc++.i686 libX11-devel libXScrnSaver-devel libXtst-devel \
70 libxkbcommon-x11-devel ncurses-compat-libs nspr-devel nss-devel pam-devel \
71 pango-devel pciutils-devel pulseaudio-libs-devel zlib.i686 httpd mod_ssl \
72 php php-cli python-psutil wdiff'
73 57
74 The msttcorefonts packages can be obtained by following the instructions 58 $ cd src
75 present [here](http://www.fedorafaq.org/#installfonts). For the optional
76 packages:
77 59
78 * php-cgi is provided by the php-cli package 60 ### Install additional build dependencies
79 * sun-java6-fonts doesn't exist in Fedora repositories, needs investigating
80 61
81 ### Arch Linux 62 Once you have checked out the code, and assuming you're using Ubuntu, run
63 [build/install-build-deps.sh](/build/install-build-deps.sh)
82 64
83 Most of these packages are probably already installed since they're often used, 65 Here are some instructions for what to do instead for
84 and the parameter --needed ensures that packages up to date are not reinstalled.
85 66
86 sudo pacman -S --needed python perl gcc gcc-libs bison flex gperf pkgconfig \ 67 * [Debian](linux_debian_build_instructions.md)
87 nss alsa-lib gconf glib2 gtk2 nspr ttf-ms-fonts freetype2 cairo dbus \ 68 * [Fedora](linux_fedora_build_instructions.md)
88 libgnome-keyring 69 * [Arch Linux](linux_arch_build_instructions.md)
70 * [Open SUSE](linux_open_suse_build_instrctions.md)
71 * [Mandriva](linux_mandriva_build_instrctions.md)
89 72
90 For the optional packages on Arch Linux: 73 For Gentoo, you can just run `emerge www-client/chromium`.
91 74
92 * php-cgi is provided with pacman 75 ### Run the hooks
93 * wdiff is not in the main repository but dwdiff is. You can get wdiff in
94 AUR/yaourt
95 * sun-java6-fonts do not seem to be in main repository or AUR.
96 76
97 ### Mandriva 77 Once you've run `install-build-deps` at least once, you can now run the
78 chromium-specific hooks, which will download additional binaries and other
79 things you might need:
98 80
99 urpmi lib64fontconfig-devel lib64alsa2-devel lib64dbus-1-devel \ 81 $ gclient runhooks
100 lib64GConf2-devel lib64freetype6-devel lib64atk1.0-devel lib64gtk+2.0_0-deve l \
101 lib64pango1.0-devel lib64cairo-devel lib64nss-devel lib64nspr-devel g++ pyth on \
102 perl bison flex subversion gperf
103 82
104 * msttcorefonts are not available, you will need to build your own (see 83 *Optional*: You can also [install API keys](https://www.chromium.org/developers/ how-tos/api-keys)
105 instructions, not hard to do, see 84 if you want to talk to some of the Google services, but this is not necessary
106 [mandriva_msttcorefonts.md](mandriva_msttcorefonts.md)) or use drakfont to 85 for most development and testing purposes.
107 import the fonts from a windows installation
108 * These packages are for 64 bit, to download the 32 bit packages,
109 substitute lib64 with lib
110 * Some of these packages might not be explicitly necessary as they come as
111 dependencies, there is no harm in including them however.
112 86
113 ### Gentoo 87 ## Seting up the Build
114 88
115 emerge www-client/chromium 89 Chromium uses [Ninja](https://ninja-build.org) as its main build tool, and
90 a tool called [GN](../tools/gn/docs/quick_start.md) to generate
91 the .ninja files to do the build. To create a build directory, run:
116 92
117 ## Troubleshooting 93 $ gn gen out/Default
94
95 * You only have to do run this command once, it will self-update the build
96 files as needed after that.
97 * You can replace `out/Default` with another directory name, but we recommend
98 it should still be a subdirectory of `out`.
99 * To specify build parameters for GN builds, including release settings,
100 see [GN build configuration](https://www.chromium.org/developers/gn-build-conf iguration).
101 The default will be a debug component build matching the current host
102 operating system and CPU.
103 * For more info on GN, run `gn help` on the command line or read the
104 [quick start guide](../tools/gn/docs/quick_start.md).
105
106 ### Faster builds
107
108 See [faster builds on Linux](linux_faster_builds.md) for various tips and
109 settings that may speed up your build.
110
111 ## Build Chromium
112
113 Build Chromium (the "chrome" target) with Ninja using the command:
114
115 $ ninja -C out/Default chrome
116
117 You can get a list of all of the other build targets from GN by running
118 `gn ls out/Default` from the command line. To compile one, pass to Ninja
119 the GN label with no preceding "//" (so for `//chrome/test:unit_tests`
120 use ninja -C out/Default chrome/test:unit_tests`).
121
122 ## Run Chromium
123
124 Once it is built, you can simply run the browser:
125
126 $ out/Default/chrome
127
128 ## Running test targets
129
130 You can run the tests in the same way. You can also limit which tests are
131 run using the `--gtest_filter` arg, e.g.:
132
133 $ ninja -C out/Default unit_tests --gtest_filter="PushClientTest.*"
134
135 You can find out more about GoogleTest at its
136 [GitHub page](https://github.com/google/googletest).
137
138 ## Update your checkout
139
140 To update an existing checkout, you can run
141
142 $ git rebase-update
143 $ gclient sync
144
145 The first command updates the primary Chromium source repository and rebases
146 any of your local branches on top of tip-of-tree (aka the Git branch `origin/mas ter`).
147 If you don't want to use this script, you can also just use `git pull` or
148 other common Git commands to update the repo.
149
150 The second command syncs the subrepositories to the appropriate versions and
151 re-runs the hooks as needed.
152
153 ## Tips, tricks, and troubleshooting
118 154
119 ### Linker Crashes 155 ### Linker Crashes
120 156
121 If, during the final link stage: 157 If, during the final link stage:
122 158
123 LINK out/Debug/chrome 159 LINK out/Debug/chrome
124 160
125 You get an error like: 161 You get an error like:
126 162
127 collect2: ld terminated with signal 6 Aborted terminate called after throwin g an 163 collect2: ld terminated with signal 6 Aborted terminate called after throwin g an
128 instance of 'std::bad_alloc' 164 instance of 'std::bad_alloc'
129 165
130 collect2: ld terminated with signal 11 [Segmentation fault], core dumped 166 collect2: ld terminated with signal 11 [Segmentation fault], core dumped
131 167
132 you are probably running out of memory when linking. You *must* use a 64-bit 168 you are probably running out of memory when linking. You *must* use a 64-bit
133 system to build. Try the following build settings (see [GN build 169 system to build. Try the following build settings (see [GN build
134 configuration](https://www.chromium.org/developers/gn-build-configuration) for 170 configuration](https://www.chromium.org/developers/gn-build-configuration) for
135 setting): 171 setting):
136 172
137 * Build in release mode (debugging symbols require more memory). 173 * Build in release mode (debugging symbols require more memory).
138 `is_debug = false` 174 `is_debug = false`
139 * Turn off symbols. `symbol_level = 0` 175 * Turn off symbols. `symbol_level = 0`
140 * Build in component mode (this is for developers only, it will be slower and 176 * Build in component mode (this is for developers only, it will be slower and
141 may have broken functionality). `is_component_build = true` 177 may have broken functionality). `is_component_build = true`
142 178
143 ## More links 179 ### More links
144 180
145 * [Faster builds on Linux](linux_faster_builds.md)
146 * Information about [building with Clang](clang.md). 181 * Information about [building with Clang](clang.md).
147 * You may want to 182 * You may want to [use a chroot](using_a_linux_chroot.md) to
148 [use a chroot](using_a_linux_chroot.md) to 183 isolate yourself from versioning or packaging conflicts.
149 isolate yourself from versioning or packaging conflicts (or to run the
150 layout tests).
151 * Cross-compiling for ARM? See [LinuxChromiumArm](linux_chromium_arm.md). 184 * Cross-compiling for ARM? See [LinuxChromiumArm](linux_chromium_arm.md).
152 * Want to use Eclipse as your IDE? See 185 * Want to use Eclipse as your IDE? See
153 [LinuxEclipseDev](linux_eclipse_dev.md). 186 [LinuxEclipseDev](linux_eclipse_dev.md).
154 * Built version as Default Browser? See 187 * Want to use your built version as your default browser? See
155 [LinuxDevBuildAsDefaultBrowser](linux_dev_build_as_default_browser.md). 188 [LinuxDevBuildAsDefaultBrowser](linux_dev_build_as_default_browser.md).
156 189
157 ## Next Steps 190 ### Next Steps
158 191
159 If you want to contribute to the effort toward a Chromium-based browser for 192 If you want to contribute to the effort toward a Chromium-based browser for
160 Linux, please check out the [Linux Development page](linux_development.md) for 193 Linux, please check out the [Linux Development page](linux_development.md) for
161 more information. 194 more information.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698