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

Side by Side Diff: docs/mac_build_instructions.md

Issue 2536723008: Make some small tweaks to the build instructions. (Closed)
Patch Set: Nits 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
« no previous file with comments | « docs/linux_open_suse_build_instructions.md ('k') | docs/windows_build_instructions.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 # Mac Build Instructions 1 # Mac Build Instructions
2 2
3 Google employee? See [go/building-chrome](https://goto.google.com/building-chrom e) instead. 3 Google employee? See [go/building-chrome](https://goto.google.com/building-chrom e) instead.
4 4
5 [TOC] 5 [TOC]
6 6
7 ## System requirements 7 ## System requirements
8 8
9 * A 64-bit Mac running 10.9+. 9 * A 64-bit Mac running 10.9+.
10 * [Xcode](https://developer.apple.com/xcode) 7.3+. 10 * [Xcode](https://developer.apple.com/xcode) 7.3+.
11 * The OSX 10.10 SDK. Run 11 * The OS X 10.10 SDK. Run
12
13 ```shell
14 $ ls `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs
12 ``` 15 ```
13 ls `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs 16
14 ``` 17 to check whether you have it. Building with a newer SDK works too, but
15 to check whether you have it. Building with the 10.11 SDK works too, but
16 the releases currently use the 10.10 SDK. 18 the releases currently use the 10.10 SDK.
17 * Git v
18 * Python 2.7.x.
19 19
20 ## Install `depot_tools` 20 ## Install `depot_tools`
21 21
22 Clone the depot_tools repository: 22 Clone the `depot_tools` repository:
23 23
24 $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git 24 ```shell
25 $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
26 ```
25 27
26 Add depot_tools to the end of your PATH (you will probably want to put this 28 Add `depot_tools` to the end of your PATH (you will probably want to put this
27 in your ~/.bashrc or ~/.zshrc). Assuming you cloned depot_tools 29 in your `~/.bashrc` or `~/.zshrc`). Assuming you cloned `depot_tools` to
28 to /path/to/depot_tools: 30 `/path/to/depot_tools`:
29 31
30 $ export PATH=$PATH:/path/to/depot_tools 32 ```shell
33 $ export PATH="$PATH:/path/to/depot_tools"
34 ```
31 35
32 ## Get the code 36 ## Get the code
33 37
34 Create a chromium directory for the checkout and change to it (you can call 38 Create a `chromium` directory for the checkout and change to it (you can call
35 this whatever you like and put it wherever you like, as 39 this whatever you like and put it wherever you like, as long as the full path
36 long as the full path has no spaces): 40 has no spaces):
37
38 $ mkdir chromium
39 $ cd chromium
40 41
41 Run the `fetch` tool from depot_tools to check out the code and its 42 ```shell
43 $ mkdir chromium && cd chromium
44 ```
45
46 Run the `fetch` tool from `depot_tools` to check out the code and its
42 dependencies. 47 dependencies.
43 48
44 $ fetch chromium 49 ```shell
50 $ fetch chromium
51 ```
45 52
46 If you don't want the full repo history, you can save a lot of time by 53 If you don't want the full repo history, you can save a lot of time by
47 adding the `--no-history` flag to fetch. Expect the command to take 54 adding the `--no-history` flag to `fetch`.
48 30 minutes on even a fast connection, and many hours on slower ones.
49 55
50 When fetch completes, it will have created a directory called `src`. 56 Expect the command to take 30 minutes on even a fast connection, and many
51 The remaining instructions assume you are now in that directory: 57 hours on slower ones.
52 58
53 $ cd src 59 When `fetch` completes, it will have created a hidden `.gclient` file and a
60 directory called `src` in the working directory. The remaining instructions
61 assume you have switched to the `src` directory:
54 62
55 *Optional*: You can also [install API keys](https://www.chromium.org/developers/ how-tos/api-keys) 63 ```shell
56 if you want to talk to some of the Google services, but this is not necessary 64 $ cd src
57 for most development and testing purposes. 65 ```
66
67 *Optional*: You can also [install API
68 keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your
69 build to talk to some Google services, but this is not necessary for most
70 development and testing purposes.
58 71
59 ## Building 72 ## Building
60 73
61 Chromium uses [Ninja](https://ninja-build.org) as its main build tool, and 74 Chromium uses [Ninja](https://ninja-build.org) as its main build tool along
62 a tool called [GN](../tools/gn/docs/quick_start.md) to generate 75 with a tool called [GN](../tools/gn/docs/quick_start.md) to generate `.ninja`
63 the .ninja files to do the build. To create a build directory: 76 files. You can create any number of *build directories* with different
77 configurations. To create a build directory:
64 78
65 $ gn gen out/Default 79 ```shell
80 $ gn gen out/Default
81 ```
66 82
67 * You only have to do run this command once, it will self-update the build 83 * You only have to run this once for each new build directory, Ninja will
68 files as needed after that. 84 update the build files as needed.
69 * You can replace `out/Default` with another directory name, but we recommend 85 * You can replace `Default` with another name, but
70 it should still be a subdirectory of `out`. 86 it should be a subdirectory of `out`.
71 * To specify build parameters for GN builds, including release settings, 87 * For other build arguments, including release settings, see [GN build
72 see [GN build configuration](https://www.chromium.org/developers/gn-build-conf iguration). 88 configuration](https://www.chromium.org/developers/gn-build-configuration).
73 The default will be a debug component build matching the current host 89 The default will be a debug component build matching the current host
74 operating system and CPU. 90 operating system and CPU.
75 * For more info on GN, run `gn help` on the command line or read the 91 * For more info on GN, run `gn help` on the command line or read the
76 [quick start guide](../tools/gn/docs/quick_start.md). 92 [quick start guide](../tools/gn/docs/quick_start.md).
77 93
78 94
79 ### Faster builds 95 ### Faster builds
80 96
81 Full rebuilds are about the same speed in Debug and Release, but linking is a 97 Full rebuilds are about the same speed in Debug and Release, but linking is a
82 lot faster in Release builds. 98 lot faster in Release builds.
83 99
84 Put 100 Put
85 101
86 is_debug = false 102 ```
103 is_debug = false
104 ```
87 105
88 in your args.gn to do a release build. 106 in your `args.gn` to do a release build.
89 107
90 Put 108 Put
91 109
92 is_component_build = true 110 ```
111 is_component_build = true
112 ```
93 113
94 in your args.gn to build many small dylibs instead of a single large executable. 114 in your `args.gn` to build many small dylibs instead of a single large
95 This makes incremental builds much faster, at the cost of producing a binary 115 executable. This makes incremental builds much faster, at the cost of producing
96 that opens less quickly. Component builds work in both debug and release. 116 a binary that opens less quickly. Component builds work in both debug and
117 release.
97 118
98 Put 119 Put
99 120
100 symbol_level = 0 121 ```
122 symbol_level = 0
123 ```
101 124
102 in your args.gn to disable debug symbols altogether. This makes both full 125 in your args.gn to disable debug symbols altogether. This makes both full
103 rebuilds and linking faster (at the cost of not getting symbolized backtraces 126 rebuilds and linking faster (at the cost of not getting symbolized backtraces
104 in gdb). 127 in gdb).
105 128
106 You might also want to [install ccache](ccache_mac.md) to speed up the build. 129 You might also want to [install ccache](ccache_mac.md) to speed up the build.
107 130
108 ## Run Chromium 131 ## Run Chromium
109 132
110 Once it is built, you can simply run the browser: 133 Once it is built, you can simply run the browser:
111 134
112 $ out/Default/chrome 135 ```shell
136 $ out/Default/chrome
137 ```
113 138
114 ## Running test targets 139 ## Running test targets
115 140
116 You can run the tests in the same way. You can also limit which tests are 141 You can run the tests in the same way. You can also limit which tests are
117 run using the `--gtest_filter` arg, e.g.: 142 run using the `--gtest_filter` arg, e.g.:
118 143
119 $ ninja -C out/Default unit_tests --gtest_filter="PushClientTest.*" 144 ```
145 $ ninja -C out/Default unit_tests --gtest_filter="PushClientTest.*"
146 ```
120 147
121 You can find out more about GoogleTest at its 148 You can find out more about GoogleTest at its
122 [GitHub page](https://github.com/google/googletest). 149 [GitHub page](https://github.com/google/googletest).
123 150
124 ## Debugging 151 ## Debugging
125 152
126 Good debugging tips can be found 153 Good debugging tips can be found
127 [here](http://dev.chromium.org/developers/how-tos/debugging-on-os-x). If you 154 [here](http://dev.chromium.org/developers/how-tos/debugging-on-os-x). If you
128 would like to debug in a graphical environment, rather than using `lldb` at the 155 would like to debug in a graphical environment, rather than using `lldb` at the
129 command line, that is possible without building in Xcode. See 156 command line, that is possible without building in Xcode (see
130 [Debugging in Xcode](http://www.chromium.org/developers/how-tos/debugging-on-os- x/building-with-ninja-debugging-with-xcode) 157 [Debugging in Xcode](http://www.chromium.org/developers/how-tos/debugging-on-os- x/building-with-ninja-debugging-with-xcode)).
131 for information on how.
132 158
133 ## Update your checkout 159 ## Update your checkout
134 160
135 To update an existing checkout, you can run 161 To update an existing checkout, you can run
136 162
137 $ git rebase-update 163 ```shell
138 $ gclient sync 164 $ git rebase-update
165 $ gclient sync
166 ```
139 167
140 The first command updates the primary Chromium source repository and rebases 168 The first command updates the primary Chromium source repository and rebases
141 any of your local branches on top of tip-of-tree (aka the Git branch `origin/mas ter`). 169 any of your local branches on top of tip-of-tree (aka the Git branch
142 If you don't want to use this script, you can also just use `git pull` or 170 `origin/master`). If you don't want to use this script, you can also just use
143 other common Git commands to update the repo. 171 `git pull` or other common Git commands to update the repo.
144 172
145 The second command syncs the subrepositories to the appropriate versions and 173 The second command syncs dependencies to the appropriate versions and re-runs
146 re-runs the hooks as needed. 174 hooks as needed.
147 175
148 ## Tips, tricks, and troubleshooting 176 ## Tips, tricks, and troubleshooting
149 177
150 ### Using Xcode-Ninja Hybrid 178 ### Using Xcode-Ninja Hybrid
151 179
152 While using Xcode is unsupported, gn supports a hybrid approach of using ninja 180 While using Xcode is unsupported, GN supports a hybrid approach of using Ninja
153 for building, but Xcode for editing and driving compilation. Xcode is still 181 for building, but Xcode for editing and driving compilation. Xcode is still
154 slow, but it runs fairly well even **with indexing enabled**. Most people 182 slow, but it runs fairly well even **with indexing enabled**. Most people
155 build in the Terminal and write code with a text editor though. 183 build in the Terminal and write code with a text editor, though.
156 184
157 With hybrid builds, compilation is still handled by ninja, and can be run by the 185 With hybrid builds, compilation is still handled by Ninja, and can be run from
158 command line (e.g. ninja -C out/gn chrome) or by choosing the chrome target 186 the command line (e.g. `ninja -C out/gn chrome`) or by choosing the `chrome`
159 in the hybrid workspace and choosing build. 187 target in the hybrid workspace and choosing Build.
160 188
161 To use Xcode-Ninja Hybrid pass --ide=xcode to `gn gen` 189 To use Xcode-Ninja Hybrid pass `--ide=xcode` to `gn gen`:
162 190
163 ```shell 191 ```shell
164 gn gen out/gn --ide=xcode 192 $ gn gen out/gn --ide=xcode
165 ``` 193 ```
166 194
167 Open it: 195 Open it:
168 196
169 ```shell 197 ```shell
170 open out/gn/ninja/all.xcworkspace 198 $ open out/gn/ninja/all.xcworkspace
171 ``` 199 ```
172 200
173 You may run into a problem where http://YES is opened as a new tab every time 201 You may run into a problem where http://YES is opened as a new tab every time
174 you launch Chrome. To fix this, open the scheme editor for the Run scheme, 202 you launch Chrome. To fix this, open the scheme editor for the Run scheme,
175 choose the Options tab, and uncheck "Allow debugging when using document 203 choose the Options tab, and uncheck "Allow debugging when using document
176 Versions Browser". When this option is checked, Xcode adds 204 Versions Browser". When this option is checked, Xcode adds
177 `--NSDocumentRevisionsDebugMode YES` to the launch arguments, and the `YES` gets 205 `--NSDocumentRevisionsDebugMode YES` to the launch arguments, and the `YES`
178 interpreted as a URL to open. 206 gets interpreted as a URL to open.
179 207
180 If you have problems building, join us in `#chromium` on `irc.freenode.net` and 208 If you have problems building, join us in `#chromium` on `irc.freenode.net` and
181 ask there. As mentioned above, be sure that the 209 ask there. Be sure that the
182 [waterfall](http://build.chromium.org/buildbot/waterfall/) is green and the tree 210 [waterfall](http://build.chromium.org/buildbot/waterfall/) is green and the
183 is open before checking out. This will increase your chances of success. 211 tree is open before checking out. This will increase your chances of success.
184 212
185 ### Improving performance of `git status` 213 ### Improving performance of `git status`
186 214
187 `git status` is used frequently to determine the status of your checkout. Due 215 `git status` is used frequently to determine the status of your checkout. Due
188 to the number of files in Chromium's checkout, `git status` performance can be 216 to the large number of files in Chromium's checkout, `git status` performance
189 quite variable. Increasing the system's vnode cache appears to help. By 217 can be quite variable. Increasing the system's vnode cache appears to help. By
190 default, this command: 218 default, this command:
191 219
192 sysctl -a | egrep kern\..*vnodes 220 ```shell
221 $ sysctl -a | egrep kern\..*vnodes
222 ```
193 223
194 Outputs `kern.maxvnodes: 263168` (263168 is 257 * 1024). To increase this 224 Outputs `kern.maxvnodes: 263168` (263168 is 257 * 1024). To increase this
195 setting: 225 setting:
196 226
197 sudo sysctl kern.maxvnodes=$((512*1024)) 227 ```shell
228 $ sudo sysctl kern.maxvnodes=$((512*1024))
229 ```
198 230
199 Higher values may be appropriate if you routinely move between different 231 Higher values may be appropriate if you routinely move between different
200 Chromium checkouts. This setting will reset on reboot, the startup setting can 232 Chromium checkouts. This setting will reset on reboot, the startup setting can
201 be set in `/etc/sysctl.conf`: 233 be set in `/etc/sysctl.conf`:
202 234
203 echo kern.maxvnodes=$((512*1024)) | sudo tee -a /etc/sysctl.conf 235 ```shell
236 $ echo kern.maxvnodes=$((512*1024)) | sudo tee -a /etc/sysctl.conf
237 ```
204 238
205 Or edit the file directly. 239 Or edit the file directly.
206 240
207 If your `git --version` reports 2.6 or higher, the following may also improve 241 If `git --version` reports 2.6 or higher, the following may also improve
208 performance of `git status`: 242 performance of `git status`:
209 243
210 git update-index --untracked-cache 244 ```shell
245 $ git update-index --untracked-cache
246 ```
211 247
212 ### Xcode license agreement 248 ### Xcode license agreement
213 249
214 If you're getting the error 250 If you're getting the error
215 251
216 ``` 252 > Agreeing to the Xcode/iOS license requires admin privileges, please re-run as
217 Agreeing to the Xcode/iOS license requires admin privileges, please re-run as ro ot via sudo. 253 > root via sudo.
218 ```
219 254
220 the Xcode license hasn't been accepted yet which (contrary to the message) any 255 the Xcode license hasn't been accepted yet which (contrary to the message) any
221 user can do by running: 256 user can do by running:
222 257
223 xcodebuild -license 258 ```shell
259 $ xcodebuild -license
260 ```
224 261
225 Only accepting for all users of the machine requires root: 262 Only accepting for all users of the machine requires root:
226 263
227 sudo xcodebuild -license 264 ```shell
265 $ sudo xcodebuild -license
266 ```
OLDNEW
« no previous file with comments | « docs/linux_open_suse_build_instructions.md ('k') | docs/windows_build_instructions.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698