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

Side by Side Diff: docs/linux_build_instructions.md

Issue 1324603002: [Docs] Another round of stylistic fixes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months 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
« no previous file with comments | « docs/linux64_bit_issues.md ('k') | docs/linux_build_instructions_prerequisites.md » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #summary Build instructions for Linux 1 # Build instructions for Linux
2 #labels Linux,build
3 2
4 3 [TOC]
5 4
6 ## Overview 5 ## Overview
7 Due its complexity, Chromium uses a set of custom tools to check out and build. Here's an overview of the steps you'll run: 6
8 1. **gclient**. A checkout involves pulling nearly 100 different SVN reposito ries of code. This process is managed with a tool called `gclient`. 7 Due its complexity, Chromium uses a set of custom tools to check out and build.
9 1. **gyp**. The cross-platform build configuration system is called `gyp`, an d on Linux it generates ninja build files. Running `gyp` is analogous to the `. /configure` step seen in most other software. 8 Here's an overview of the steps you'll run:
10 1. **ninja**. The actual build itself uses `ninja`. A prebuilt binary is in d epot\_tools and should already be in your path if you followed the steps to chec k out Chromium. 9
11 1. We don't provide any sort of "install" step. 10 1. **gclient**. A checkout involves pulling nearly 100 different SVN
12 1. You may want to [use a chroot](http://code.google.com/p/chromium/wiki/Using ALinuxChroot) to isolate yourself from versioning or packaging conflicts (or to run the layout tests). 11 repositories of code. This process is managed with a tool called `gclient`.
12 1. **gyp**. The cross-platform build configuration system is called `gyp`, and
13 on Linux it generates ninja build files. Running `gyp` is analogous to the
14 `./configure` step seen in most other software.
15 1. **ninja**. The actual build itself uses `ninja`. A prebuilt binary is in
16 `depot_tools` and should already be in your path if you followed the steps
17 to check out Chromium.
18 1. We don't provide any sort of "install" step.
19 1. You may want to [use a chroot](using_a_linux_chroot.md) to isolate yourself
20 from versioning or packaging conflicts (or to run the layout tests).
13 21
14 ## Getting a checkout 22 ## Getting a checkout
15 * [Prerequisites](LinuxBuildInstructionsPrerequisites.md): what you need befor e you build
16 * [Get the Code](http://dev.chromium.org/developers/how-tos/get-the-code): che ck out the source code.
17 23
18 **Note**. If you are working on Chromium OS and already have sources in `chromi umos/chromium`, you **must** run `chrome_set_ver --runhooks` to set the correct dependencies. This step is otherwise performed by `gclient` as part of your che ckout. 24 * [Prerequisites](linux_build_instructions_prerequisites.md): what you need
25 before you build.
26 * [Get the Code](http://dev.chromium.org/developers/how-tos/get-the-code):
27 check out the source code.
28
29 **Note**. If you are working on Chromium OS and already have sources in
30 `chromiumos/chromium`, you **must** run `chrome_set_ver --runhooks` to set the
31 correct dependencies. This step is otherwise performed by `gclient` as part of
32 your checkout.
19 33
20 ## First Time Build Bootstrap 34 ## First Time Build Bootstrap
21 * Make sure your dependencies are up to date by running the `install-build-dep s.sh` script:
22 ```
23 .../chromium/src$ build/install-build-deps.sh
24 ```
25 35
26 * Before you build, you should also [install API keys](https://sites.google.c om/a/chromium.org/dev/developers/how-tos/api-keys). 36 * Make sure your dependencies are up to date by running the
37 `install-build-deps.sh` script:
38
39 .../chromium/src$ build/install-build-deps.sh
40
41 * Before you build, you should also
42 [install API keys](https://sites.google.com/a/chromium.org/dev/developers/ho w-tos/api-keys).
27 43
28 ## `gyp` (configuring) 44 ## `gyp` (configuring)
29 After `gclient sync` finishes, it will run `gyp` automatically to generate the n inja build files. For standard chromium builds, this automatic step is sufficien t and you can start [compiling](https://code.google.com/p/chromium/wiki/LinuxBui ldInstructions#Compilation).
30 45
31 To manually configure `gyp`, run `gclient runhooks` or run `gyp` directly via `b uild/gyp_chromium`. See [Configuring the Build](https://code.google.com/p/chromi um/wiki/CommonBuildTasks#Configuring_the_Build) for detailed `gyp` options. 46 After `gclient sync` finishes, it will run `gyp` automatically to generate the
47 ninja build files. For standard chromium builds, this automatic step is
48 sufficient and you can start [compiling](linux_build_instructions.md).
49
50 To manually configure `gyp`, run `gclient runhooks` or run `gyp` directly via
51 `build/gyp_chromium`. See [Configuring the Build](https://code.google.com/p/chro mium/wiki/CommonBuildTasks#Configuring_the_Build) for detailed `gyp` options.
32 52
33 [GypUserDocumentation](https://code.google.com/p/gyp/wiki/GypUserDocumentation) gives background on `gyp`, but is not necessary if you are just building Chromiu m. 53 [GypUserDocumentation](https://code.google.com/p/gyp/wiki/GypUserDocumentation) gives background on `gyp`, but is not necessary if you are just building Chromiu m.
34 54
35 ### Configuring `gyp` 55 ### Configuring `gyp`
36 See [Configuring the Build](https://code.google.com/p/chromium/wiki/CommonBuildT asks#Configuring_the_Build) for details; most often you'll be changing the `GYP_ DEFINES` options, which is discussed here. 56
57 See [Configuring the Build](common_build_tasks.md) for details; most often
58 you'll be changing the `GYP_DEFINES` options, which is discussed here.
37 59
38 `gyp` supports a minimal amount of build configuration via the `-D` flag. 60 `gyp` supports a minimal amount of build configuration via the `-D` flag.
39 ```
40 build/gyp_chromium -Dflag1=value1 -Dflag2=value2
41 ```
42 You can store these in the `GYP_DEFINES` environment variable, separating flags with spaces, as in:
43 ```
44 export GYP_DEFINES="flag1=value1 flag2=value2"
45 ```
46 After changing your `GYP_DEFINES` you need to rerun `gyp`, either implicitly via `gclient sync` (which also syncs) or `gclient runhooks` or explicitly via `buil d/gyp_chromium`.
47 61
48 Note that quotes are not necessary for a single flag, but are useful for clarity ; `GYP_DEFINES=flag1=value1` is syntactically valid but can be confusing compare d to `GYP_DEFINES="flag1=value1"`. 62 build/gyp_chromium -Dflag1=value1 -Dflag2=value2
49 63
50 If you have various flags for various purposes, you may find it more legible to break them up across several lines, taking care to include spaces, such as like this: 64 You can store these in the `GYP_DEFINES` environment variable, separating flags
51 ``` 65 with spaces, as in:
52 export GYP_DEFINES="flag1=value1"\ 66
53 " flag2=value2" 67 export GYP_DEFINES="flag1=value1 flag2=value2"
54 ``` 68
69 After changing your `GYP_DEFINES` you need to rerun `gyp`, either implicitly via
70 `gclient sync` (which also syncs) or `gclient runhooks` or explicitly via
71 `build/gyp_chromium`.
72
73 Note that quotes are not necessary for a single flag, but are useful for
74 clarity; `GYP_DEFINES=flag1=value1` is syntactically valid but can be confusing
75 compared to `GYP_DEFINES="flag1=value1"`.
76
77 If you have various flags for various purposes, you may find it more legible to
78 break them up across several lines, taking care to include spaces, such as like
79 this:
80
81 export GYP_DEFINES="flag1=value1 flag2=value2"
82
55 or like this (allowing comments): 83 or like this (allowing comments):
56 ``` 84
57 export GYP_DEFINES="flag1=value1" # comment 85 export GYP_DEFINES="flag1=value1" # comment
58 GYP_DEFINES+=" flag2=value2" # another comment 86 GYP_DEFINES+=" flag2=value2" # another comment
59 ``` 87
60 88
61 ### Sample configurations 89 ### Sample configurations
62 * **gcc warnings**. By default we fail to build if there are any compiler war nings. If you're getting warnings, can't build because of that, but just want t o get things done, you can specify `-Dwerror=` to turn that off: 90
63 ``` 91 * **gcc warnings**. By default we fail to build if there are any compiler
92 warnings. If you're getting warnings, can't build because of that, but just
93 want to get things done, you can specify `-Dwerror=` to turn that off:
94
95 ```script
64 # one-off 96 # one-off
65 build/gyp_chromium -Dwerror= 97 build/gyp_chromium -Dwerror=
66 # via variable 98 # via variable
67 export GYP_DEFINES="werror=" 99 export GYP_DEFINES="werror="
68 build/gyp_chromium 100 build/gyp_chromium
69 ``` 101 ```
70 102
71 * **ChromeOS**. `-Dchromeos=1` builds the ChromeOS version of Chrome. This is **not** all of ChromeOS (see [the ChromiumOS](http://www.chromium.org/chromium- os) page for full build instructions), this is just the slightly tweaked version of the browser that runs on that system. Its not designed to be run outside of ChromeOS and some features won't work, but compiling on your Linux desktop can b e useful for certain types of development and testing. 103 * **ChromeOS**. `-Dchromeos=1` builds the ChromeOS version of Chrome. This is
72 ``` 104 **not** all of ChromeOS (see
105 [the ChromiumOS](http://www.chromium.org/chromium-os) page for full build
106 instructions), this is just the slightly tweaked version of the browser that
107 runs on that system. Its not designed to be run outside of ChromeOS and some
108 features won't work, but compiling on your Linux desktop can be useful for
109 certain types of development and testing.
110
111 ```shell
73 # one-off 112 # one-off
74 build/gyp_chromium -Dchromeos=1 113 build/gyp_chromium -Dchromeos=1
75 # via variable 114 # via variable
76 export GYP_DEFINES="chromeos=1" 115 export GYP_DEFINES="chromeos=1"
77 build/gyp_chromium 116 build/gyp_chromium
78 ``` 117 ```
79 118
119 ## Compilation
80 120
81 ## Compilation
82 The weird "`src/`" directory is an artifact of `gclient`. Start with: 121 The weird "`src/`" directory is an artifact of `gclient`. Start with:
83 ``` 122
84 $ cd src 123 $ cd src
85 ```
86 124
87 ### Build just chrome 125 ### Build just chrome
88 ``` 126
89 $ ninja -C out/Debug chrome 127 $ ninja -C out/Debug chrome
90 ``` 128
91 129
92 ### Faster builds 130 ### Faster builds
93 See LinuxFasterBuilds 131
132 See [Linux Faster Builds](linux_faster_builds.md)
94 133
95 ### Build every test 134 ### Build every test
96 ``` 135
97 $ ninja -C out/Debug 136 $ ninja -C out/Debug
98 ``` 137
99 The above builds all libraries and tests in all components. **It will take hour s.** 138 The above builds all libraries and tests in all components. **It will take
139 hours.**
100 140
101 Specifying other target names to restrict the build to just what you're 141 Specifying other target names to restrict the build to just what you're
102 interested in. To build just the simplest unit test: 142 interested in. To build just the simplest unit test:
103 ``` 143
104 $ ninja -C out/Debug base_unittests 144 $ ninja -C out/Debug base_unittests
105 ```
106 145
107 ### Clang builds 146 ### Clang builds
108 147
109 Information about building with Clang can be found [here](http://code.google.com /p/chromium/wiki/Clang). 148 Information about building with Clang can be found [here](clang.md).
110 149
111 ### Output 150 ### Output
112 151
113 Executables are written in `src/out/Debug/` for Debug builds, and `src/out/Relea se/` for Release builds. 152 Executables are written in `src/out/Debug/` for Debug builds, and
153 `src/out/Release/` for Release builds.
114 154
115 ### Release mode 155 ### Release mode
116 156
117 Pass `-C out/Release` to the ninja invocation: 157 Pass `-C out/Release` to the ninja invocation:
118 ``` 158
119 $ ninja -C out/Release chrome 159 $ ninja -C out/Release chrome
120 ``` 160
121 161
122 ### Seeing the commands 162 ### Seeing the commands
123 163
124 If you want to see the actual commands that ninja is invoking, add `-v` to the n inja invocation. 164 If you want to see the actual commands that ninja is invoking, add `-v` to the
125 ``` 165 ninja invocation.
126 $ ninja -v -C out/Debug chrome 166
127 ``` 167 $ ninja -v -C out/Debug chrome
128 This is useful if, for example, you are debugging gyp changes, or otherwise need to see what ninja is actually doing. 168
169 This is useful if, for example, you are debugging gyp changes, or otherwise need
170 to see what ninja is actually doing.
129 171
130 ### Clean builds 172 ### Clean builds
131 All built files are put into the `out/` directory, so to start over with a clean build, just 173
132 ``` 174 All built files are put into the `out/` directory, so to start over with a clean
133 rm -rf out 175 build, just
134 ``` 176
135 and run `gclient runhooks` or `build\gyp_chromium` again to recreate the ninja b uild files (which are also stored in `out/`). Or you can run `ninja -C out/Debug -t clean`. 177 rm -rf out
178
179 and run `gclient runhooks` or `build\gyp_chromium` again to recreate the ninja
180 build files (which are also stored in `out/`). Or you can run `ninja -C
181 out/Debug -t clean`.
136 182
137 ### Linker Crashes 183 ### Linker Crashes
184
138 If, during the final link stage: 185 If, during the final link stage:
186
187 LINK(target) out/Debug/chrome
188
189
190 You get an error like:
191
139 ``` 192 ```
140 LINK(target) out/Debug/chrome 193 collect2: ld terminated with signal 6 Aborted terminate called after throwing an
194 instance of 'std::bad_alloc'
195
196 collect2: ld terminated with signal 11 [Segmentation fault], core dumped
141 ``` 197 ```
142 198
143 You get an error like: 199 you are probably running out of memory when linking. Try one of:
144 ```
145 collect2: ld terminated with signal 6 Aborted terminate called after throwing an instance of 'std::bad_alloc'
146 200
147 collect2: ld terminated with signal 11 [Segmentation fault], core dumped 201 1. Use the `gold` linker
148 ``` 202 1. Build on a 64-bit computer
149 you are probably running out of memory when linking. Try one of: 203 1. Build in Release mode (debugging symbols require a lot of memory)
150 1. Use the `gold` linker 204 1. Build as shared libraries (note: this build is for developers only, and may
151 1. Build on a 64-bit computer 205 have broken functionality)
152 1. Build in Release mode (debugging symbols require a lot of memory) 206
153 1. Build as shared libraries (note: this build is for developers only, and may have broken functionality) 207 Most of these are described on the [LinuxFasterBuilds](linux_faster_builds.md)
154 Most of these are described on the LinuxFasterBuilds page. 208 page.
155 209
156 ## Advanced Features 210 ## Advanced Features
157 211
158 * Building frequently? See LinuxFasterBuilds. 212 * Building frequently? See [LinuxFasterBuilds](linux_faster_builds.md).
159 * Cross-compiling for ARM? See LinuxChromiumArm. 213 * Cross-compiling for ARM? See [LinuxChromiumArm](linux_chromium_arm.md).
160 * Want to use Eclipse as your IDE? See LinuxEclipseDev. 214 * Want to use Eclipse as your IDE? See
161 * Built version as Default Browser? See LinuxDevBuildAsDefaultBrowser. 215 [LinuxEclipseDev](linux_eclipse_dev.md).
216 * Built version as Default Browser? See
217 [LinuxDevBuildAsDefaultBrowser](linux_dev_build_as_default_browser.md).
162 218
163 ## Next Steps 219 ## Next Steps
164 If you want to contribute to the effort toward a Chromium-based browser for Linu x, please check out the [Linux Development page](LinuxDevelopment.md) for more i nformation. 220
221 If you want to contribute to the effort toward a Chromium-based browser for
222 Linux, please check out the [Linux Development page](linux_development.md) for
223 more information.
OLDNEW
« no previous file with comments | « docs/linux64_bit_issues.md ('k') | docs/linux_build_instructions_prerequisites.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698