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">
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>
12 <a href=
"../README.html">Back to README
</a>
15 <h1>Building Native Client
</h1>
18 This page tells you how to build Native Client,
19 including its examples and tests.
20 Building Native Client is simple
21 if you've already installed the distribution for your platform,
22 as described in the Getting Started section
23 <a href=
"getting_started.html#software">Get the software
</a>.
27 <strong>Note:
</strong>
28 You might not need to build Native Client, at all.
29 You can use Native Client and develop modules without building Native Client,
30 since the platform-specific distributions
31 include binaries for Native Client and its SDK.
33 see
<a href=
"getting_started.html">Getting Started
</a>.
39 <li> <a href=
"#setup">Perform one-time setup
</a>
41 <li> <a href=
"#python">Check your Python version
</a> </li>
42 <li> <a href=
"#setup-linux">Setup: Linux
</a> </li>
43 <li> <a href=
"#setup-mac">Setup: Mac OS X
</a> </li>
44 <li> <a href=
"#setup-windows">Setup: Windows
</a> </li>
46 <li> <a href=
"#building">Build Native Client
</a> </li>
47 <li> <a href=
"#sdk">If you need to build the SDK
</a> </li>
48 <li> <a href=
"#more">More build options
</a>
50 <li> <a href=
"#h-option">-h: Help
</a></li>
51 <li> <a href=
"#c-option">-c: Clean
</a></li>
52 <li> <a href=
"#prebuilt-option">--prebuilt: Use existing binaries
</a></li>
53 <li> <a href=
"#j-option">-j
<em>X
</em>: Use multiple processes to build
</a> </li>
57 <h2><a name=
"setup"> </a> Perform one-time setup
</h2>
60 To build Native Client you must have Python
61 and a platform-specific development environment.
62 Native Client has been tested with the following configurations:
67 Ubuntu
8.04 (Hardy Heron) and
78 Visual Studio
2005 (
8.0);
84 For details and additional requirements,
85 see the
<a href=
"#python">next section
</a> and the section for your platform:
86 <a href=
"#setup-linux">Linux
</a>,
87 <a href=
"#setup-mac">Mac OS X
</a>, or
88 <a href=
"#setup-windows">Windows
</a>.
91 <h3><a name=
"python"> </a> Check your Python version
</h3>
94 Python version
2.4 works best, but
2.5 should also work.
95 2.3 does not work; we haven't tested
2.6.
99 To check the version of your default
<code>python
</code> command,
100 enter the following in a terminal window:
103 <pre class=
"platform-all">
104 <kbd>python -V
</kbd> <em>#Note: That's an uppercase 'V'
</em>
108 The output should be something like
109 <code>Python
2.4.3</code>.
110 If the version string doesn't begin
111 with
<code>2.4</code> or
<code>2.5</code>,
112 get Python
2.4 and make it the default version in your path.
117 Make sure the full path to
<code>python
</code> contains
<b>no spaces
</b>.
120 <h3><a name=
"setup-linux"> </a> Setup: Linux
</h3>
123 You need to have the right version of Python
124 installed to use Native Client on Linux.
125 If you're using a
64-bit system,
126 you have a bit more work to do.
132 <a href=
"#python">Python version is
2.4 or
2.5</a>.
133 On Debian-based distributions such as Ubuntu,
134 you can use the following command to get Python
2.4:
136 <pre class=
"platform-linux">
137 <kbd>sudo apt-get install python2.4
</kbd>
141 Or use Synaptic (
<code>sudo synaptic
</code>)
142 for a friendlier interface to APT.
147 Building on
64-bit systems is not as well tested as
148 building on
32-bit systems.
149 However, if you'd like to try building on a
64-bit system,
150 then run the prep script first:
152 <pre class=
"platform-linux">
153 <kbd>cd
<em>install_dir
</em>/nacl/googleclient/native_client/tools
</kbd>
154 <kbd>./linux.x86_64.prep.sh
</kbd>
161 <h3><a name=
"setup-mac"> </a> Setup: Mac OS X
</h3>
164 You need the following software to build Native Client on Mac OS X:
169 - We don't test on earlier versions.
</li>
171 - You can download this if you don't already have it.
173 <a href=
"http://developer.apple.com/tools/xcode">http://developer.apple.com/tools/xcode
</a>.
</li>
174 <li> Python
2.4 or
2.5
175 -
<a href=
"#python">Test the Python version
</a>.
176 If
<code>python
</code> isn't present or isn't
2.4 or
2.5,
177 download Python
2.4 and make sure it's in your path.
181 <h3><a name=
"setup-windows"> </a> Setup: Windows
</h3>
184 You need the following software to build Native Client on Windows:
188 <li> Windows XP or Vista
</li>
189 <li> Visual Studio
2005 (
8.0)
</li>
191 - Required only if you need to run
<code>make
</code> —
192 for example, if you need to build the SDK
194 <b>Note:
</b> If you have Cygwin,
195 use the
<b>xterm
</b> shell window instead of
<code>cygwin.bat
</code>.
196 <li> Python
2.4 or
2.5
197 -
<a href=
"#python">Test the Python version
</a>.
198 If
<code>python
</code> isn't present, isn't
2.4 or
2.5,
199 or is the Cygwin version,
200 download Python
2.4 and make sure it's in your path.
207 make sure your
<code>python
</code> command
208 is from the standard Python distribution,
210 You can test using the following command:
214 <kbd>python -c
"import sys; print sys.platform"</kbd>
218 If the output is
<code>cygwin
</code>,
219 then you're using the Cygwin version of Python
220 and need to find the standard version.
221 Once you have the standard version,
222 put its directory at the front of your PATH:
226 <kbd>set PATH=c:\
<em>python_install_dir
</em>;%PATH%
</kbd>
230 <h2><a name=
"building"> </a> Build Native Client
</h2>
234 you use the same basic commands to build on all platforms.
239 In a shell window, go to the
<code>native_client
</code> directory
240 under your Native Client distribution.
247 <pre class=
"platform-linux-mac">
248 <kbd>cd
<em>install_dir
</em>/nacl/googleclient/native_client
</kbd>
255 <pre class=
"platform-windows">
256 <kbd>cd
<em>install_dir
</em>\nacl\googleclient\native_client
</kbd>
260 <li> Build Native Client and the modules that use it.
266 <pre class=
"platform-linux-mac">
267 <kbd>./scons --mode=most -c
</kbd> <em>#clean
</em>
268 <kbd>./scons --mode=most
</kbd> <em>#build
</em>
275 <pre class=
"platform-windows">
276 <kbd>.\scons.bat --mode=most -c
</kbd> <em>#clean
</em>
277 <kbd>.\scons.bat --mode=most
</kbd> <em>#build
</em>
281 <b>Troubleshooting:
</b>
282 If you see a message like the following,
284 <a href=
"#sdk">build the SDK
</a>.
287 NativeClient SDK not present in
<em>install_dir
</em>/nacl/googleclient/third_party/nacl_sdk/
<em>platform
</em>/sdk/nacl-sdk
288 Run again with the --download flag.
294 <p> Verify that the build succeeded
295 by following the steps in
296 <a href=
"getting_started.html">Getting Started
</a>,
298 <a href=
"getting_started.html#example-nacl">running an example
</a>.
304 <h2><a name=
"sdk"> </a> If you need to build the SDK
</h2>
307 You can probably ignore this section.
308 The platform-specific distributions of Native Client
310 so you don't need to build the SDK unless you either
311 are using the source-only distribution
312 or have changed SDK files.
317 you need
<code>make
</code>.
318 Currently, you can build only on Linux or Mac;
319 you can't build the SDK on Windows, even with Cygwin.
320 <span class=
"comment">[PENDING:
321 When the Windows build starts working, add this:
322 You can get
<code>make
</code> as part of Cygwin.]
327 <b>Technical detail:
</b>
328 Building the SDK requires
<code>make
</code>
329 because part of the SDK
330 is derived from GNU tools, such as GCC,
331 that are built using
<code>make
</code>.
335 Here's how to build the SDK:
339 <li> In a shell window,
340 go to the
<code>tools
</code> directory
341 under your Native Client distribution.
344 <pre class=
"platform-all">
345 <kbd>cd
<em>install_dir
</em>/nacl/googleclient/native_client/tools
</kbd>
348 <li> Run
<code>make
</code>,
349 specifying where to put the SDK (
<code>SDKLOC=
</code>...).
355 <pre class=
"platform-linux">
356 <kbd>make SDKLOC=`pwd`/../../third_party/nacl_sdk/linux/sdk
</kbd>
363 <pre class=
"platform-mac">
364 <kbd>make SDKLOC=`pwd`/../../third_party/nacl_sdk/mac/sdk
</kbd>
367 <div class=
"comment">
369 Windows (Cygwin): [PENDING: add this once the Windows build works]
372 <pre class=
"platform-windows">
373 <kbd>make SDKLOC=`pwd`/../../third_party/nacl_sdk/windows/sdk
</kbd>
380 Check the output to make sure
381 the build completed successfully.
382 The build should take about
20 minutes.
386 <li> Continue
<a href=
"#building">building Native Client
</a>.
391 <h2><a name=
"more"> </a> More build options
</h2>
393 <h3><a name=
"h-option"> </a> -h: Help
</h3>
396 Displays SCons options.
399 <h3><a name=
"c-option"> </a> -c: Clean
</h3>
402 Removes build artifacts.
405 <h3><a name=
"prebuilt-option"> </a> --prebuilt: Use existing binaries
</h3>
408 Forces SCons to use prebuilt binaries,
409 rather than rebuilding.
410 For use with
<code>firefox_install
</code>.
413 <h3><a name=
"j-option"> </a> -j
<em>X
</em>: Use multiple processes to build
</h3>
415 If you are on a multi-core machine,
416 the build process can use multiple cores to speed up the process
417 by using the
<code>-j
<em>X
</em></code> option,
418 where
<em>X
</em> is the number of concurrent processes
419 you would like to have in flight.
420 Normally, a good value is the number of physical cores in the machine.
421 For example, use
<code>-j4
</code> if your machine has
4 cores,
422 as the following example shows.
425 <pre class=
"platform-linux">
426 <kbd>./scons --mode=most -j4
</kbd>
431 <a href=
"http://code.google.com/policies.html#restrictions">noted
</a>,
432 the content of this page is licensed under a
433 <a href=
"http://creativecommons.org/licenses/by/2.5/">Creative Commons
434 Attribution
2.5 license
</a>.