Home | History | Annotate | Download | only in sdk
      1 {{+bindTo:partials.standard_nacl_article}}
      2 
      3 <section id="download-the-native-client-sdk">
      4 <span id="download"></span><h1 id="download-the-native-client-sdk"><span id="download"></span>Download the Native Client SDK</h1>
      5 <p>To build Native Client modules, you must download and install the Native
      6 Client Software Development Kit (SDK). This page provides an overview
      7 of the Native Client SDK, and instructions for how to download and
      8 install the SDK.</p>
      9 <section id="overview">
     10 <h2 id="overview">Overview</h2>
     11 <p>The Native Client SDK includes the following:</p>
     12 <dl class="docutils">
     13 <dt>support for multiple Pepper versions</dt>
     14 <dd>The SDK contains <strong>bundles</strong> that let you compile Native Client modules
     15 using different versions of the
     16 <a class="reference internal" href="/native-client/overview.html#link-pepper"><em>Pepper Plugin API</em></a> (e.g., Pepper 31 or Pepper Canary). Review the
     17 <a class="reference internal" href="/native-client/sdk/release-notes.html"><em>Release Notes</em></a> for a description of the new features
     18 included in each Pepper version to help you decide which bundle to
     19 use to develop your application. In general, Native Client modules
     20 compiled using a particular Pepper version will work in
     21 corresponding versions of Chrome and higher. For example, a module
     22 compiled using the Pepper 31 bundle will work in Chrome 31 and
     23 higher.</dd>
     24 <dt>update utility</dt>
     25 <dd>The <code>naclsdk</code> utility (<code>naclsdk.bat</code> on Windows) lets you download new
     26 bundles that are available, as well as new versions of existing bundles.</dd>
     27 <dt>toolchains</dt>
     28 <dd>Each platform includes three toolchains: one for compiling
     29 Portable Native Client (PNaCl) applications, one for compiling
     30 architecture-specific Native Client applications with newlib, and
     31 one for compiling architecture-specific Native Client applications with glibc.
     32 Newlib and glibc are two different implementations
     33 of the C standard library. All three toolchains contain
     34 Native Client-compatible versions of standard compilers, linkers,
     35 and other tools. See <a class="reference internal" href="/native-client/nacl-and-pnacl.html"><em>NaCl and PNaCl</em></a> to help
     36 you choose the right toolchain.</dd>
     37 <dt>examples</dt>
     38 <dd>Each example in the SDK includes C or C++ source files and header files
     39 illustrating how to use NaCl and Pepper, along with a Makefile to build
     40 the example using each of the toolchains.</dd>
     41 <dt>tools</dt>
     42 <dd>The SDK includes a number of additional tools that you can use for
     43 tasks such as validating Native Client modules and running modules
     44 from the command line.</dd>
     45 </dl>
     46 <p>Follow the steps below to download and install the Native Client SDK.</p>
     47 </section><section id="prerequisites">
     48 <h2 id="prerequisites">Prerequisites</h2>
     49 <ul class="small-gap">
     50 <li><p class="first"><strong>Python:</strong> Make sure you have Python 2.6 or 2.7 installed, and that the
     51 Python executable is in your path.</p>
     52 <ul class="small-gap">
     53 <li>On Mac/Linux, Python is likely preinstalled. Run the command <code>&quot;python
     54 -V</code>&#8221; in a terminal window, and make sure that the version of Python you
     55 have is 2.6.x or 2.7.x (if it&#8217;s not, upgrade to one of those versions).</li>
     56 <li>On Windows, you may need to install Python. Go to
     57 <a class="reference external" href="http://www.python.org/download/">http://www.python.org/download/</a> and
     58 select the latest 2.x version. In addition, be sure to add the Python
     59 directory (for example, <code>C:\python27</code>) to the PATH <a class="reference external" href="http://en.wikipedia.org/wiki/Environment_variable">environment
     60 variable</a>. After
     61 you&#8217;ve installed Python, run the command <code>&quot;python -V</code>&#8221; in a Command
     62 Prompt window and verify that the version of Python you have is 2.6.x or
     63 2.7.x.</li>
     64 <li>Note that Python 3.x is not yet supported.</li>
     65 </ul>
     66 </li>
     67 <li><strong>Make:</strong> On the Mac, you need to install the <code>make</code> command on your system
     68 before you can build and run the examples in the SDK. One easy way to get
     69 <code>make</code>, along with several other useful tools, is to install
     70 <a class="reference external" href="https://developer.apple.com/technologies/tools/">Xcode Developer Tools</a>.
     71 After installing Xcode, go to the Preferences menu, select
     72 Downloads and Components, and verify that Command Line Tools are installed.
     73 If you&#8217;d rather not install Xcode, you can download and build an
     74 <a class="reference external" href="http://mac.softpedia.com/dyn-postdownload.php?p=44632&t=4&i=1">open source version</a> of
     75 <code>make</code>. In order to build the command you may also need to download and
     76 install a copy of <a class="reference external" href="https://github.com/kennethreitz/osx-gcc-installer">gcc</a>.</li>
     77 </ul>
     78 </section><section id="download-and-install-the-sdk">
     79 <h2 id="download-and-install-the-sdk">Download and install the SDK</h2>
     80 <ol class="arabic">
     81 <li><p class="first">Download the SDK update utility: <a class="reference external" href="http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip">nacl_sdk.zip</a>.</p>
     82 </li>
     83 <li><p class="first">Unzip the SDK update utility:</p>
     84 <ul class="small-gap">
     85 <li><p class="first">On Mac/Linux, run the command &#8220;<code>unzip nacl_sdk.zip</code>&#8221; in a terminal
     86 window.</p>
     87 </li>
     88 <li><p class="first">On Windows, right-click on the .zip file and select &#8220;Extract All...&#8221;. A
     89 dialog box will open; enter a location and click &#8220;Extract&#8221;.</p>
     90 </li>
     91 </ul>
     92 <p>Unzipping the SDK update utility creates a directory called <code>nacl_sdk</code> with
     93 the following files and directories:</p>
     94 <ul class="small-gap">
     95 <li><p class="first"><code>naclsdk</code> (and <code>naclsdk.bat</code> for Windows) &#8212; the front end of the update
     96 utility, i.e., the command you run to download the latest bundles</p>
     97 </li>
     98 <li><p class="first"><code>sdk_cache</code> &#8212; a directory with a manifest file that lists the bundles
     99 you have already downloaded</p>
    100 </li>
    101 <li><p class="first"><code>sdk_tools</code> &#8212; the back end of the update utility, also known as the
    102 &#8220;sdk_tools&#8221; bundle</p>
    103 </li>
    104 </ul>
    105 </li>
    106 <li><p class="first">To see the SDK bundles that are available for download, go to the <code>nacl_sdk</code>
    107 directory and run <code>naclsdk</code> with the <code>&quot;list&quot;</code> command.
    108 The SDK includes a separate bundle for each version of Chrome/Pepper.</p>
    109 <p>On Mac/Linux:</p>
    110 <pre class="prettyprint">
    111 $ cd nacl_sdk
    112 $ ./naclsdk list
    113 </pre>
    114 <p>On Windows:</p>
    115 <pre class="prettyprint">
    116 &gt; cd nacl_sdk
    117 &gt; naclsdk list
    118 </pre>
    119 <p>You should see output similar to this:</p>
    120 <pre class="prettyprint">
    121 Bundles:
    122  I: installed
    123  *: update available
    124 
    125   I  sdk_tools (stable)
    126      vs_addin (dev)
    127      pepper_27 (post_stable)
    128      pepper_28 (post_stable)
    129      pepper_29 (post_stable)
    130      pepper_30 (post_stable)
    131      pepper_31 (stable)
    132      pepper_32 (beta)
    133      pepper_canary (canary)
    134 </pre>
    135 <p>The sample output above shows that there are a number of bundles available
    136 for download, and that you have already installed the latest revision of the
    137 <code>sdk_tools</code> bundle (it was included in the zip file you downloaded).
    138 Each bundle is labeled post-stable, stable, beta, dev, or canary.
    139 These labels usually correspond to the current versions of
    140 Chrome. (In the example above, Chrome 31 is stable, Chrome 32 is beta, etc.).
    141 We generally recommend that you download and use a &#8220;stable&#8221; bundle,
    142 as applications developed with &#8220;stable&#8221; bundles can be used by all current
    143 Chrome users. This is because Native Client is designed to be
    144 backward-compatible (for example, applications developed with the
    145 <code>pepper_31</code> bundle can run in Chrome 31, Chrome 32, etc.).
    146 Thus in the example above, <code>pepper_31</code> is the recommended bundle to use.</p>
    147 </li>
    148 <li><p class="first">Run <code>naclsdk</code> with the &#8220;update&#8221; command to download recommended bundles.</p>
    149 <p>On Mac/Linux:</p>
    150 <pre class="prettyprint">
    151 $ ./naclsdk update
    152 </pre>
    153 <p>On Windows:</p>
    154 <pre class="prettyprint">
    155 &gt; naclsdk update
    156 </pre>
    157 <p>By default, <code>naclsdk</code> only downloads bundles that are
    158 recommended&#8212;generally those that are &#8220;stable.&#8221; Continuing with the earlier example, the
    159 &#8220;update&#8221; command would only download the <code>pepper_31</code>
    160 bundle, since the bundles <code>pepper_32</code> and greater are not yet stable.
    161 If you want the <code>pepper_32</code> bundle, you must ask for it explicitly:</p>
    162 <pre class="prettyprint">
    163 $ ./naclsdk update pepper_32
    164 </pre>
    165 <p>Note that you never need to update the <code>sdk_tools</code> bundle&#8212;it is
    166 updated automatically (if necessary) whenever you run <code>naclsdk</code>.</p>
    167 </li>
    168 </ol>
    169 <aside class="note">
    170 The minimum SDK bundle that supports PNaCl is <code>pepper_31</code>.
    171 </aside>
    172 </section><section id="staying-up-to-date-and-getting-new-versions-of-bundles">
    173 <h2 id="staying-up-to-date-and-getting-new-versions-of-bundles">Staying up-to-date and getting new versions of bundles</h2>
    174 <ol class="arabic">
    175 <li><p class="first">Run <code>naclsdk</code> with the &#8220;list&#8221; command again; this will show you the list of
    176 available bundles and verify which bundles you have installed.</p>
    177 <p>On Mac/Linux:</p>
    178 <pre class="prettyprint">
    179 $ ./naclsdk list
    180 </pre>
    181 <p>On Windows:</p>
    182 <pre class="prettyprint">
    183 &gt; naclsdk list
    184 </pre>
    185 <p>Continuing with the earlier example, if you previously downloaded the
    186 <code>pepper_31</code> bundle, you should see output similar to this:</p>
    187 <pre class="prettyprint">
    188 Bundles:
    189  I: installed
    190  *: update available
    191 
    192   I  sdk_tools (stable)
    193      vs_addin (dev)
    194      pepper_27 (post_stable)
    195      pepper_28 (post_stable)
    196      pepper_29 (post_stable)
    197      pepper_30 (post_stable)
    198   I  pepper_31 (stable)
    199      pepper_32 (beta)
    200      pepper_canary (canary)
    201 </pre>
    202 </li>
    203 <li><p class="first">Running <code>naclsdk</code> with the &#8220;update&#8221; command again will verify that your
    204 bundles are up-to-date, or warn if you there are new versions of previously
    205 installed bundles.</p>
    206 <p>On Mac/Linux:</p>
    207 <pre class="prettyprint">
    208 $ ./naclsdk update
    209 </pre>
    210 <p>On Windows:</p>
    211 <pre class="prettyprint">
    212 &gt; naclsdk update
    213 </pre>
    214 <p>Continuing with the earlier example, you should see output similar to this:</p>
    215 <pre class="prettyprint">
    216 pepper_31 is already up-to-date.
    217 </pre>
    218 </li>
    219 <li><p class="first">To check if there is a new version of a previously installed bundle, you can
    220 run the &#8220;list&#8221; command again:</p>
    221 <pre class="prettyprint">
    222 Bundles:
    223  I: installed
    224  *: update available
    225 
    226   I  sdk_tools (stable)
    227      vs_addin (dev)
    228      pepper_27 (post_stable)
    229      pepper_28 (post_stable)
    230      pepper_29 (post_stable)
    231      pepper_30 (post_stable)
    232   I* pepper_31 (stable)
    233      pepper_32 (beta)
    234      pepper_canary (canary)
    235 </pre>
    236 <p>An asterisk next to a bundle indicates that there is an update
    237 available for that bundle. If you run  the &#8220;update&#8221; command now,
    238 <code>naclsdk</code> will warn you with a message similar to this:</p>
    239 <pre class="prettyprint">
    240 WARNING: pepper_31 already exists, but has an update available.
    241 Run update with the --force option to overwrite the existing directory.
    242 Warning: This will overwrite any modifications you have made within this directory.
    243 </pre>
    244 <p>To dowload the new version of a bundle and overwrite the existing directory
    245 for that bundle, run <code>naclsdk</code> with the <code>--force</code> option.</p>
    246 <p>On Mac/Linux:</p>
    247 <pre class="prettyprint">
    248 $ ./naclsdk update --force
    249 </pre>
    250 <p>On Windows:</p>
    251 <pre class="prettyprint">
    252 &gt; naclsdk update --force
    253 </pre>
    254 </li>
    255 <li><p class="first">For more information about the <code>naclsdk</code> utility, run:</p>
    256 <p>On Mac/Linux:</p>
    257 <pre class="prettyprint">
    258 $ ./naclsdk help
    259 </pre>
    260 <p>On Windows:</p>
    261 <pre class="prettyprint">
    262 &gt; naclsdk help
    263 </pre>
    264 </li>
    265 </ol>
    266 <p>Next steps:</p>
    267 <ul class="small-gap">
    268 <li>Browse through the <a class="reference internal" href="/native-client/sdk/release-notes.html"><em>Release Notes</em></a> for important
    269 information about the SDK and new bundles.</li>
    270 <li>If you&#8217;re just getting started with Native Client, we recommend reading
    271 the <a class="reference internal" href="/native-client/overview.html"><em>Technical Overview</em></a> and walking through the
    272 <a class="reference internal" href="/native-client/devguide/tutorial/tutorial-part1.html"><em>Getting Started Tutorial</em></a>.</li>
    273 <li>If you&#8217;d rather dive into information about the toolchains, see
    274 <a class="reference internal" href="/native-client/devguide/devcycle/building.html"><em>Building Native Client Modules</em></a>.</li>
    275 </ul>
    276 </section></section>
    277 
    278 {{/partials.standard_nacl_article}}
    279