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 <li><a class="reference internal" href="#compressing-the-pexe-for-deployment" id
="id16">Compressing the <strong>pexe</strong> for deployment</a></li> |
25 </ul> | 25 </ul> |
26 </li> | 26 </li> |
27 <li><p class="first"><a class="reference internal" href="#the-gnu-based-toolchai
ns" id="id17">The GNU-based toolchains</a></p> | 27 <li><a class="reference internal" href="#object-dumping-of-pnacl-bitcode-files"
id="id17">Object dumping of PNaCl bitcode files</a></li> |
| 28 <li><p class="first"><a class="reference internal" href="#the-gnu-based-toolchai
ns" id="id18">The GNU-based toolchains</a></p> |
28 <ul class="small-gap"> | 29 <ul class="small-gap"> |
29 <li><a class="reference internal" href="#compiling" id="id18">Compiling</a></li> | 30 <li><a class="reference internal" href="#compiling" id="id19">Compiling</a></li> |
30 <li><a class="reference internal" href="#creating-libraries-and-linking" id="id1
9">Creating libraries and Linking</a></li> | 31 <li><a class="reference internal" href="#creating-libraries-and-linking" id="id2
0">Creating libraries and Linking</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> | 32 <li><a class="reference internal" href="#finalizing-a-nexe-for-deployment" id="i
d21">Finalizing a <strong>nexe</strong> for deployment</a></li> |
32 </ul> | 33 </ul> |
33 </li> | 34 </li> |
34 <li><a class="reference internal" href="#using-make" id="id21">Using make</a></l
i> | 35 <li><a class="reference internal" href="#using-make" id="id22">Using make</a></l
i> |
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> | 36 <li><a class="reference internal" href="#libraries-and-header-files-provided-wit
h-the-sdk" id="id23">Libraries and header files provided with the SDK</a></li> |
36 <li><p class="first"><a class="reference internal" href="#troubleshooting" id="i
d23">Troubleshooting</a></p> | 37 <li><p class="first"><a class="reference internal" href="#troubleshooting" id="i
d24">Troubleshooting</a></p> |
37 <ul class="small-gap"> | 38 <ul class="small-gap"> |
38 <li><a class="reference internal" href="#undefined-reference-error" id="id24">&#
8220;Undefined reference” error</a></li> | 39 <li><a class="reference internal" href="#undefined-reference-error" id="id25">&#
8220;Undefined reference” error</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> | 40 <li><a class="reference internal" href="#can-t-find-libraries-containing-necessa
ry-symbols" id="id26">Can’t find libraries containing necessary symbols</a
></li> |
40 <li><a class="reference internal" href="#pnacl-abi-verification-errors" id="id26
">PNaCl ABI Verification errors</a></li> | 41 <li><a class="reference internal" href="#pnacl-abi-verification-errors" id="id27
">PNaCl ABI Verification errors</a></li> |
41 </ul> | 42 </ul> |
42 </li> | 43 </li> |
43 </ul> | 44 </ul> |
44 | 45 |
45 </div><h2 id="introduction">Introduction</h2> | 46 </div><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> |
50 <h3 id="target-architectures"><span id="id1"></span>Target architectures</h3> | 51 <h3 id="target-architectures"><span id="id1"></span>Target architectures</h3> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 <h2 id="the-pnacl-toolchain">The PNaCl toolchain</h2> | 125 <h2 id="the-pnacl-toolchain">The PNaCl toolchain</h2> |
125 <p>The PNaCl toolchain contains modified versions of the tools in the | 126 <p>The PNaCl toolchain contains modified versions of the tools in the |
126 LLVM toolchain, as well as linkers and other tools from binutils. | 127 LLVM toolchain, as well as linkers and other tools from binutils. |
127 To determine which version of LLVM or binutils the tools are based upon, | 128 To determine which version of LLVM or binutils the tools are based upon, |
128 run the tool with the <code>--version</code> command line flag. These tools | 129 run the tool with the <code>--version</code> command line flag. These tools |
129 are used to compile and link applications into <strong>.pexe</strong> files. The
toolchain | 130 are used to compile and link applications into <strong>.pexe</strong> files. The
toolchain |
130 also contains a tool to translate a <strong>pexe</strong> file into a | 131 also contains a tool to translate a <strong>pexe</strong> file into a |
131 architecture-specific <strong>.nexe</strong> (e.g., for debugging purposes).</p> | 132 architecture-specific <strong>.nexe</strong> (e.g., for debugging purposes).</p> |
132 <p>Some of the useful tools include:</p> | 133 <p>Some of the useful tools include:</p> |
133 <dl class="docutils"> | 134 <dl class="docutils"> |
134 <dt>pnacl-abicheck</dt> | 135 <dt><code>pnacl-abicheck</code></dt> |
135 <dd>Checks that the <strong>pexe</strong> follows the PNaCl ABI rules.</dd> | 136 <dd>Checks that the <strong>pexe</strong> follows the PNaCl ABI rules.</dd> |
136 <dt>pnacl-ar</dt> | 137 <dt><code>pnacl-ar</code></dt> |
137 <dd>Creates archives (i.e., static libraries)</dd> | 138 <dd>Creates archives (i.e., static libraries)</dd> |
138 <dt>pnacl-clang</dt> | 139 <dt><code>pnacl-bcdis</code></dt> |
| 140 <dd>Object dumper for PNaCl bitcode files.</dd> |
| 141 <dt><code>pnacl-clang</code></dt> |
139 <dd>C compiler and compiler driver</dd> | 142 <dd>C compiler and compiler driver</dd> |
140 <dt>pnacl-clang++</dt> | 143 <dt><code>pnacl-clang++</code></dt> |
141 <dd>C++ compiler and compiler driver</dd> | 144 <dd>C++ compiler and compiler driver</dd> |
142 <dt>pnacl-compress</dt> | 145 <dt><code>pnacl-compress</code></dt> |
143 <dd>Compresses a finalized <strong>pexe</strong> file for deployment.</dd> | 146 <dd>Compresses a finalized <strong>pexe</strong> file for deployment.</dd> |
144 <dt>pnacl-dis</dt> | 147 <dt><code>pnacl-dis</code></dt> |
145 <dd>Disassembler for both <strong>pexe</strong> files and <strong>nexe</strong>
files</dd> | 148 <dd>Disassembler for both <strong>pexe</strong> files and <strong>nexe</strong>
files</dd> |
146 <dt>pnacl-finalize</dt> | 149 <dt><code>pnacl-finalize</code></dt> |
147 <dd>Finalizes <strong>pexe</strong> files for deployment</dd> | 150 <dd>Finalizes <strong>pexe</strong> files for deployment</dd> |
148 <dt>pnacl-ld</dt> | 151 <dt><code>pnacl-ld</code></dt> |
149 <dd>Bitcode linker</dd> | 152 <dd>Bitcode linker</dd> |
150 <dt>pnacl-nm</dt> | 153 <dt><code>pnacl-nm</code></dt> |
151 <dd>Lists symbols in bitcode files, native code, and libraries</dd> | 154 <dd>Lists symbols in bitcode files, native code, and libraries</dd> |
152 <dt>pnacl-ranlib</dt> | 155 <dt><code>pnacl-ranlib</code></dt> |
153 <dd>Generates a symbol table for archives (i.e., static libraries)</dd> | 156 <dd>Generates a symbol table for archives (i.e., static libraries)</dd> |
154 <dt>pnacl-translate</dt> | 157 <dt><code>pnacl-translate</code></dt> |
155 <dd>Translates a <strong>pexe</strong> to a native architecture, outside of the
browser</dd> | 158 <dd>Translates a <strong>pexe</strong> to a native architecture, outside of the
browser</dd> |
156 </dl> | 159 </dl> |
157 <p>For the full list of tools, see the | 160 <p>For the full list of tools, see the |
158 <code>pepper_<version>/toolchain/<platform>_pnacl/bin</code> directo
ry.</p> | 161 <code>pepper_<version>/toolchain/<platform>_pnacl/bin</code> directo
ry.</p> |
159 <h2 id="using-the-pnacl-tools-to-compile-link-debug-and-deploy">Using the PNaCl
tools to compile, link, debug, and deploy</h2> | 162 <h2 id="using-the-pnacl-tools-to-compile-link-debug-and-deploy">Using the PNaCl
tools to compile, link, debug, and deploy</h2> |
160 <p>To build an application with the PNaCl SDK toolchain, you must compile | 163 <p>To build an application with the PNaCl SDK toolchain, you must compile |
161 your code, link it, test and debug it, and then deploy it. This section goes | 164 your code, link it, test and debug it, and then deploy it. This section goes |
162 over some examples of how to use the tools.</p> | 165 over some examples of how to use the tools.</p> |
163 <h3 id="compile">Compile</h3> | 166 <h3 id="compile">Compile</h3> |
164 <p>To compile a simple application consisting of <code>file1.cc</code> and <code
>file2.cc</code> into | 167 <p>To compile a simple application consisting of <code>file1.cc</code> and <code
>file2.cc</code> into |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 </pre> | 301 </pre> |
299 <p><code>pnacl-compress</code> must be called after a <strong>pexe</strong> file
has been finalized for | 302 <p><code>pnacl-compress</code> must be called after a <strong>pexe</strong> file
has been finalized for |
300 deployment (via <code>pnacl-finalize</code>). Alternatively, you can apply this
step as | 303 deployment (via <code>pnacl-finalize</code>). Alternatively, you can apply this
step as |
301 part of the finalizing step by adding the <code>--compress</code> flag to the | 304 part of the finalizing step by adding the <code>--compress</code> flag to the |
302 <code>pnacl-finalize</code> command line.</p> | 305 <code>pnacl-finalize</code> command line.</p> |
303 <p>This compression step doesn’t replace the gzip compression performed we
b servers | 306 <p>This compression step doesn’t replace the gzip compression performed we
b servers |
304 configured for HTTP compression: both compressions are complementary. You’
ll | 307 configured for HTTP compression: both compressions are complementary. You’
ll |
305 want to configure your web server to gzip <strong>pexe</strong> files: the gzipp
ed version of | 308 want to configure your web server to gzip <strong>pexe</strong> files: the gzipp
ed version of |
306 a compressed <strong>pexe</strong> file is smaller than the corresponding uncomp
ressed | 309 a compressed <strong>pexe</strong> file is smaller than the corresponding uncomp
ressed |
307 <strong>pexe</strong> file by 7.5% to 10%.</p> | 310 <strong>pexe</strong> file by 7.5% to 10%.</p> |
| 311 <h2 id="object-dumping-of-pnacl-bitcode-files"><span id="pnacl-bcdis"></span>Obj
ect dumping of PNaCl bitcode files</h2> |
| 312 <p>Sometimes you may be interesting in the contents of a PNaCl bitcode file. Th
e |
| 313 tool <code>pnacl-bcdis</code> object dumps the contents of a PNaCl bitcode file.
For a |
| 314 description of the output produced by this tool, see |
| 315 <a class="reference internal" href="/native-client/reference/pnacl-bitcode-manua
l.html"><em>Contents Of PNaCl Bitcode Files</em></a>.</p> |
| 316 <pre> |
| 317 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-bcdis \ |
| 318 hello_world.final.pexe |
| 319 </pre> |
| 320 <p>The output is the corresponding contents of the given <strong>pexe</strong>.<
/p> |
308 <h2 id="the-gnu-based-toolchains">The GNU-based toolchains</h2> | 321 <h2 id="the-gnu-based-toolchains">The GNU-based toolchains</h2> |
309 <p>Besides the PNaCl toolchain, the Native Client SDK also includes modified | 322 <p>Besides the PNaCl toolchain, the Native Client SDK also includes modified |
310 versions of the tools in the standard GNU toolchain, including the GCC | 323 versions of the tools in the standard GNU toolchain, including the GCC |
311 compilers and the linkers and other tools from binutils. These tools only | 324 compilers and the linkers and other tools from binutils. These tools only |
312 support building <strong>nexe</strong> files. Run the tool with the <code>--vers
ion</code> | 325 support building <strong>nexe</strong> files. Run the tool with the <code>--vers
ion</code> |
313 command line flag to determine the current version of the tools.</p> | 326 command line flag to determine the current version of the tools.</p> |
314 <p>Each tool in the toolchain is prefixed with the name of the target | 327 <p>Each tool in the toolchain is prefixed with the name of the target |
315 architecture. In the toolchain for the ARM target architecture, each | 328 architecture. In the toolchain for the ARM target architecture, each |
316 tool’s name is preceded by the prefix “arm-nacl-”. In the tool
chains for | 329 tool’s name is preceded by the prefix “arm-nacl-”. In the tool
chains for |
317 the x86 target architecture, there are actually two versions of each | 330 the x86 target architecture, there are actually two versions of each |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 Function foo has disallowed type: i128 (i128) | 586 Function foo has disallowed type: i128 (i128) |
574 LLVM ERROR: PNaCl ABI verification failed | 587 LLVM ERROR: PNaCl ABI verification failed |
575 </pre> | 588 </pre> |
576 <p>When faced with a PNaCl ABI verification error, check the list of features | 589 <p>When faced with a PNaCl ABI verification error, check the list of features |
577 that are <a class="reference internal" href="/native-client/nacl-and-pnacl.html#
when-to-use-nacl"><em>not supported by PNaCl</em></a>. | 590 that are <a class="reference internal" href="/native-client/nacl-and-pnacl.html#
when-to-use-nacl"><em>not supported by PNaCl</em></a>. |
578 If the problem you face is not listed as restricted, | 591 If the problem you face is not listed as restricted, |
579 <a class="reference internal" href="/native-client/help.html#help"><em>let us kn
ow</em></a>!</p> | 592 <a class="reference internal" href="/native-client/help.html#help"><em>let us kn
ow</em></a>!</p> |
580 </section> | 593 </section> |
581 | 594 |
582 {{/partials.standard_nacl_article}} | 595 {{/partials.standard_nacl_article}} |
OLD | NEW |