Index: native_client_sdk/src/doc/devguide/devcycle/building.rst |
diff --git a/native_client_sdk/src/doc/devguide/devcycle/building.rst b/native_client_sdk/src/doc/devguide/devcycle/building.rst |
index 080e2b87f50210e204cba4ca85d24558f1b793ec..28fde4debc5aa1b7c7e78845461e3b37f752e2e0 100644 |
--- a/native_client_sdk/src/doc/devguide/devcycle/building.rst |
+++ b/native_client_sdk/src/doc/devguide/devcycle/building.rst |
@@ -40,10 +40,11 @@ devices you must compile separate versions of your Native Client module |
for different processors on end-user machines. A |
:ref:`manifest file <application_files>` will then specify which version |
of the module to load based on the end-user's architecture. The SDK |
-includes a script---``create_nmf.py`` (in the ``tools/`` directory)---to |
-generate manifest files. For examples of how to compile modules |
-for multiple target architectures and how to generate manifest files, see the |
-Makefiles included with the SDK examples. |
+includes a script for generating manifest files called ``create_nmf.py``. This |
+script is located in the ``pepper_<version>/tools/``, meaning under your |
JF
2014/08/15 21:17:08
in the ... directory
jpmedley
2014/08/18 14:58:23
Done.
|
+installed pepper bundle. For examples of how to compile modules for multiple |
+target architectures and how to generate manifest files, see the Makefiles |
+included with the SDK examples. |
This section will mostly cover PNaCl, but also describes how to build |
**nexe** applications. |
@@ -85,29 +86,13 @@ SDK toolchains |
The Native Client SDK includes multiple toolchains. It has one PNaCl toolchain |
and it has multiple GCC-based toolchains that are differentiated by target |
architectures and C libraries. The single PNaCl toolchain is located |
-in a directory named ``toolchain/<OS_platform>_pnacl``, and the GCC-based |
-toolchains are located in directories named |
-``toolchain/<OS_platform>_<architecture>_<library>``, where: |
- |
-* *<platform>* is the platform of your development machine (*win*, *mac*, or |
- *linux*) |
-* *<architecture>* is your target architecture (*x86* or *arm*) |
-* *<library>* is the C library you are compiling with (*newlib* or *glibc*) |
+in a directory named ``pepper_<version>/toolchain/<OS_platform>_pnacl``, |
+and the GCC-based toolchains are located in directories named |
+``pepper_<version>/toolchain/<OS_platform>_<architecture>_<library>``. |
JF
2014/08/15 21:17:08
Replace "library" with "c_library" since the defin
jpmedley
2014/08/18 14:58:23
Done.
|
The compilers, linkers, and other tools are located in the ``bin/`` |
subdirectory in each toolchain. For example, the tools in the Windows SDK |
for PNaCl has a C++ compiler in ``toolchain/win_pnacl/bin/pnacl-clang++``. |
-As another example, the GCC-based C++ compiler that targets x86 and uses the |
-newlib library, is located at ``toolchain/win_x86_newlib/bin/x86_64-nacl-g++``. |
- |
-.. Note:: |
- :class: note |
- |
- The SDK toolchains descend from the ``toolchain/`` directory. The SDK also |
- has a ``tools/`` directory; this directory contains utilities that are not |
- properly part of the toolchains but that you may find helpful in building and |
- testing your application (e.g., the ``create_nmf.py`` script, which you can |
- use to create a manifest file). |
SDK toolchains versus your hosted toolchain |
------------------------------------------- |
@@ -151,11 +136,10 @@ are used to compile and link applications into **.pexe** files. The toolchain |
also contains a tool to translate a **pexe** file into a |
architecture-specific **.nexe** (e.g., for debugging purposes). |
-Each tool's name is preceded by the prefix "pnacl-". Some of the useful |
-tools include: |
+Some of the useful tools include: |
pnacl-abicheck |
- Check that the **pexe** follows the PNaCl ABI rules. |
+ Checks that the **pexe** follows the PNaCl ABI rules. |
pnacl-ar |
Creates archives (i.e., static libraries) |
pnacl-clang |
@@ -163,7 +147,7 @@ pnacl-clang |
pnacl-clang++ |
C++ compiler and compiler driver |
pnacl-compress |
- Size compresses a finalized **pexe** file for deployment. |
+ Compresses a finalized **pexe** file for deployment. |
pnacl-dis |
Disassembler for both **pexe** files and **nexe** files |
pnacl-finalize |
@@ -178,7 +162,7 @@ pnacl-translate |
Translates a **pexe** to a native architecture, outside of the browser |
For the full list of tools, see the |
-``<NACL_SDK_ROOT>/toolchain/<platform>_pnacl/bin`` directory. |
+``pepper_<version>/toolchain/<platform>_pnacl/bin`` directory. |
Using the PNaCl tools to compile, link, debug, and deploy |
========================================================= |
@@ -191,23 +175,17 @@ Compile |
------- |
To compile a simple application consisting of ``file1.cc`` and ``file2.cc`` into |
-``hello_world.pexe`` with a single command, use the ``pnacl-clang++`` tool |
+``hello_world.pexe`` use the ``pnacl-clang++`` tool |
.. naclcode:: |
:prettyprint: 0 |
- <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-clang++ file1.cc file2.cc ^ |
- -I<NACL_SDK_ROOT>/include -L<NACL_SDK_ROOT>/lib/pnacl/Release ^ |
- -o hello_world.pexe -g -O2 -lppapi_cpp -lppapi |
- |
-(The carat ``^`` allows the command to span multiple lines on Windows; |
-to do the same on Mac and Linux use a backslash instead. Or you can |
-simply type the command and all its arguments on one |
-line. ``<NACL_SDK_ROOT>`` represents the path to the top-level |
-directory of the bundle you are using, e.g., |
-``<location-where-you-installed-the-SDK>/pepper_31``.) |
+ <NACL_SDK_ROOT>/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \ |
+ file1.cc file2.cc -I<NACL_SDK_ROOT>/pepper_<version>/include \ |
+ -L<NACL_SDK_ROOT>/pepper_<version>/lib/pnacl/Release -o hello_world.pexe \ |
+ -g -O2 -lppapi_cpp -lppapi |
-However, the typical application consists of many files. In that case, |
+The typical application consists of many files. In that case, |
each file can be compiled separately so that only files that are |
affected by a change need to be recompiled. To compile an individual |
file from your application, you must use either the ``pnacl-clang`` C |
@@ -217,8 +195,8 @@ separate bitcode files. For example: |
.. naclcode:: |
:prettyprint: 0 |
- <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-clang++ hello_world.cc ^ |
- -I<NACL_SDK_ROOT>/include -c -o hello_world.o -g -O0 |
+ <NACL_SDK_ROOT>/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \ |
+ hello_world.cc -I<NACL_SDK_ROOT>/include -c -o hello_world.o -g -O0 |
For a description of each command line flag, run ``pnacl-clang --help``. |
For convenience, here is a description of some of the flags used in |
@@ -258,8 +236,9 @@ the example. |
``-I<directory>`` |
adds a directory to the search path for **include** files. The SDK has |
- Pepper (PPAPI) headers located at ``<NACL_SDK_ROOT>/include``, so add |
- that directory when compiling to be able to include the headers. |
+ Pepper (PPAPI) headers located at ``<NACL_SDK_ROOT>/pepper_<version>/ |
+ include``, so add that directory when compiling to be able to include the |
+ headers. |
``-mllvm -inline-threshold=n`` |
change how much inlining is performed by LLVM (the default is 225, a smaller |
@@ -278,10 +257,10 @@ into the full application. |
.. naclcode:: |
:prettyprint: 0 |
- <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-ar cr libfoo.a ^ |
- foo1.o foo2.o foo3.o |
+ <NACL_SDK_ROOT>/pepper_<version>/toolchain/win_pnacl/bin/pnacl-ar cr \ |
+ libfoo.a foo1.o foo2.o foo3.o |
- <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-ranlib libfoo.a |
+ <NACL_SDK_ROOT>/pepper_<version>/toolchain/win_pnacl/bin/pnacl-ranlib libfoo.a |
Link the application |
@@ -294,16 +273,16 @@ full application. |
.. naclcode:: |
:prettyprint: 0 |
- <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-clang++ -o hello_world.pexe ^ |
- hello_world.o -L<NACL_SDK_ROOT>/lib/pnacl/Debug ^ |
+ <NACL_SDK_ROOT>/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \ |
+ -o hello_world.pexe hello_world.o -L<NACL_SDK_ROOT>/lib/pnacl/Debug \ |
-lfoo -lppapi_cpp -lppapi |
This links the hello world bitcode with the ``foo`` library in the example |
as well as the *Debug* version of the Pepper libraries which are located |
-in ``<NACL_SDK_ROOT>/lib/pnacl/Debug``. If you wish to link against the |
-*Release* version of the Pepper libraries, change the |
-``-L<NACL_SDK_ROOT>/lib/pnacl/Debug`` to |
-``-L<NACL_SDK_ROOT>/lib/pnacl/Release``. |
+in ``<NACL_SDK_ROOT>/pepper_<version>/lib/pnacl/Debug``. If you wish to link |
+against the *Release* version of the Pepper libraries, change the |
+``-L<NACL_SDK_ROOT>/pepper_<version>/lib/pnacl/Debug`` to |
+``-L<NACL_SDK_ROOT>/pepper_<version>/lib/pnacl/Release``. |
In a release build you'll want to pass ``-O2`` to the compiler *as well as to |
the linker* to enable link-time optimizations. This reduces the size and |
@@ -313,8 +292,8 @@ and on-device translation. |
.. naclcode:: |
:prettyprint: 0 |
- <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-clang++ -o hello_world.pexe ^ |
- hello_world.o -L<NACL_SDK_ROOT>/lib/pnacl/Release ^ |
+ <NACL_SDK_ROOT>/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \ |
+ -o hello_world.pexe hello_world.o -L<NACL_SDK_ROOT>/lib/pnacl/Release \ |
-lfoo -lppapi_cpp -lppapi -O2 |
By default the link step will turn all C++ exceptions into calls to ``abort()`` |
@@ -336,7 +315,7 @@ debugging techniques and workflow. After testing a PNaCl application, you must |
.. naclcode:: |
:prettyprint: 0 |
- <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-finalize ^ |
+ <NACL_SDK_ROOT>/pepper_<version>/toolchain/win_pnacl/bin/pnacl-finalize \ |
hello_world.pexe -o hello_world.final.pexe |
Prior to finalization, the application **pexe** is stored in a binary |
@@ -372,7 +351,7 @@ appications). Hence, this step is optional. |
.. naclcode:: |
:prettyprint: 0 |
- <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-compress ^ |
+ <NACL_SDK_ROOT>/pepper_<version>/toolchain/win_pnacl/bin/pnacl-compress \ |
hello_world.final.pexe |
``pnacl-compress`` must be called after a **pexe** file has been finalized for |
@@ -451,9 +430,10 @@ for the hello_world example with the following command: |
.. naclcode:: |
:prettyprint: 0 |
- <NACL_SDK_ROOT>/toolchain/win_x86_newlib/bin/i686-nacl-gcc hello_world.c ^ |
- -I<NACL_SDK_ROOT>/include -L<NACL_SDK_ROOT>/lib/newlib/Release ^ |
- -o hello_world_x86_32.nexe -m32 -g -O2 -lppapi |
+ <NACL_SDK_ROOT>/pepper_<version>/toolchain/win_x86_newlib/bin/i686-nacl-gcc \ |
+ hello_world.c -I<NACL_SDK_ROOT>/pepper_<version>/include \ |
+ -L<NACL_SDK_ROOT>/lib/newlib/Release -o hello_world_x86_32.nexe \ |
+ -m32 -g -O2 -lppapi |
To compile a 64-bit **.nexe**, you can run the same command but use -m64 instead |
of -m32. Alternatively, you could also use the version of the compiler that |
@@ -562,7 +542,8 @@ Libraries and header files provided with the SDK |
The Native Client SDK includes modified versions of standard toolchain-support |
libraries, such as libpthread and libc, plus the relevant header files. |
-The standard libraries are located in the following directories: |
+The standard libraries are located under the ``/pepper_<version>`` directory |
+in the following locations: |
* PNaCl toolchain: ``toolchain/<platform>_pnacl/usr/lib`` |
* x86 toolchains: ``toolchain/<platform>_x86_<library>/x86_64-nacl/lib32`` and |
@@ -636,7 +617,7 @@ libppapi_simple.a |
<http://code.google.com/p/naclports/>`_, or port the library yourself. |
* The order in which you list libraries in your build commands is important, |
since the linker searches and processes libraries in the order in which they |
- are specified. See the \*_LDFLAGS variables in the Makefiles of the SDK |
+ are specified. See the ``\*_LDFLAGS`` variables in the Makefiles of the SDK |
examples for the order in which specific libraries should be listed. |
Troubleshooting |
@@ -678,8 +659,9 @@ Here is one way to find the appropriate library for a given symbol: |
.. naclcode:: |
:prettyprint: 0 |
- <NACL_SDK_ROOT>/toolchain/<platform>_pnacl/bin/pnacl-nm -o \ |
- toolchain/<platform>_pnacl/usr/lib/*.a | grep <MySymbolName> |
+ <NACL_SDK_ROOT>/pepper_<version>/toolchain/<platform>_pnacl/bin/pnacl-nm -o \ |
+ <NACL_SDK_ROOT>/pepper_<version>toolchain/<platform>_pnacl/usr/lib/*.a | \ |
+ grep <MySymbolName> |
PNaCl ABI Verification errors |