OLD | NEW |
1 # Linux-specific build instructions | 1 # Linux-specific build instructions |
2 | 2 |
3 [TOC] | 3 ## Common checkout instructions |
4 | 4 |
5 ## Get the code | 5 This page covers Linux-specific setup and configuration. The |
6 | 6 [general checkout |
7 [Get the Code](https://www.chromium.org/developers/how-tos/get-the-code). The | 7 instructions](http://dev.chromium.org/developers/how-tos/get-the-code) cover |
8 general instructions on the "Get the code" page cover basic Linux build setup | 8 installing depot tools and checking out the code via git. |
9 and configuration. | |
10 | |
11 This page documents some additional Linux-specific build issues. | |
12 | 9 |
13 ## Overview | 10 ## Overview |
14 | 11 |
15 Due its complexity, Chromium uses a set of custom tools to check out and build. | 12 Due its complexity, Chromium uses a set of custom tools to check out and build |
16 Here's an overview of the steps you'll run: | 13 rather than configure/make like most projects. You _must_ use gclient and |
| 14 ninja, and there is no "install" step provided. |
17 | 15 |
18 1. **gclient**. A checkout involves pulling nearly 100 different SVN | 16 ### System requirements |
19 repositories of code. This process is managed with a tool called `gclient`. | |
20 1. **GN**. Cross-platform build configuration system. It generates ninja | |
21 build files. Running `gn` is analogous to the `./configure` step seen in | |
22 most other software. | |
23 1. **ninja**. The actual build itself uses `ninja`. A prebuilt binary is in | |
24 `depot_tools` and should already be in your path if you followed the steps | |
25 to check out Chromium. | |
26 1. We don't provide any sort of "install" step. | |
27 1. You may want to | |
28 [use a chroot](using_a_linux_chroot.md) to | |
29 isolate yourself from versioning or packaging conflicts (or to run the | |
30 layout tests). | |
31 | 17 |
32 ## Getting a checkout | 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 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. |
33 | 26 |
34 [Prerequisites](linux_build_instructions_prerequisites.md): what you need before | 27 ## Software setup |
35 you build. | |
36 | 28 |
37 **Note**. If you are working on Chromium OS and already have sources in | 29 Non-Ubuntu distributions are not officially supported for building and the |
38 `chromiumos/chromium`, you **must** run `chrome_set_ver --runhooks` to set the | 30 instructions below might be outdated. |
39 correct dependencies. This step is otherwise performed by `gclient` as part of | |
40 your checkout. | |
41 | 31 |
42 ## Compilation | 32 ### Ubuntu |
43 | 33 |
44 The "`src/`" directory is an artifact of `gclient`. Start with: | 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. |
45 | 39 |
46 $ cd src | 40 ### Debian |
47 | 41 |
48 ### Faster builds | 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: |
49 | 45 |
50 See [Linux Faster Builds](linux_faster_builds.md) | 46 * libexpat-dev -> libexpat1-dev |
| 47 * freetype-dev -> libfreetype6-dev |
| 48 * libbzip2-dev -> libbz2-dev |
| 49 * libcupsys2-dev -> libcups2-dev |
51 | 50 |
52 ### Build every test | 51 Additionally, if you're building Chromium components for Android, you'll need to |
| 52 install the package: lib32z1 |
53 | 53 |
54 $ ninja -C out/Debug | 54 ### openSUSE |
55 | 55 |
56 The above builds all libraries and tests in all components. **It will take | 56 For openSUSE 11.0 and later, see |
57 hours.** | 57 [Linux openSUSE Build Instructions](linux_open_suse_build_instructions.md). |
58 | 58 |
59 Specifying other target names to restrict the build to just what you're | 59 ### Fedora |
60 interested in. To build just the simplest unit test: | |
61 | 60 |
62 $ ninja -C out/Debug base_unittests | 61 Recent systems: |
63 | 62 |
64 ### Clang builds | 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' |
65 | 70 |
66 Information about building with Clang can be found [here](clang.md). | 71 The msttcorefonts packages can be obtained by following the instructions |
| 72 present [here](http://www.fedorafaq.org/#installfonts). For the optional |
| 73 packages: |
67 | 74 |
68 ### Output | 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 |
69 | 79 |
70 Executables are written in `src/out/Debug/` for Debug builds, and | 80 ### Arch Linux |
71 `src/out/Release/` for Release builds. | |
72 | 81 |
73 ### Release mode | 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. |
74 | 84 |
75 Pass `-C out/Release` to the ninja invocation: | 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 |
76 | 88 |
77 $ ninja -C out/Release chrome | 89 For the optional packages on Arch Linux: |
78 | 90 |
79 ### Seeing the commands | 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. |
80 | 95 |
81 If you want to see the actual commands that ninja is invoking, add `-v` to the | 96 ### Mandriva |
82 ninja invocation. | |
83 | 97 |
84 $ ninja -v -C out/Debug chrome | 98 urpmi lib64fontconfig-devel lib64alsa2-devel lib64dbus-1-devel \ |
| 99 lib64GConf2-devel lib64freetype6-devel lib64atk1.0-devel lib64gtk+2.0_0-deve
l \ |
| 100 lib64pango1.0-devel lib64cairo-devel lib64nss-devel lib64nspr-devel g++ pyth
on \ |
| 101 perl bison flex subversion gperf |
85 | 102 |
86 This is useful if, for example, you are debugging gyp changes, or otherwise need | 103 * msttcorefonts are not available, you will need to build your own (see |
87 to see what ninja is actually doing. | 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. |
88 | 111 |
89 ### Clean builds | 112 ### Gentoo |
90 | 113 |
91 You can clean the build directory (`out/Default` in this example): | 114 emerge www-client/chromium |
92 | 115 |
93 gn clean out/Default | 116 ## Troubleshooting |
94 | |
95 This will delete all files except a bootstrap ninja file necessary for | |
96 recreating the build. | |
97 | |
98 Ninja can also be used to clean a build with `ninja -C out/Debug -t clean` but | |
99 this will not be as complete as the above methods. | |
100 | 117 |
101 ### Linker Crashes | 118 ### Linker Crashes |
102 | 119 |
103 If, during the final link stage: | 120 If, during the final link stage: |
104 | 121 |
105 LINK(target) out/Debug/chrome | 122 LINK out/Debug/chrome |
106 | 123 |
107 You get an error like: | 124 You get an error like: |
108 | 125 |
109 ``` | 126 collect2: ld terminated with signal 6 Aborted terminate called after throwin
g an |
110 collect2: ld terminated with signal 6 Aborted terminate called after throwing an | 127 instance of 'std::bad_alloc' |
111 instance of 'std::bad_alloc' | |
112 | 128 |
113 collect2: ld terminated with signal 11 [Segmentation fault], core dumped | 129 collect2: ld terminated with signal 11 [Segmentation fault], core dumped |
114 ``` | |
115 you are probably running out of memory when linking. Try one of: | |
116 | 130 |
117 1. Use the `gold` linker | 131 you are probably running out of memory when linking. You *must* use a 64-bit |
118 1. Build on a 64-bit computer | 132 system to build. Try the following build settings (see [GN build |
119 1. Build in Release mode (debugging symbols require a lot of memory) | 133 configuration](https://www.chromium.org/developers/gn-build-configuration) for |
120 1. Build as shared libraries (note: this build is for developers only, and may | 134 setting): |
121 have broken functionality) | |
122 | 135 |
123 Most of these are described on the [Linux Faster Builds](linux_faster_builds.md) | 136 * Build in release mode (debugging symbols require more memory). |
124 page. | 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` |
125 | 141 |
126 ## Advanced Features | 142 ## More links |
127 | 143 |
128 * Want to use the (in development) GN build workflow? See | 144 * [Faster builds on Linux](linux_faster_builds.md) |
129 [GN Quick Start](../tools/gn/docs/quick_start.md). | 145 * Information about [building with Clang](clang.md). |
130 * Building frequently? See [LinuxFasterBuilds](linux_faster_builds.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). |
131 * Cross-compiling for ARM? See [LinuxChromiumArm](linux_chromium_arm.md). | 150 * Cross-compiling for ARM? See [LinuxChromiumArm](linux_chromium_arm.md). |
132 * Want to use Eclipse as your IDE? See | 151 * Want to use Eclipse as your IDE? See |
133 [LinuxEclipseDev](linux_eclipse_dev.md). | 152 [LinuxEclipseDev](linux_eclipse_dev.md). |
134 * Built version as Default Browser? See | 153 * Built version as Default Browser? See |
135 [LinuxDevBuildAsDefaultBrowser](linux_dev_build_as_default_browser.md). | 154 [LinuxDevBuildAsDefaultBrowser](linux_dev_build_as_default_browser.md). |
136 | 155 |
137 ## Next Steps | 156 ## Next Steps |
138 | 157 |
139 If you want to contribute to the effort toward a Chromium-based browser for | 158 If you want to contribute to the effort toward a Chromium-based browser for |
140 Linux, please check out the [Linux Development page](linux_development.md) for | 159 Linux, please check out the [Linux Development page](linux_development.md) for |
141 more information. | 160 more information. |
OLD | NEW |