| OLD | NEW |
| 1 .. _devcycle-building: | 1 .. _devcycle-building: |
| 2 | 2 |
| 3 ######## | 3 ######## |
| 4 Building | 4 Building |
| 5 ######## | 5 ######## |
| 6 | 6 |
| 7 .. contents:: Table Of Contents | 7 .. contents:: Table Of Contents |
| 8 :local: | 8 :local: |
| 9 :backlinks: none | 9 :backlinks: none |
| 10 :depth: 2 | 10 :depth: 2 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 your installed pepper bundle. For examples of how to compile modules for | 45 your installed pepper bundle. For examples of how to compile modules for |
| 46 multiple target architectures and how to generate manifest files, see the | 46 multiple target architectures and how to generate manifest files, see the |
| 47 Makefiles included with the SDK examples. | 47 Makefiles included with the SDK examples. |
| 48 | 48 |
| 49 This section will mostly cover PNaCl, but also describes how to build | 49 This section will mostly cover PNaCl, but also describes how to build |
| 50 **nexe** applications. | 50 **nexe** applications. |
| 51 | 51 |
| 52 C libraries | 52 C libraries |
| 53 ----------- | 53 ----------- |
| 54 | 54 |
| 55 The PNaCl SDK has a single choice of C library: newlib_. | 55 The PNaCl toolchain uses the newlib_ C library and can be used to build |
| 56 | 56 portable **pexe** files (using ``pnacl-clang``) or **nexe** files (using, for |
| 57 The Native Client SDK also has a GCC-based toolchain for building | 57 example, ``x86_64-nacl-clang``). The Native Client SDK also has a |
| 58 **nexes**. The GCC-based toolchain has support for two C libraries: | 58 GCC-based toolchain for building **nexe** files which uses the glibc_ C library. |
| 59 newlib_ and glibc_. See :doc:`Dynamic Linking & Loading with glibc | 59 See :doc:`Dynamic Linking & Loading with glibc <dynamic-loading>` for |
| 60 <dynamic-loading>` for information about these libraries, including factors to | 60 information about these libraries, including factors to help you decide which to |
| 61 help you decide which to use. | 61 use. |
| 62 | 62 |
| 63 .. _building_cpp_libraries: | 63 .. _building_cpp_libraries: |
| 64 | 64 |
| 65 C++ standard libraries | 65 C++ standard libraries |
| 66 ---------------------- | 66 ---------------------- |
| 67 | 67 |
| 68 The PNaCl SDK can use either LLVM's `libc++ <http://libcxx.llvm.org/>`_ | 68 The PNaCl SDK can use either LLVM's `libc++ <http://libcxx.llvm.org/>`_ |
| 69 (the current default) or GCC's `libstdc++ | 69 (the current default) or GCC's `libstdc++ |
| 70 <http://gcc.gnu.org/libstdc++>`_ (deprecated). The | 70 <http://gcc.gnu.org/libstdc++>`_ (deprecated). The |
| 71 ``-stdlib=[libc++|libstdc++]`` command line argument can be used to | 71 ``-stdlib=[libc++|libstdc++]`` command line argument can be used to |
| 72 choose which standard library to use. | 72 choose which standard library to use. |
| 73 | 73 |
| 74 The GCC-based Native Client SDK only has support for GCC's `libstdc++ | 74 The GCC-based toolchain only has support for GCC's `libstdc++ |
| 75 <http://gcc.gnu.org/libstdc++>`_. | 75 <http://gcc.gnu.org/libstdc++>`_. |
| 76 | 76 |
| 77 C++11 library support is only complete in libc++ but other non-library language | 77 C++11 library support is only complete in libc++ but other non-library language |
| 78 features should work regardless of which standard library is used. The | 78 features should work regardless of which standard library is used. The |
| 79 ``-std=gnu++11`` command line argument can be used to indicate which C++ | 79 ``-std=gnu++11`` command line argument can be used to indicate which C++ |
| 80 language standard to use (``-std=c++11`` often doesn't work well because newlib | 80 language standard to use (``-std=c++11`` often doesn't work well because newlib |
| 81 relies on some GNU extensions). | 81 relies on some GNU extensions). |
| 82 | 82 |
| 83 SDK toolchains | 83 SDK toolchains |
| 84 -------------- | 84 -------------- |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 438 |
| 439 | 439 |
| 440 Compiling | 440 Compiling |
| 441 --------- | 441 --------- |
| 442 | 442 |
| 443 Compiling files with the GNU-based toolchain is similar to compiling | 443 Compiling files with the GNU-based toolchain is similar to compiling |
| 444 files with the PNaCl-based toolchain, except that the output is | 444 files with the PNaCl-based toolchain, except that the output is |
| 445 architecture specific. | 445 architecture specific. |
| 446 | 446 |
| 447 For example, assuming you're developing on a Windows machine, targeting the x86 | 447 For example, assuming you're developing on a Windows machine, targeting the x86 |
| 448 architecture, and using the newlib library, you can compile a 32-bit **.nexe** | 448 architecture you can compile a 32-bit **.nexe** for the hello_world example with |
| 449 for the hello_world example with the following command: | 449 the following command: |
| 450 | 450 |
| 451 .. naclcode:: | 451 .. naclcode:: |
| 452 :prettyprint: 0 | 452 :prettyprint: 0 |
| 453 | 453 |
| 454 nacl_sdk/pepper_<version>/toolchain/win_x86_newlib/bin/i686-nacl-gcc \ | 454 nacl_sdk/pepper_<version>/toolchain/win_x86_glibc/bin/i686-nacl-gcc \ |
| 455 hello_world.c -Inacl_sdk/pepper_<version>/include \ | 455 hello_world.c -Inacl_sdk/pepper_<version>/include \ |
| 456 -Lnacl_sdk/pepper_<version>/lib/newlib/Release -o hello_world_x86_32.nexe \ | 456 -Lnacl_sdk/pepper_<version>/lib/glibc/Release -o hello_world_x86_32.nexe \ |
| 457 -m32 -g -O2 -lppapi | 457 -m32 -g -O2 -lppapi |
| 458 | 458 |
| 459 To compile a 64-bit **.nexe**, you can run the same command but use -m64 instead | 459 To compile a 64-bit **.nexe**, you can run the same command but use -m64 instead |
| 460 of -m32. Alternatively, you could also use the version of the compiler that | 460 of -m32. Alternatively, you could also use the version of the compiler that |
| 461 targets the x86-64 architecture, i.e., ``x86_64-nacl-gcc``. | 461 targets the x86-64 architecture, i.e., ``x86_64-nacl-gcc``. |
| 462 | 462 |
| 463 You should name executable modules with a **.nexe** filename extension, | 463 You should name executable modules with a **.nexe** filename extension, |
| 464 regardless of what platform you're using. | 464 regardless of what platform you're using. |
| 465 | 465 |
| 466 Creating libraries and Linking | 466 Creating libraries and Linking |
| (...skipping 22 matching lines...) Expand all Loading... |
| 489 ========== | 489 ========== |
| 490 | 490 |
| 491 This document doesn't cover how to use ``make``, but if you want to use | 491 This document doesn't cover how to use ``make``, but if you want to use |
| 492 ``make`` to build your Native Client module, you can base your Makefile on the | 492 ``make`` to build your Native Client module, you can base your Makefile on the |
| 493 ones in the SDK examples. | 493 ones in the SDK examples. |
| 494 | 494 |
| 495 The Makefiles for the SDK examples build most of the examples in multiple | 495 The Makefiles for the SDK examples build most of the examples in multiple |
| 496 configurations (using PNaCl vs NaCl, using different C libraries, | 496 configurations (using PNaCl vs NaCl, using different C libraries, |
| 497 targeting different architectures, and using different levels of optimization). | 497 targeting different architectures, and using different levels of optimization). |
| 498 To select a specific toolchain, set the **environment variable** | 498 To select a specific toolchain, set the **environment variable** |
| 499 ``TOOLCHAIN`` to either ``pnacl``, ``newlib``, ``glibc``, or ``host``. | 499 ``TOOLCHAIN`` to either ``pnacl``, ``clang-newlib``, ``glibc``, or ``host``. |
| 500 To select a specific level of optimization set the **environment | 500 To select a specific level of optimization set the **environment |
| 501 variable** ``CONFIG`` to either ``Debug``, or ``Release``. Running | 501 variable** ``CONFIG`` to either ``Debug``, or ``Release``. Running |
| 502 ``make`` in each example's directory does **one** of the following, | 502 ``make`` in each example's directory does **one** of the following, |
| 503 depending on the setting of the environment variables. | 503 depending on the setting of the environment variables. |
| 504 | 504 |
| 505 * If ``TOOLCHAIN=pnacl`` creates a subdirectory called ``pnacl``; | 505 * If ``TOOLCHAIN=pnacl`` creates a subdirectory called ``pnacl``; |
| 506 | 506 |
| 507 * builds a **.pexe** (architecture-independent Native Client executable) using | 507 * builds a **.pexe** (architecture-independent Native Client executable) using |
| 508 the newlib library | 508 the newlib library |
| 509 * generates a Native Client manifest (.nmf) file for the pnacl version of the | 509 * generates a Native Client manifest (.nmf) file for the pnacl version of the |
| 510 example | 510 example |
| 511 | 511 |
| 512 * If ``TOOLCHAIN=newlib`` creates a subdirectory called ``newlib``; | 512 * If ``TOOLCHAIN=clang-newlib`` creates a subdirectory called ``clang-newlib``; |
| 513 | 513 |
| 514 * builds **.nexes** for the x86-32, x86-64, and ARM architectures using the | 514 * builds **.nexes** for the x86-32, x86-64, and ARM architectures using the |
| 515 newlib library | 515 nacl-clang toolchain and the newlib C library |
| 516 * generates a Native Client manifest (.nmf) file for the newlib version of | 516 * generates a Native Client manifest (.nmf) file for the clang-newlib version |
| 517 the example | 517 of the example |
| 518 | 518 |
| 519 * If ``TOOLCHAIN=glibc`` creates a subdirectory called ``glibc``; | 519 * If ``TOOLCHAIN=glibc`` creates a subdirectory called ``glibc``; |
| 520 | 520 |
| 521 * builds **.nexes** for the x86-32 and x86-64 architectures using the glibc | 521 * builds **.nexes** for the x86-32, x86-64 and ARM architectures using the |
| 522 library | 522 glibc library |
| 523 * generates a Native Client manifest (.nmf) file for the glibc version of the | 523 * generates a Native Client manifest (.nmf) file for the glibc version of the |
| 524 example | 524 example |
| 525 | 525 |
| 526 * If ``TOOLCHAIN=host`` creates a subdirectory called ``windows``, ``linux``, | 526 * If ``TOOLCHAIN=host`` creates a subdirectory called ``windows``, ``linux``, |
| 527 or ``mac`` (depending on your development machine); | 527 or ``mac`` (depending on your development machine); |
| 528 | 528 |
| 529 * builds a Pepper plugin (.dll for Windows, .so for Linux/Mac) using the | 529 * builds a Pepper plugin (.dll for Windows, .so for Linux/Mac) using the |
| 530 hosted toolchain on your development machine | 530 hosted toolchain on your development machine |
| 531 * generates a Native Client manifest (.nmf) file for the host Pepper plugin | 531 * generates a Native Client manifest (.nmf) file for the host Pepper plugin |
| 532 version of the example | 532 version of the example |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 libraries, such as libpthread and libc, plus the relevant header files. | 565 libraries, such as libpthread and libc, plus the relevant header files. |
| 566 The standard libraries are located under the ``/pepper_<version>`` directory | 566 The standard libraries are located under the ``/pepper_<version>`` directory |
| 567 in the following locations: | 567 in the following locations: |
| 568 | 568 |
| 569 * PNaCl toolchain: ``toolchain/<platform>_pnacl/usr/lib`` | 569 * PNaCl toolchain: ``toolchain/<platform>_pnacl/usr/lib`` |
| 570 * x86 toolchains: ``toolchain/<platform>_x86_<c_library>/x86_64-nacl/lib32`` and | 570 * x86 toolchains: ``toolchain/<platform>_x86_<c_library>/x86_64-nacl/lib32`` and |
| 571 ``/lib64`` (for the 32-bit and 64-bit target architectures, respectively) | 571 ``/lib64`` (for the 32-bit and 64-bit target architectures, respectively) |
| 572 * ARM toolchain: ``toolchain/<platform>_arm_<c_library>/arm-nacl/lib`` | 572 * ARM toolchain: ``toolchain/<platform>_arm_<c_library>/arm-nacl/lib`` |
| 573 | 573 |
| 574 For example, on Windows, the libraries for the x86-64 architecture in the | 574 For example, on Windows, the libraries for the x86-64 architecture in the |
| 575 newlib toolchain are in ``toolchain/win_x86_newlib/x86_64-nacl/lib64``. | 575 glibc toolchain are in ``toolchain/win_x86_glibc/x86_64-nacl/lib64``. |
| 576 | 576 |
| 577 The header files are in: | 577 The header files are in: |
| 578 | 578 |
| 579 * PNaCl toolchain: ``toolchain/<platform>_pnacl/usr/include`` | 579 * PNaCl toolchain: ``toolchain/<platform>_pnacl/le32-nacl/include`` |
| 580 * x86 toolchains: ``toolchain/<platform>_x86_<c_library>/x86_64-nacl/include`` | 580 * clang newlib toolchains: ``toolchain/<platform>_pnacl/<arch>-nacl/include`` |
| 581 * ARM toolchain: ``toolchain/<platform>_arm_<c_library>/arm-nacl/include`` | 581 * x86 glibc toolchain: ``toolchain/<platform>_x86_glibc/x86_64-nacl/include`` |
| 582 * ARM glibc toolchain: ``toolchain/<platform>_arm_glibc/arm-nacl/include`` |
| 582 | 583 |
| 583 Many other libraries have been ported for use with Native Client; for more | 584 Many other libraries have been ported for use with Native Client; for more |
| 584 information, see the `webports <https://chromium.googlesource.com/webports>`_ | 585 information, see the `webports <https://chromium.googlesource.com/webports>`_ |
| 585 project. If you port an open-source library for your own use, we recommend | 586 project. If you port an open-source library for your own use, we recommend |
| 586 adding it to webports. | 587 adding it to webports. |
| 587 | 588 |
| 588 Besides the standard libraries, the SDK includes Pepper libraries. | 589 Besides the standard libraries, the SDK includes Pepper libraries. |
| 589 The PNaCl Pepper libraries are located in the the | 590 The PNaCl Pepper libraries are located in the the |
| 590 ``nacl_sdk/pepper_<version>/lib/pnacl/<Release or Debug>`` directory. | 591 ``nacl_sdk/pepper_<version>/lib/pnacl/<Release or Debug>`` directory. |
| 591 The GNU-based toolchain has Pepper libraries in | 592 The GNU-based toolchain has Pepper libraries in |
| 592 ``nacl_sdk/pepper_<version>/lib/newlib_<arch>/<Release or Debug>`` | 593 ``nacl_sdk/pepper_<version>/lib/glibc_<arch>/<Release or Debug>`` |
| 593 and ``nacl_sdk/pepper_<version>/lib/glibc_<arch>/<Release or Debug>``. | 594 and ``nacl_sdk/pepper_<version>/lib/clang-newlib_<arch>/<Release or Debug>``. |
| 594 The libraries provided by the SDK allow the application to use Pepper, | 595 The libraries provided by the SDK allow the application to use Pepper, |
| 595 as well as convenience libraries to simplify porting an application that | 596 as well as convenience libraries to simplify porting an application that |
| 596 uses POSIX functions. Here are descriptions of the Pepper libraries provided | 597 uses POSIX functions. Here are descriptions of the Pepper libraries provided |
| 597 in the SDK. | 598 in the SDK. |
| 598 | 599 |
| 599 .. _devcycle-building-nacl-io: | 600 .. _devcycle-building-nacl-io: |
| 600 | 601 |
| 601 libppapi.a | 602 libppapi.a |
| 602 Implements the Pepper (PPAPI) C interface. Needed for all applications that | 603 Implements the Pepper (PPAPI) C interface. Needed for all applications that |
| 603 use Pepper (even C++ applications). | 604 use Pepper (even C++ applications). |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 Function foo has disallowed type: i128 (i128) | 714 Function foo has disallowed type: i128 (i128) |
| 714 LLVM ERROR: PNaCl ABI verification failed | 715 LLVM ERROR: PNaCl ABI verification failed |
| 715 | 716 |
| 716 When faced with a PNaCl ABI verification error, check the list of features | 717 When faced with a PNaCl ABI verification error, check the list of features |
| 717 that are :ref:`not supported by PNaCl <when-to-use-nacl>`. | 718 that are :ref:`not supported by PNaCl <when-to-use-nacl>`. |
| 718 If the problem you face is not listed as restricted, | 719 If the problem you face is not listed as restricted, |
| 719 :ref:`let us know <help>`! | 720 :ref:`let us know <help>`! |
| 720 | 721 |
| 721 .. _glibc: http://www.gnu.org/software/libc/ | 722 .. _glibc: http://www.gnu.org/software/libc/ |
| 722 .. _newlib: http://sourceware.org/newlib/ | 723 .. _newlib: http://sourceware.org/newlib/ |
| OLD | NEW |