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