OLD | NEW |
1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
2 | 2 |
3 <section id="building"> | 3 <section id="building"> |
4 <span id="devcycle-building"></span><h1 id="building"><span id="devcycle-buildin
g"></span>Building</h1> | 4 <span id="devcycle-building"></span><h1 id="building"><span id="devcycle-buildin
g"></span>Building</h1> |
5 <div class="contents local" id="table-of-contents" style="display: none"> | 5 <div class="contents local" id="table-of-contents" style="display: none"> |
6 <p class="topic-title first">Table Of Contents</p> | 6 <p class="topic-title first">Table Of Contents</p> |
7 <ul class="small-gap"> | 7 <ul class="small-gap"> |
8 <li><p class="first"><a class="reference internal" href="#introduction" id="id4"
>Introduction</a></p> | 8 <li><p class="first"><a class="reference internal" href="#introduction" id="id4"
>Introduction</a></p> |
9 <ul class="small-gap"> | 9 <ul class="small-gap"> |
10 <li><a class="reference internal" href="#target-architectures" id="id5">Target a
rchitectures</a></li> | 10 <li><a class="reference internal" href="#target-architectures" id="id5">Target a
rchitectures</a></li> |
11 <li><a class="reference internal" href="#c-libraries" id="id6">C libraries</a></
li> | 11 <li><a class="reference internal" href="#c-libraries" id="id6">C libraries</a></
li> |
12 <li><a class="reference internal" href="#c-standard-libraries" id="id7">C++ stan
dard libraries</a></li> | 12 <li><a class="reference internal" href="#c-standard-libraries" id="id7">C++ stan
dard libraries</a></li> |
13 <li><a class="reference internal" href="#sdk-toolchains" id="id8">SDK toolchains
</a></li> | 13 <li><a class="reference internal" href="#sdk-toolchains" id="id8">SDK toolchains
</a></li> |
14 <li><a class="reference internal" href="#sdk-toolchains-versus-your-hosted-toolc
hain" id="id9">SDK toolchains versus your hosted toolchain</a></li> | 14 <li><a class="reference internal" href="#sdk-toolchains-versus-your-hosted-toolc
hain" id="id9">SDK toolchains versus your hosted toolchain</a></li> |
15 </ul> | 15 </ul> |
16 </li> | 16 </li> |
17 <li><a class="reference internal" href="#the-pnacl-toolchain" id="id10">The PNaC
l toolchain</a></li> | 17 <li><a class="reference internal" href="#the-pnacl-toolchain" id="id10">The PNaC
l toolchain</a></li> |
18 <li><p class="first"><a class="reference internal" href="#using-the-pnacl-tools-
to-compile-link-debug-and-deploy" id="id11">Using the PNaCl tools to compile, li
nk, debug, and deploy</a></p> | 18 <li><p class="first"><a class="reference internal" href="#using-the-pnacl-tools-
to-compile-link-debug-and-deploy" id="id11">Using the PNaCl tools to compile, li
nk, debug, and deploy</a></p> |
19 <ul class="small-gap"> | 19 <ul class="small-gap"> |
20 <li><a class="reference internal" href="#compile" id="id12">Compile</a></li> | 20 <li><a class="reference internal" href="#compile" id="id12">Compile</a></li> |
21 <li><a class="reference internal" href="#create-a-static-library" id="id13">Crea
te a static library</a></li> | 21 <li><a class="reference internal" href="#create-a-static-library" id="id13">Crea
te a static library</a></li> |
22 <li><a class="reference internal" href="#link-the-application" id="id14">Link th
e application</a></li> | 22 <li><a class="reference internal" href="#link-the-application" id="id14">Link th
e application</a></li> |
23 <li><a class="reference internal" href="#finalizing-the-pexe-for-deployment" id=
"id15">Finalizing the <strong>pexe</strong> for deployment</a></li> | 23 <li><a class="reference internal" href="#finalizing-the-pexe-for-deployment" id=
"id15">Finalizing the <strong>pexe</strong> for deployment</a></li> |
| 24 <li><a class="reference internal" href="#compressing-the-pexe-for-deployment" id
="id16">Compressing the <strong>pexe</strong> for deployment</a></li> |
24 </ul> | 25 </ul> |
25 </li> | 26 </li> |
26 <li><p class="first"><a class="reference internal" href="#the-gnu-based-toolchai
ns" id="id16">The GNU-based toolchains</a></p> | 27 <li><p class="first"><a class="reference internal" href="#the-gnu-based-toolchai
ns" id="id17">The GNU-based toolchains</a></p> |
27 <ul class="small-gap"> | 28 <ul class="small-gap"> |
28 <li><a class="reference internal" href="#compiling" id="id17">Compiling</a></li> | 29 <li><a class="reference internal" href="#compiling" id="id18">Compiling</a></li> |
29 <li><a class="reference internal" href="#creating-libraries-and-linking" id="id1
8">Creating libraries and Linking</a></li> | 30 <li><a class="reference internal" href="#creating-libraries-and-linking" id="id1
9">Creating libraries and Linking</a></li> |
30 <li><a class="reference internal" href="#finalizing-a-nexe-for-deployment" id="i
d19">Finalizing a <strong>nexe</strong> for deployment</a></li> | 31 <li><a class="reference internal" href="#finalizing-a-nexe-for-deployment" id="i
d20">Finalizing a <strong>nexe</strong> for deployment</a></li> |
31 </ul> | 32 </ul> |
32 </li> | 33 </li> |
33 <li><a class="reference internal" href="#using-make" id="id20">Using make</a></l
i> | 34 <li><a class="reference internal" href="#using-make" id="id21">Using make</a></l
i> |
34 <li><a class="reference internal" href="#libraries-and-header-files-provided-wit
h-the-sdk" id="id21">Libraries and header files provided with the SDK</a></li> | 35 <li><a class="reference internal" href="#libraries-and-header-files-provided-wit
h-the-sdk" id="id22">Libraries and header files provided with the SDK</a></li> |
35 <li><p class="first"><a class="reference internal" href="#troubleshooting" id="i
d22">Troubleshooting</a></p> | 36 <li><p class="first"><a class="reference internal" href="#troubleshooting" id="i
d23">Troubleshooting</a></p> |
36 <ul class="small-gap"> | 37 <ul class="small-gap"> |
37 <li><a class="reference internal" href="#undefined-reference-error" id="id23">&#
8220;Undefined reference” error</a></li> | 38 <li><a class="reference internal" href="#undefined-reference-error" id="id24">&#
8220;Undefined reference” error</a></li> |
38 <li><a class="reference internal" href="#can-t-find-libraries-containing-necessa
ry-symbols" id="id24">Can’t find libraries containing necessary symbols</a
></li> | 39 <li><a class="reference internal" href="#can-t-find-libraries-containing-necessa
ry-symbols" id="id25">Can’t find libraries containing necessary symbols</a
></li> |
39 <li><a class="reference internal" href="#pnacl-abi-verification-errors" id="id25
">PNaCl ABI Verification errors</a></li> | 40 <li><a class="reference internal" href="#pnacl-abi-verification-errors" id="id26
">PNaCl ABI Verification errors</a></li> |
40 </ul> | 41 </ul> |
41 </li> | 42 </li> |
42 </ul> | 43 </ul> |
43 | 44 |
44 </div><section id="introduction"> | 45 </div><section id="introduction"> |
45 <h2 id="introduction">Introduction</h2> | 46 <h2 id="introduction">Introduction</h2> |
46 <p>This document describes how to build Native Client modules. It is intended fo
r | 47 <p>This document describes how to build Native Client modules. It is intended fo
r |
47 developers who have experience writing, compiling, and linking C and C++ code. | 48 developers who have experience writing, compiling, and linking C and C++ code. |
48 If you haven’t read the Native Client <a class="reference internal" href="
/native-client/overview.html"><em>Technical Overview</em></a> and <a class="refe
rence internal" href="/native-client/devguide/tutorial/index.html"><em>Tutorial<
/em></a>, we recommend starting | 49 If you haven’t read the Native Client <a class="reference internal" href="
/native-client/overview.html"><em>Technical Overview</em></a> and <a class="refe
rence internal" href="/native-client/devguide/tutorial/index.html"><em>Tutorial<
/em></a>, we recommend starting |
49 with those.</p> | 50 with those.</p> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 tools include:</p> | 153 tools include:</p> |
153 <dl class="docutils"> | 154 <dl class="docutils"> |
154 <dt>pnacl-abicheck</dt> | 155 <dt>pnacl-abicheck</dt> |
155 <dd>Check that the <strong>pexe</strong> follows the PNaCl ABI rules.</dd> | 156 <dd>Check that the <strong>pexe</strong> follows the PNaCl ABI rules.</dd> |
156 <dt>pnacl-ar</dt> | 157 <dt>pnacl-ar</dt> |
157 <dd>Creates archives (i.e., static libraries)</dd> | 158 <dd>Creates archives (i.e., static libraries)</dd> |
158 <dt>pnacl-clang</dt> | 159 <dt>pnacl-clang</dt> |
159 <dd>C compiler and compiler driver</dd> | 160 <dd>C compiler and compiler driver</dd> |
160 <dt>pnacl-clang++</dt> | 161 <dt>pnacl-clang++</dt> |
161 <dd>C++ compiler and compiler driver</dd> | 162 <dd>C++ compiler and compiler driver</dd> |
| 163 <dt>pnacl-compress</dt> |
| 164 <dd>Size compresses a finalized <strong>pexe</strong> file for deployment.</dd> |
162 <dt>pnacl-dis</dt> | 165 <dt>pnacl-dis</dt> |
163 <dd>Disassembler for both <strong>pexe</strong> files and <strong>nexe</strong>
files</dd> | 166 <dd>Disassembler for both <strong>pexe</strong> files and <strong>nexe</strong>
files</dd> |
164 <dt>pnacl-finalize</dt> | 167 <dt>pnacl-finalize</dt> |
165 <dd>Finalizes <strong>pexe</strong> files for deployment</dd> | 168 <dd>Finalizes <strong>pexe</strong> files for deployment</dd> |
166 <dt>pnacl-ld</dt> | 169 <dt>pnacl-ld</dt> |
167 <dd>Bitcode linker</dd> | 170 <dd>Bitcode linker</dd> |
168 <dt>pnacl-nm</dt> | 171 <dt>pnacl-nm</dt> |
169 <dd>Lists symbols in bitcode files, native code, and libraries</dd> | 172 <dd>Lists symbols in bitcode files, native code, and libraries</dd> |
170 <dt>pnacl-ranlib</dt> | 173 <dt>pnacl-ranlib</dt> |
171 <dd>Generates a symbol table for archives (i.e., static libraries)</dd> | 174 <dd>Generates a symbol table for archives (i.e., static libraries)</dd> |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 <p>Prior to finalization, the application <strong>pexe</strong> is stored in a b
inary | 282 <p>Prior to finalization, the application <strong>pexe</strong> is stored in a b
inary |
280 format that is subject to change. After finalization, the application | 283 format that is subject to change. After finalization, the application |
281 pexe is <strong>rewritten</strong> into a different binary format that is <stron
g>stable</strong> | 284 pexe is <strong>rewritten</strong> into a different binary format that is <stron
g>stable</strong> |
282 and will be supported by future versions of PNaCl. The finalization step | 285 and will be supported by future versions of PNaCl. The finalization step |
283 also helps minimize the size of your application for distribution by | 286 also helps minimize the size of your application for distribution by |
284 stripping out debug information and other metadata.</p> | 287 stripping out debug information and other metadata.</p> |
285 <p>Once the application is finalized, be sure to adjust the manifest file to | 288 <p>Once the application is finalized, be sure to adjust the manifest file to |
286 refer to the final version of the application before deployment. | 289 refer to the final version of the application before deployment. |
287 The <code>create_nmf.py</code> tool helps generate an <code>.nmf</code> file, bu
t <code>.nmf</code> | 290 The <code>create_nmf.py</code> tool helps generate an <code>.nmf</code> file, bu
t <code>.nmf</code> |
288 files can also be written by hand.</p> | 291 files can also be written by hand.</p> |
| 292 </section><section id="compressing-the-pexe-for-deployment"> |
| 293 <h3 id="compressing-the-pexe-for-deployment">Compressing the <strong>pexe</stron
g> for deployment</h3> |
| 294 <p>Size compression is an optional step for deployment, and reduces the |
| 295 size of the pexe file that must be transmitted over the wire. The tool |
| 296 <code>pnacl-compress</code> applies compression strategies that are already buil
t |
| 297 into the <strong>stable</strong> binary format of a pexe application. As such, |
| 298 compressed pexe files do not need any extra time to be decompressed on |
| 299 the client’s side. All costs are upfront when you call <code>pnacl-compres
s</code>.</p> |
| 300 <p>Currently, this tool will compress pexe files by about 25%. However, |
| 301 it is somewhat slow (can take from seconds to minutes on large |
| 302 appications). Hence, this step is optional.</p> |
| 303 <pre> |
| 304 <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-compress ^ |
| 305 hello_world.final.pexe |
| 306 </pre> |
| 307 <p>Tool <code>pnacl-compress</code> must be called after a pexe file has been fi
nalized |
| 308 for deployment (via <code>pnacl-finalize</code>). Alternatively, you can apply t
his |
| 309 step as part of the finalizing step by adding the <code>--compress</code> flag |
| 310 to the pnacl-finalize command line.</p> |
| 311 <p>Note that this compression step doesn’t replace gzip. This compression |
| 312 step is in addition to gzipping a file for deployment. One should note |
| 313 that while the gzipped version of a compressed pexe file is still |
| 314 smaller than the corresponding uncompressed pexe file, the gains is |
| 315 somewhat smaller after being gzipped. Expected reduction in size |
| 316 (after being gzipped) is more like 7.5% to 10%.</p> |
289 </section></section><section id="the-gnu-based-toolchains"> | 317 </section></section><section id="the-gnu-based-toolchains"> |
290 <h2 id="the-gnu-based-toolchains">The GNU-based toolchains</h2> | 318 <h2 id="the-gnu-based-toolchains">The GNU-based toolchains</h2> |
291 <p>Besides the PNaCl toolchain, the Native Client SDK also includes modified | 319 <p>Besides the PNaCl toolchain, the Native Client SDK also includes modified |
292 versions of the tools in the standard GNU toolchain, including the GCC | 320 versions of the tools in the standard GNU toolchain, including the GCC |
293 compilers and the linkers and other tools from binutils. These tools only | 321 compilers and the linkers and other tools from binutils. These tools only |
294 support building <strong>nexe</strong> files. Run the tool with the <code>--vers
ion</code> | 322 support building <strong>nexe</strong> files. Run the tool with the <code>--vers
ion</code> |
295 command line flag to determine the current version of the tools.</p> | 323 command line flag to determine the current version of the tools.</p> |
296 <p>Each tool in the toolchain is prefixed with the name of the target | 324 <p>Each tool in the toolchain is prefixed with the name of the target |
297 architecture. In the toolchain for the ARM target architecture, each | 325 architecture. In the toolchain for the ARM target architecture, each |
298 tool’s name is preceded by the prefix “arm-nacl-”. In the tool
chains for | 326 tool’s name is preceded by the prefix “arm-nacl-”. In the tool
chains for |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 Function foo has disallowed type: i128 (i128) | 589 Function foo has disallowed type: i128 (i128) |
562 LLVM ERROR: PNaCl ABI verification failed | 590 LLVM ERROR: PNaCl ABI verification failed |
563 </pre> | 591 </pre> |
564 <p>When faced with a PNaCl ABI verification error, check the list of features | 592 <p>When faced with a PNaCl ABI verification error, check the list of features |
565 that are <a class="reference internal" href="/native-client/nacl-and-pnacl.html#
when-to-use-nacl"><em>not supported by PNaCl</em></a>. | 593 that are <a class="reference internal" href="/native-client/nacl-and-pnacl.html#
when-to-use-nacl"><em>not supported by PNaCl</em></a>. |
566 If the problem you face is not listed as restricted, | 594 If the problem you face is not listed as restricted, |
567 <a class="reference internal" href="/native-client/help.html#help"><em>let us kn
ow</em></a>!</p> | 595 <a class="reference internal" href="/native-client/help.html#help"><em>let us kn
ow</em></a>!</p> |
568 </section></section></section> | 596 </section></section></section> |
569 | 597 |
570 {{/partials.standard_nacl_article}} | 598 {{/partials.standard_nacl_article}} |
OLD | NEW |