Add ncval-stubout tool
[nativeclient.git] / documentation / building.html
blobcb8ca9a5fb17617a0d314c3e0e0de3bac7efbf5d
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>Native Client: Building Native Client</title>
6 <link href="stylesheet.css" type="text/css" rel="stylesheet"></link>
7 </head>
9 <body>
11 <div id="toplink">
12 <a href="../README.html">Back to README</a>
13 </div>
15 <h1>Building Native Client</h1>
17 <p>
18 This page tells you how to build Native Client,
19 including its examples and tests.
20 These instructions assume that you've already installed Native Client,
21 as described in
22 <a href="getting_started.html">Getting Started</a>.
23 </p>
25 <strong>Note:</strong> You might not need to build, at all.
26 You can use Native Client without building it,
27 since the distributed version includes binaries.
28 For more information,
29 see <a href="getting_started.html">Getting Started</a>.
31 <h3>Contents</h3>
33 <ul>
34 <li> <a href="#setup">Perform one-time setup</a>
35 <ul>
36 <li> <a href="#python">Check your Python version</a> </li>
37 <li> <a href="#setup-linux">Setup: Linux</a> </li>
38 <li> <a href="#setup-mac">Setup: Mac OS X</a> </li>
39 <li> <a href="#setup-windows">Setup: Windows</a> </li>
40 </ul></li>
41 <li> <a href="#building">Build Native Client</a> </li>
42 <li> <a href="#more">More build options</a>
43 <ul>
44 <li> <a href="#h-option">-h: Help</a></li>
45 <li> <a href="#c-option">-c: Clean</a></li>
46 <li> <a href="#prebuilt-option">--prebuilt: Use existing binaries</a></li>
47 <li> <a href="#j-option">-j<em>X</em>: Use multiple processes to build</a> </li>
48 </ul></li>
49 </ul>
51 <h2><a name="setup"> </a> Perform one-time setup </h2>
53 <p>
54 To build Native Client you must have Python
55 and a platform-specific development environment.
56 Native Client has been tested with the following configurations:
57 </p>
59 <ul>
60 <li> Linux:
61 Ubuntu 8.04 (Hardy Heron) and
62 6.06 (Dapper Drake);
63 Python 2.4.
64 </li>
65 <li> Mac:
66 Mac OS X 10.5;
67 Xcode 3.*;
68 Python 2.5.
69 </li>
70 <li> Windows:
71 XP or Vista;
72 Visual Studio 2005 (8.0);
73 Python 2.4.
74 </li>
75 </ul>
77 <p>
78 For details and additional requirements,
79 see the <a href="#python">next section</a> and the section for your platform:
80 <a href="#setup-linux">Linux</a>,
81 <a href="#setup-mac">Mac OS X</a>, or
82 <a href="#setup-windows">Windows</a>.
83 </p>
85 <h3><a name="python"> </a> Check your Python version </h3>
87 <p>
88 Python version 2.4 works best, but 2.5 should also work.
89 2.3 does not work; we haven't tested 2.6.
90 </p>
92 <p>
93 To check the version of your default <code>python</code> command,
94 enter the following in a terminal window:
95 </p>
97 <pre class="platform-all">
98 <b>python -V</b> <em>#Note: That's an uppercase 'V'</em>
99 </pre>
102 The output should be something like
103 <code>Python 2.4.3</code>.
104 If the version string doesn't begin
105 with <code>2.4</code> or <code>2.5</code>,
106 get Python 2.4 and make it the default version in your path.
107 </p>
110 <h3><a name="setup-linux"> </a> Setup: Linux </h3>
113 You need to have the right version of Python
114 installed to use Native Client on Linux.
115 If you're using a 64-bit system,
116 you have a bit more work to do.
117 </p>
119 <ol>
120 <li>
121 Make sure your
122 <a href="#python">Python version is 2.4 or 2.5</a>.
123 On Debian-based distributions such as Ubuntu,
124 you can use the following command to get Python 2.4:
126 <pre class="platform-linux">
127 <b>sudo apt-get install python2.4</b>
128 </pre>
131 Or use Synaptic (<code>sudo synaptic</code>)
132 for a friendlier interface to APT.
133 </p>
134 </li>
136 <li>
137 Building on 64-bit systems is not as well tested as
138 building on 32-bit systems.
139 However, if you'd like to try building on a 64-bit system,
140 then run the prep script first:
142 <pre class="platform-linux">
143 <b>cd </b><em>install_dir</em><b>/nacl/googleclient/native_client/tools</b>
144 <b>./linux.x86_64.prep.sh</b>
145 </pre>
147 </li>
148 </ol>
151 <h3><a name="setup-mac"> </a> Setup: Mac OS X</h3>
154 You need the following software to build Native Client on Mac OS X:
155 </p>
157 <ul>
158 <li> Mac OS X 10.5
159 - We don't test on earlier versions.</li>
160 <li> Xcode
161 - You can download this if you don't already have it.
162 For details, see
163 <a href="http://www.google.com/url?sa=D&amp;q=http%3A%2F%2Fdeveloper.apple.com%2Ftools%2Fxcode">http://developer.apple.com/tools/xcode</a>.</li>
164 <li> Python 2.4 or 2.5
165 - <a href="#python">Test the Python version</a>.
166 If <code>python</code> isn't present or isn't 2.4 or 2.5,
167 download Python 2.4 and make sure it's in your path.
168 </li>
169 </ul>
171 <h3><a name="setup-windows"> </a> Setup: Windows </h3>
174 You need the following software to build Native Client on Windows:
175 </p>
177 <ul>
178 <li> Windows XP or Vista </li>
179 <li> Visual Studio 2005 (8.0) </li>
180 <li> Cygwin
181 - Required only if you need to run <code>make</code> &mdash;
182 for example, if you need to build the SDK
183 <br />
184 <b>Note:</b> If you have Cygwin,
185 use the <b>xterm</b> shell window instead of <code>cygwin.bat</code>.
186 <li> Python 2.4 or 2.5
187 - <a href="#python">Test the Python version</a>.
188 If <code>python</code> isn't present, isn't 2.4 or 2.5,
189 or is the Cygwin version,
190 download Python 2.4 and make sure it's in your path.
191 </li>
192 </ul>
195 <b>Cygwin note:</b>
196 If you have Cygwin,
197 make sure your <code>python</code> command
198 is from the standard Python distribution,
199 not from Cygwin.
200 You can test using the following command:
201 </p>
203 <pre>
204 python -c "import sys; print sys.platform"
205 </pre>
208 If the output is <code>cygwin</code>,
209 then you're using the Cygwin version of Python
210 and need to find the standard version.
211 Once you have the standard version,
212 put its directory at the front of your PATH:
213 </p>
215 <pre>
216 set PATH=c:\<em>python_install_dir</em>;%PATH%
217 </pre>
220 <h2><a name="building"> </a> Build Native Client </h2>
223 Thanks to SCons,
224 you use the same basic commands to build on all platforms.
225 </p>
227 <ol>
228 <li> In a shell window, go to the <code>native_client</code> directory under your Native Client distribution. For example:
231 Linux or Mac:
232 </p>
234 <pre class="platform-linux-mac">
235 <b>cd </b><em>install_dir</em><b>/nacl/googleclient/native_client</b>
236 </pre>
240 Windows:
241 </p>
243 <pre class="platform-windows">
244 <b>cd </b><em>install_dir</em><b>\nacl\googleclient\native_client</b>
245 </pre>
246 </li>
248 <li> Build Native Client and the modules that use it.
251 Linux:
252 </p>
254 <pre class="platform-linux">
255 <b>./scons --mode=opt-linux,nacl -c</b>&nbsp; <em>#clean</em>
256 <b>./scons --mode=opt-linux,nacl &nbsp;&nbsp;&nbsp;</b> <em>#build</em>
257 </pre>
260 Mac:
261 </p>
263 <pre class="platform-mac">
264 <b>./scons --mode=opt-mac,nacl -c</b>&nbsp; <em>#clean</em>
265 <b>./scons --mode=opt-mac,nacl &nbsp;&nbsp;&nbsp;</b> <em>#build</em>
266 </pre>
269 Windows:
270 </p>
272 <pre class="platform-windows">
273 <b>.\scons.bat --mode=opt-win,nacl -c</b>&nbsp; <em>#clean</em>
274 <b>.\scons.bat --mode=opt-win,nacl &nbsp;&nbsp;&nbsp;</b> <em>#build</em>
275 </pre>
278 <b>Note:</b>
279 If you want to build a debug version, substitute
280 <code>dbg</code> for <code>opt</code>.
281 For example:
282 <code>./scons --mode=dbg-linux,nacl</code>
283 </p>
285 </li>
286 </ol>
288 <h2><a name="more"> </a> More build options </h2>
290 <h3><a name="h-option"> </a> -h: Help</h3>
293 Displays SCons options.
294 </p>
296 <h3><a name="c-option"> </a> -c: Clean</h3>
299 Removes build artifacts.
300 </p>
302 <h3><a name="prebuilt-option"> </a> --prebuilt: Use existing binaries</h3>
305 Forces SCons to use prebuilt binaries,
306 rather than rebuilding.
307 For use with <code>firefox_install</code>.
308 </p>
310 <h3><a name="j-option"> </a> -j<em>X</em>: Use multiple processes to build </h3>
312 If you are on a multi-core machine,
313 the build process can use multiple cores to speed up the process
314 by using the <code>-j<em>X</em></code> option,
315 where <em>X</em> is the number of concurrent processes
316 you would like to have in flight.
317 Normally, a good value is the number of physical cores in the machine.
318 For example, use <code>-j4</code> if your machine has 4 cores,
319 as the following example shows.
320 </p>
322 <pre class="platform-linux">
323 <b>./scons --mode=opt-linux,nacl -j4</b>
324 </pre>
326 <p id="license">
327 Except as otherwise
328 <a href="http://code.google.com/policies.html#restrictions">noted</a>,
329 the content of this page is licensed under a
330 <a href="http://www.google.com/url?sa=D&amp;q=http%3A%2F%2Fcreativecommons.org/licenses/by/2.5/">Creative Commons
331 Attribution 2.5 license</a>.
332 </p>
334 </body>
335 </html>