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 These instructions assume that you've already installed Native Client,
22 <a href=
"getting_started.html">Getting Started
</a>.
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.
29 see
<a href=
"getting_started.html">Getting Started
</a>.
34 <li> <a href=
"#setup">Perform one-time setup
</a>
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>
41 <li> <a href=
"#building">Build Native Client
</a> </li>
42 <li> <a href=
"#more">More build options
</a>
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>
51 <h2><a name=
"setup"> </a> Perform one-time setup
</h2>
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:
61 Ubuntu
8.04 (Hardy Heron) and
72 Visual Studio
2005 (
8.0);
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>.
85 <h3><a name=
"python"> </a> Check your Python version
</h3>
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.
93 To check the version of your default
<code>python
</code> command,
94 enter the following in a terminal window:
97 <pre class=
"platform-all">
98 <b>python -V
</b> <em>#Note: That's an uppercase 'V'
</em>
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.
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.
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>
131 Or use Synaptic (
<code>sudo synaptic
</code>)
132 for a friendlier interface to APT.
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>
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:
159 - We don't test on earlier versions.
</li>
161 - You can download this if you don't already have it.
163 <a href=
"http://www.google.com/url?sa=D&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.
171 <h3><a name=
"setup-windows"> </a> Setup: Windows
</h3>
174 You need the following software to build Native Client on Windows:
178 <li> Windows XP or Vista
</li>
179 <li> Visual Studio
2005 (
8.0)
</li>
181 - Required only if you need to run
<code>make
</code> —
182 for example, if you need to build the SDK
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.
197 make sure your
<code>python
</code> command
198 is from the standard Python distribution,
200 You can test using the following command:
204 python -c
"import sys; print sys.platform"
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:
216 set PATH=c:\
<em>python_install_dir
</em>;%PATH%
220 <h2><a name=
"building"> </a> Build Native Client
</h2>
224 you use the same basic commands to build on all platforms.
228 <li> In a shell window, go to the
<code>native_client
</code> directory under your Native Client distribution. For example:
234 <pre class=
"platform-linux-mac">
235 <b>cd
</b><em>install_dir
</em><b>/nacl/googleclient/native_client
</b>
243 <pre class=
"platform-windows">
244 <b>cd
</b><em>install_dir
</em><b>\nacl\googleclient\native_client
</b>
248 <li> Build Native Client and the modules that use it.
254 <pre class=
"platform-linux">
255 <b>./scons --mode=opt-linux,nacl -c
</b> <em>#clean
</em>
256 <b>./scons --mode=opt-linux,nacl
</b> <em>#build
</em>
263 <pre class=
"platform-mac">
264 <b>./scons --mode=opt-mac,nacl -c
</b> <em>#clean
</em>
265 <b>./scons --mode=opt-mac,nacl
</b> <em>#build
</em>
272 <pre class=
"platform-windows">
273 <b>.\scons.bat --mode=opt-win,nacl -c
</b> <em>#clean
</em>
274 <b>.\scons.bat --mode=opt-win,nacl
</b> <em>#build
</em>
279 If you want to build a debug version, substitute
280 <code>dbg
</code> for
<code>opt
</code>.
282 <code>./scons --mode=dbg-linux,nacl
</code>
288 <h2><a name=
"more"> </a> More build options
</h2>
290 <h3><a name=
"h-option"> </a> -h: Help
</h3>
293 Displays SCons options.
296 <h3><a name=
"c-option"> </a> -c: Clean
</h3>
299 Removes build artifacts.
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>.
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.
322 <pre class=
"platform-linux">
323 <b>./scons --mode=opt-linux,nacl -j4
</b>
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&q=http%3A%2F%2Fcreativecommons.org/licenses/by/2.5/">Creative Commons
331 Attribution
2.5 license
</a>.