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