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> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 operating-system-independent <strong>and</strong> processor-independent. The sam
e <strong>pexe</strong> | 56 operating-system-independent <strong>and</strong> processor-independent. The sam
e <strong>pexe</strong> |
57 will run on Windows, Mac OS X, Linux, and ChromeOS and it will run on x86-32, | 57 will run on Windows, Mac OS X, Linux, and ChromeOS and it will run on x86-32, |
58 x86-64, ARM and MIPS processors.</p> | 58 x86-64, ARM and MIPS processors.</p> |
59 <p>Native Client also supports architecture-specific <strong>nexe</strong> files
. | 59 <p>Native Client also supports architecture-specific <strong>nexe</strong> files
. |
60 These <strong>nexe</strong> files are <strong>also</strong> operating-system-ind
ependent, | 60 These <strong>nexe</strong> files are <strong>also</strong> operating-system-ind
ependent, |
61 but they are <strong>not</strong> processor-independent. To support a wide varie
ty of | 61 but they are <strong>not</strong> processor-independent. To support a wide varie
ty of |
62 devices you must compile separate versions of your Native Client module | 62 devices you must compile separate versions of your Native Client module |
63 for different processors on end-user machines. A | 63 for different processors on end-user machines. A |
64 <a class="reference internal" href="/native-client/overview.html#application-fil
es"><em>manifest file</em></a> will then specify which version | 64 <a class="reference internal" href="/native-client/overview.html#application-fil
es"><em>manifest file</em></a> will then specify which version |
65 of the module to load based on the end-user’s architecture. The SDK | 65 of the module to load based on the end-user’s architecture. The SDK |
66 includes a script—<code>create_nmf.py</code> (in the <code>tools/</code> d
irectory)—to | 66 includes a script for generating manifest files called <code>create_nmf.py</code
>. This |
67 generate manifest files. For examples of how to compile modules | 67 script is located in the <code>pepper_<version>/tools/</code> directory, m
eaning under |
68 for multiple target architectures and how to generate manifest files, see the | 68 your installed pepper bundle. For examples of how to compile modules for |
| 69 multiple target architectures and how to generate manifest files, see the |
69 Makefiles included with the SDK examples.</p> | 70 Makefiles included with the SDK examples.</p> |
70 <p>This section will mostly cover PNaCl, but also describes how to build | 71 <p>This section will mostly cover PNaCl, but also describes how to build |
71 <strong>nexe</strong> applications.</p> | 72 <strong>nexe</strong> applications.</p> |
72 <h3 id="c-libraries">C libraries</h3> | 73 <h3 id="c-libraries">C libraries</h3> |
73 <p>The PNaCl SDK has a single choice of C library: <a class="reference external"
href="http://sourceware.org/newlib/">newlib</a>.</p> | 74 <p>The PNaCl SDK has a single choice of C library: <a class="reference external"
href="http://sourceware.org/newlib/">newlib</a>.</p> |
74 <p>The Native Client SDK also has a GCC-based toolchain for building | 75 <p>The Native Client SDK also has a GCC-based toolchain for building |
75 <strong>nexes</strong>. The GCC-based toolchain has support for two C libraries: | 76 <strong>nexes</strong>. The GCC-based toolchain has support for two C libraries: |
76 <a class="reference external" href="http://sourceware.org/newlib/">newlib</a> an
d <a class="reference external" href="http://www.gnu.org/software/libc/">glibc</
a>. See <a class="reference internal" href="/native-client/devguide/devcycle/dy
namic-loading.html"><em>Dynamic Linking & Loading with glibc</em></a> for in
formation about these libraries, including factors to | 77 <a class="reference external" href="http://sourceware.org/newlib/">newlib</a> an
d <a class="reference external" href="http://www.gnu.org/software/libc/">glibc</
a>. See <a class="reference internal" href="/native-client/devguide/devcycle/dy
namic-loading.html"><em>Dynamic Linking & Loading with glibc</em></a> for in
formation about these libraries, including factors to |
77 help you decide which to use.</p> | 78 help you decide which to use.</p> |
78 <h3 id="c-standard-libraries"><span id="building-cpp-libraries"></span>C++ stand
ard libraries</h3> | 79 <h3 id="c-standard-libraries"><span id="building-cpp-libraries"></span>C++ stand
ard libraries</h3> |
79 <p>The PNaCl SDK can use either LLVM’s <a class="reference external" href=
"http://libcxx.llvm.org/">libc++</a> | 80 <p>The PNaCl SDK can use either LLVM’s <a class="reference external" href=
"http://libcxx.llvm.org/">libc++</a> |
80 (the current default) or GCC’s <a class="reference external" href="http://
gcc.gnu.org/libstdc++">libstdc++</a> (deprecated). The | 81 (the current default) or GCC’s <a class="reference external" href="http://
gcc.gnu.org/libstdc++">libstdc++</a> (deprecated). The |
81 <code>-stdlib=[libc++|libstdc++]</code> command line argument can be used to | 82 <code>-stdlib=[libc++|libstdc++]</code> command line argument can be used to |
82 choose which standard library to use.</p> | 83 choose which standard library to use.</p> |
83 <p>The GCC-based Native Client SDK only has support for GCC’s <a class="re
ference external" href="http://gcc.gnu.org/libstdc++">libstdc++</a>.</p> | 84 <p>The GCC-based Native Client SDK only has support for GCC’s <a class="re
ference external" href="http://gcc.gnu.org/libstdc++">libstdc++</a>.</p> |
84 <p>C++11 library support is only complete in libc++ but other non-library langua
ge | 85 <p>C++11 library support is only complete in libc++ but other non-library langua
ge |
85 features should work regardless of which standard library is used. The | 86 features should work regardless of which standard library is used. The |
86 <code>-std=gnu++11</code> command line argument can be used to indicate which C+
+ | 87 <code>-std=gnu++11</code> command line argument can be used to indicate which C+
+ |
87 language standard to use (<code>-std=c++11</code> often doesn’t work well
because newlib | 88 language standard to use (<code>-std=c++11</code> often doesn’t work well
because newlib |
88 relies on some GNU extensions).</p> | 89 relies on some GNU extensions).</p> |
89 <h3 id="sdk-toolchains">SDK toolchains</h3> | 90 <h3 id="sdk-toolchains">SDK toolchains</h3> |
90 <p>The Native Client SDK includes multiple toolchains. It has one PNaCl toolchai
n | 91 <p>The Native Client SDK includes multiple toolchains. It has one PNaCl toolchai
n |
91 and it has multiple GCC-based toolchains that are differentiated by target | 92 and it has multiple GCC-based toolchains that are differentiated by target |
92 architectures and C libraries. The single PNaCl toolchain is located | 93 architectures and C libraries. The single PNaCl toolchain is located |
93 in a directory named <code>toolchain/<OS_platform>_pnacl</code>, and the G
CC-based | 94 in a directory named <code>pepper_<version>/toolchain/<OS_platform>_
pnacl</code>, |
94 toolchains are located in directories named | 95 and the GCC-based toolchains are located in directories named |
95 <code>toolchain/<OS_platform>_<architecture>_<library></code>,
where:</p> | 96 <code>pepper_<version>/toolchain/<OS_platform>_<architecture>_
<c_library></code>.</p> |
96 <ul class="small-gap"> | |
97 <li><dl class="first docutils"> | |
98 <dt><em><platform></em> is the platform of your development machine (<em>w
in</em>, <em>mac</em>, or</dt> | |
99 <dd><em>linux</em>)</dd> | |
100 </dl> | |
101 </li> | |
102 <li><em><architecture></em> is your target architecture (<em>x86</em> or <
em>arm</em>)</li> | |
103 <li><em><library></em> is the C library you are compiling with (<em>newlib
</em> or <em>glibc</em>)</li> | |
104 </ul> | |
105 <p>The compilers, linkers, and other tools are located in the <code>bin/</code> | 97 <p>The compilers, linkers, and other tools are located in the <code>bin/</code> |
106 subdirectory in each toolchain. For example, the tools in the Windows SDK | 98 subdirectory in each toolchain. For example, the tools in the Windows SDK |
107 for PNaCl has a C++ compiler in <code>toolchain/win_pnacl/bin/pnacl-clang++</cod
e>. | 99 for PNaCl has a C++ compiler in <code>toolchain/win_pnacl/bin/pnacl-clang++</cod
e>.</p> |
108 As another example, the GCC-based C++ compiler that targets x86 and uses the | |
109 newlib library, is located at <code>toolchain/win_x86_newlib/bin/x86_64-nacl-g++
</code>.</p> | |
110 <aside class="note"> | |
111 The SDK toolchains descend from the <code>toolchain/</code> directory. The SDK a
lso | |
112 has a <code>tools/</code> directory; this directory contains utilities that are
not | |
113 properly part of the toolchains but that you may find helpful in building and | |
114 testing your application (e.g., the <code>create_nmf.py</code> script, which you
can | |
115 use to create a manifest file). | |
116 </aside> | |
117 <h3 id="sdk-toolchains-versus-your-hosted-toolchain">SDK toolchains versus your
hosted toolchain</h3> | 100 <h3 id="sdk-toolchains-versus-your-hosted-toolchain">SDK toolchains versus your
hosted toolchain</h3> |
118 <p>To build NaCl modules, you must use one of the Native Client toolchains | 101 <p>To build NaCl modules, you must use one of the Native Client toolchains |
119 included in the SDK. The SDK toolchains use a variety of techniques to | 102 included in the SDK. The SDK toolchains use a variety of techniques to |
120 ensure that your NaCl modules comply with the security constraints of | 103 ensure that your NaCl modules comply with the security constraints of |
121 the Native Client sandbox.</p> | 104 the Native Client sandbox.</p> |
122 <p>During development, you have another choice: You can build modules using a | 105 <p>During development, you have another choice: You can build modules using a |
123 <em>standard</em> toolchain, such as the hosted toolchain on your development | 106 <em>standard</em> toolchain, such as the hosted toolchain on your development |
124 machine. This can be Visual Studio’s standard compiler, XCode, LLVM, or | 107 machine. This can be Visual Studio’s standard compiler, XCode, LLVM, or |
125 GNU-based compilers on your development machine. These standard toolchains | 108 GNU-based compilers on your development machine. These standard toolchains |
126 will not produce executables that comply with the Native Client sandbox | 109 will not produce executables that comply with the Native Client sandbox |
(...skipping 12 matching lines...) Expand all Loading... |
139 provided in the SDK. | 122 provided in the SDK. |
140 </aside> | 123 </aside> |
141 <h2 id="the-pnacl-toolchain">The PNaCl toolchain</h2> | 124 <h2 id="the-pnacl-toolchain">The PNaCl toolchain</h2> |
142 <p>The PNaCl toolchain contains modified versions of the tools in the | 125 <p>The PNaCl toolchain contains modified versions of the tools in the |
143 LLVM toolchain, as well as linkers and other tools from binutils. | 126 LLVM toolchain, as well as linkers and other tools from binutils. |
144 To determine which version of LLVM or binutils the tools are based upon, | 127 To determine which version of LLVM or binutils the tools are based upon, |
145 run the tool with the <code>--version</code> command line flag. These tools | 128 run the tool with the <code>--version</code> command line flag. These tools |
146 are used to compile and link applications into <strong>.pexe</strong> files. The
toolchain | 129 are used to compile and link applications into <strong>.pexe</strong> files. The
toolchain |
147 also contains a tool to translate a <strong>pexe</strong> file into a | 130 also contains a tool to translate a <strong>pexe</strong> file into a |
148 architecture-specific <strong>.nexe</strong> (e.g., for debugging purposes).</p> | 131 architecture-specific <strong>.nexe</strong> (e.g., for debugging purposes).</p> |
149 <p>Each tool’s name is preceded by the prefix “pnacl-”. Some o
f the useful | 132 <p>Some of the useful tools include:</p> |
150 tools include:</p> | |
151 <dl class="docutils"> | 133 <dl class="docutils"> |
152 <dt>pnacl-abicheck</dt> | 134 <dt>pnacl-abicheck</dt> |
153 <dd>Check that the <strong>pexe</strong> follows the PNaCl ABI rules.</dd> | 135 <dd>Checks that the <strong>pexe</strong> follows the PNaCl ABI rules.</dd> |
154 <dt>pnacl-ar</dt> | 136 <dt>pnacl-ar</dt> |
155 <dd>Creates archives (i.e., static libraries)</dd> | 137 <dd>Creates archives (i.e., static libraries)</dd> |
156 <dt>pnacl-clang</dt> | 138 <dt>pnacl-clang</dt> |
157 <dd>C compiler and compiler driver</dd> | 139 <dd>C compiler and compiler driver</dd> |
158 <dt>pnacl-clang++</dt> | 140 <dt>pnacl-clang++</dt> |
159 <dd>C++ compiler and compiler driver</dd> | 141 <dd>C++ compiler and compiler driver</dd> |
160 <dt>pnacl-compress</dt> | 142 <dt>pnacl-compress</dt> |
161 <dd>Size compresses a finalized <strong>pexe</strong> file for deployment.</dd> | 143 <dd>Compresses a finalized <strong>pexe</strong> file for deployment.</dd> |
162 <dt>pnacl-dis</dt> | 144 <dt>pnacl-dis</dt> |
163 <dd>Disassembler for both <strong>pexe</strong> files and <strong>nexe</strong>
files</dd> | 145 <dd>Disassembler for both <strong>pexe</strong> files and <strong>nexe</strong>
files</dd> |
164 <dt>pnacl-finalize</dt> | 146 <dt>pnacl-finalize</dt> |
165 <dd>Finalizes <strong>pexe</strong> files for deployment</dd> | 147 <dd>Finalizes <strong>pexe</strong> files for deployment</dd> |
166 <dt>pnacl-ld</dt> | 148 <dt>pnacl-ld</dt> |
167 <dd>Bitcode linker</dd> | 149 <dd>Bitcode linker</dd> |
168 <dt>pnacl-nm</dt> | 150 <dt>pnacl-nm</dt> |
169 <dd>Lists symbols in bitcode files, native code, and libraries</dd> | 151 <dd>Lists symbols in bitcode files, native code, and libraries</dd> |
170 <dt>pnacl-ranlib</dt> | 152 <dt>pnacl-ranlib</dt> |
171 <dd>Generates a symbol table for archives (i.e., static libraries)</dd> | 153 <dd>Generates a symbol table for archives (i.e., static libraries)</dd> |
172 <dt>pnacl-translate</dt> | 154 <dt>pnacl-translate</dt> |
173 <dd>Translates a <strong>pexe</strong> to a native architecture, outside of the
browser</dd> | 155 <dd>Translates a <strong>pexe</strong> to a native architecture, outside of the
browser</dd> |
174 </dl> | 156 </dl> |
175 <p>For the full list of tools, see the | 157 <p>For the full list of tools, see the |
176 <code><NACL_SDK_ROOT>/toolchain/<platform>_pnacl/bin</code> director
y.</p> | 158 <code>pepper_<version>/toolchain/<platform>_pnacl/bin</code> directo
ry.</p> |
177 <h2 id="using-the-pnacl-tools-to-compile-link-debug-and-deploy">Using the PNaCl
tools to compile, link, debug, and deploy</h2> | 159 <h2 id="using-the-pnacl-tools-to-compile-link-debug-and-deploy">Using the PNaCl
tools to compile, link, debug, and deploy</h2> |
178 <p>To build an application with the PNaCl SDK toolchain, you must compile | 160 <p>To build an application with the PNaCl SDK toolchain, you must compile |
179 your code, link it, test and debug it, and then deploy it. This section goes | 161 your code, link it, test and debug it, and then deploy it. This section goes |
180 over some examples of how to use the tools.</p> | 162 over some examples of how to use the tools.</p> |
181 <h3 id="compile">Compile</h3> | 163 <h3 id="compile">Compile</h3> |
182 <p>To compile a simple application consisting of <code>file1.cc</code> and <code
>file2.cc</code> into | 164 <p>To compile a simple application consisting of <code>file1.cc</code> and <code
>file2.cc</code> into |
183 <code>hello_world.pexe</code> with a single command, use the <code>pnacl-clang++
</code> tool</p> | 165 <code>hello_world.pexe</code> use the <code>pnacl-clang++</code> tool</p> |
184 <pre> | 166 <pre> |
185 <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-clang++ file1.cc file2.cc ^ | 167 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \ |
186 -I<NACL_SDK_ROOT>/include -L<NACL_SDK_ROOT>/lib/pnacl/Release ^ | 168 file1.cc file2.cc -Inacl_sdk/pepper_<version>/include \ |
187 -o hello_world.pexe -g -O2 -lppapi_cpp -lppapi | 169 -Lnacl_sdk/pepper_<version>/lib/pnacl/Release -o hello_world.pexe \ |
| 170 -g -O2 -lppapi_cpp -lppapi |
188 </pre> | 171 </pre> |
189 <p>(The carat <code>^</code> allows the command to span multiple lines on Window
s; | 172 <p>The typical application consists of many files. In that case, |
190 to do the same on Mac and Linux use a backslash instead. Or you can | |
191 simply type the command and all its arguments on one | |
192 line. <code><NACL_SDK_ROOT></code> represents the path to the top-level | |
193 directory of the bundle you are using, e.g., | |
194 <code><location-where-you-installed-the-SDK>/pepper_31</code>.)</p> | |
195 <p>However, the typical application consists of many files. In that case, | |
196 each file can be compiled separately so that only files that are | 173 each file can be compiled separately so that only files that are |
197 affected by a change need to be recompiled. To compile an individual | 174 affected by a change need to be recompiled. To compile an individual |
198 file from your application, you must use either the <code>pnacl-clang</code> C | 175 file from your application, you must use either the <code>pnacl-clang</code> C |
199 compiler, or the <code>pnacl-clang++</code> C++ compiler. The compiler produces | 176 compiler, or the <code>pnacl-clang++</code> C++ compiler. The compiler produces |
200 separate bitcode files. For example:</p> | 177 separate bitcode files. For example:</p> |
201 <pre> | 178 <pre> |
202 <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-clang++ hello_world.cc ^ | 179 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \ |
203 -I<NACL_SDK_ROOT>/include -c -o hello_world.o -g -O0 | 180 hello_world.cc -Inacl_sdk/pepper_<version>/include -c \ |
| 181 -o hello_world.o -g -O0 |
204 </pre> | 182 </pre> |
205 <p>For a description of each command line flag, run <code>pnacl-clang --help</co
de>. | 183 <p>For a description of each command line flag, run <code>pnacl-clang --help</co
de>. |
206 For convenience, here is a description of some of the flags used in | 184 For convenience, here is a description of some of the flags used in |
207 the example.</p> | 185 the example.</p> |
208 <dl class="docutils" id="compile-flags"> | 186 <dl class="docutils" id="compile-flags"> |
209 <dt><code>-c</code></dt> | 187 <dt><code>-c</code></dt> |
210 <dd>indicates that <code>pnacl-clang++</code> should only compile an individual
file, | 188 <dd>indicates that <code>pnacl-clang++</code> should only compile an individual
file, |
211 rather than continue the build process and link together the | 189 rather than continue the build process and link together the |
212 full application.</dd> | 190 full application.</dd> |
213 <dt><code>-o <output_file></code></dt> | 191 <dt><code>-o <output_file></code></dt> |
(...skipping 13 matching lines...) Expand all Loading... |
227 which level of optimization is right for you. When looking at code size, note | 205 which level of optimization is right for you. When looking at code size, note |
228 that what you generally care about is not the size of the <strong>pexe</strong>
produced by | 206 that what you generally care about is not the size of the <strong>pexe</strong>
produced by |
229 <code>pnacl-clang</code>, but the size of the compressed <strong>pexe</strong> t
hat you upload to | 207 <code>pnacl-clang</code>, but the size of the compressed <strong>pexe</strong> t
hat you upload to |
230 the server or to the Chrome Web Store. Optimizations that increase the size of | 208 the server or to the Chrome Web Store. Optimizations that increase the size of |
231 an uncompressed <strong>pexe</strong> may not increase the size of the compresse
d <strong>pexe</strong> | 209 an uncompressed <strong>pexe</strong> may not increase the size of the compresse
d <strong>pexe</strong> |
232 very much. You should also verify how optimization level affects on-device | 210 very much. You should also verify how optimization level affects on-device |
233 translation time, this can be tested locally with <code>pnacl-translate</code>.<
/p> | 211 translation time, this can be tested locally with <code>pnacl-translate</code>.<
/p> |
234 </dd> | 212 </dd> |
235 <dt><code>-I<directory></code></dt> | 213 <dt><code>-I<directory></code></dt> |
236 <dd>adds a directory to the search path for <strong>include</strong> files. The
SDK has | 214 <dd>adds a directory to the search path for <strong>include</strong> files. The
SDK has |
237 Pepper (PPAPI) headers located at <code><NACL_SDK_ROOT>/include</code>, so
add | 215 Pepper (PPAPI) headers located at <code>nacl_sdk/pepper_<version>/ |
238 that directory when compiling to be able to include the headers.</dd> | 216 include</code>, so add that directory when compiling to be able to include the |
| 217 headers.</dd> |
239 <dt><code>-mllvm -inline-threshold=n</code></dt> | 218 <dt><code>-mllvm -inline-threshold=n</code></dt> |
240 <dd>change how much inlining is performed by LLVM (the default is 225, a smaller | 219 <dd>change how much inlining is performed by LLVM (the default is 225, a smaller |
241 value will result in less inlining being performed). The right number to | 220 value will result in less inlining being performed). The right number to |
242 choose is application-specific, you’ll therefore want to experiment with t
he | 221 choose is application-specific, you’ll therefore want to experiment with t
he |
243 value that you pass in: you’ll be trading off potential performance with | 222 value that you pass in: you’ll be trading off potential performance with |
244 <strong>pexe</strong> size and on-device translation speed.</dd> | 223 <strong>pexe</strong> size and on-device translation speed.</dd> |
245 </dl> | 224 </dl> |
246 <h3 id="create-a-static-library">Create a static library</h3> | 225 <h3 id="create-a-static-library">Create a static library</h3> |
247 <p>The <code>pnacl-ar</code> and <code>pnacl-ranlib</code> tools allow you to cr
eate a | 226 <p>The <code>pnacl-ar</code> and <code>pnacl-ranlib</code> tools allow you to cr
eate a |
248 <strong>static</strong> library from a set of bitcode files, which can later be
linked | 227 <strong>static</strong> library from a set of bitcode files, which can later be
linked |
249 into the full application.</p> | 228 into the full application.</p> |
250 <pre> | 229 <pre> |
251 <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-ar cr libfoo.a ^ | 230 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-ar cr \ |
252 foo1.o foo2.o foo3.o | 231 libfoo.a foo1.o foo2.o foo3.o |
253 | 232 |
254 <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-ranlib libfoo.a | 233 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-ranlib libfoo.a |
255 </pre> | 234 </pre> |
256 <h3 id="link-the-application">Link the application</h3> | 235 <h3 id="link-the-application">Link the application</h3> |
257 <p>The <code>pnacl-clang++</code> tool is used to compile applications, but it c
an | 236 <p>The <code>pnacl-clang++</code> tool is used to compile applications, but it c
an |
258 also be used link together compiled bitcode and libraries into a | 237 also be used link together compiled bitcode and libraries into a |
259 full application.</p> | 238 full application.</p> |
260 <pre> | 239 <pre> |
261 <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-clang++ -o hello_world.pexe
^ | 240 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \ |
262 hello_world.o -L<NACL_SDK_ROOT>/lib/pnacl/Debug ^ | 241 -o hello_world.pexe hello_world.o -Lnacl_sdk/pepper_<version>/lib/pnacl/
Debug \ |
263 -lfoo -lppapi_cpp -lppapi | 242 -lfoo -lppapi_cpp -lppapi |
264 </pre> | 243 </pre> |
265 <p>This links the hello world bitcode with the <code>foo</code> library in the e
xample | 244 <p>This links the hello world bitcode with the <code>foo</code> library in the e
xample |
266 as well as the <em>Debug</em> version of the Pepper libraries which are located | 245 as well as the <em>Debug</em> version of the Pepper libraries which are located |
267 in <code><NACL_SDK_ROOT>/lib/pnacl/Debug</code>. If you wish to link again
st the | 246 in <code>nacl_sdk/pepper_<version>/lib/pnacl/Debug</code>. If you wish to
link |
268 <em>Release</em> version of the Pepper libraries, change the | 247 against the <em>Release</em> version of the Pepper libraries, change the |
269 <code>-L<NACL_SDK_ROOT>/lib/pnacl/Debug</code> to | 248 <code>-Lnacl_sdk/pepper_<version>/lib/pnacl/Debug</code> to |
270 <code>-L<NACL_SDK_ROOT>/lib/pnacl/Release</code>.</p> | 249 <code>-Lnacl_sdk/pepper_<version>/lib/pnacl/Release</code>.</p> |
271 <p>In a release build you’ll want to pass <code>-O2</code> to the compiler
<em>as well as to | 250 <p>In a release build you’ll want to pass <code>-O2</code> to the compiler
<em>as well as to |
272 the linker</em> to enable link-time optimizations. This reduces the size and | 251 the linker</em> to enable link-time optimizations. This reduces the size and |
273 increases the performance of the final <strong>pexe</strong>, and leads to faste
r downloads | 252 increases the performance of the final <strong>pexe</strong>, and leads to faste
r downloads |
274 and on-device translation.</p> | 253 and on-device translation.</p> |
275 <pre> | 254 <pre> |
276 <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-clang++ -o hello_world.pexe
^ | 255 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-clang++ \ |
277 hello_world.o -L<NACL_SDK_ROOT>/lib/pnacl/Release ^ | 256 -o hello_world.pexe hello_world.o -Lnacl_sdk/pepper_<version>/lib/pnacl/
Release \ |
278 -lfoo -lppapi_cpp -lppapi -O2 | 257 -lfoo -lppapi_cpp -lppapi -O2 |
279 </pre> | 258 </pre> |
280 <p>By default the link step will turn all C++ exceptions into calls to <code>abo
rt()</code> | 259 <p>By default the link step will turn all C++ exceptions into calls to <code>abo
rt()</code> |
281 to reduce the size of the final <strong>pexe</strong> as well as making it trans
late and run | 260 to reduce the size of the final <strong>pexe</strong> as well as making it trans
late and run |
282 faster. If you want to use C++ exceptions you should use the | 261 faster. If you want to use C++ exceptions you should use the |
283 <code>--pnacl-exceptions=sjlj</code> linker flag as explained in the <a class="r
eference internal" href="/native-client/reference/pnacl-c-cpp-language-support.h
tml#exception-handling"><em>exception | 262 <code>--pnacl-exceptions=sjlj</code> linker flag as explained in the <a class="r
eference internal" href="/native-client/reference/pnacl-c-cpp-language-support.h
tml#exception-handling"><em>exception |
284 handling</em></a> section of the C++ language support reference.</p> | 263 handling</em></a> section of the C++ language support reference.</p> |
285 <h3 id="finalizing-the-pexe-for-deployment">Finalizing the <strong>pexe</strong>
for deployment</h3> | 264 <h3 id="finalizing-the-pexe-for-deployment">Finalizing the <strong>pexe</strong>
for deployment</h3> |
286 <p>Typically you would run the application to test it and debug it if needed bef
ore | 265 <p>Typically you would run the application to test it and debug it if needed bef
ore |
287 deploying. See the <a class="reference internal" href="/native-client/devguide/d
evcycle/running.html"><em>running</em></a> documentation for how to run a PNaCl | 266 deploying. See the <a class="reference internal" href="/native-client/devguide/d
evcycle/running.html"><em>running</em></a> documentation for how to run a PNaCl |
288 application, and see the <a class="reference internal" href="/native-client/devg
uide/devcycle/debugging.html"><em>debugging</em></a> documentation for | 267 application, and see the <a class="reference internal" href="/native-client/devg
uide/devcycle/debugging.html"><em>debugging</em></a> documentation for |
289 debugging techniques and workflow. After testing a PNaCl application, you must | 268 debugging techniques and workflow. After testing a PNaCl application, you must |
290 <strong>finalize</strong> it. The <code>pnacl-finalize</code> tool handles this.
</p> | 269 <strong>finalize</strong> it. The <code>pnacl-finalize</code> tool handles this.
</p> |
291 <pre> | 270 <pre> |
292 <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-finalize ^ | 271 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-finalize \ |
293 hello_world.pexe -o hello_world.final.pexe | 272 hello_world.pexe -o hello_world.final.pexe |
294 </pre> | 273 </pre> |
295 <p>Prior to finalization, the application <strong>pexe</strong> is stored in a b
inary | 274 <p>Prior to finalization, the application <strong>pexe</strong> is stored in a b
inary |
296 format that is subject to change. After finalization, the application | 275 format that is subject to change. After finalization, the application |
297 <strong>pexe</strong> is <strong>rewritten</strong> into a different binary form
at that is <strong>stable</strong> | 276 <strong>pexe</strong> is <strong>rewritten</strong> into a different binary form
at that is <strong>stable</strong> |
298 and will be supported by future versions of PNaCl. The finalization step | 277 and will be supported by future versions of PNaCl. The finalization step |
299 also helps minimize the size of your application for distribution by | 278 also helps minimize the size of your application for distribution by |
300 stripping out debug information and other metadata.</p> | 279 stripping out debug information and other metadata.</p> |
301 <p>Once the application is finalized, be sure to adjust the manifest file to | 280 <p>Once the application is finalized, be sure to adjust the manifest file to |
302 refer to the final version of the application before deployment. | 281 refer to the final version of the application before deployment. |
303 The <code>create_nmf.py</code> tool helps generate an <code>.nmf</code> file, bu
t <code>.nmf</code> | 282 The <code>create_nmf.py</code> tool helps generate an <code>.nmf</code> file, bu
t <code>.nmf</code> |
304 files can also be written by hand.</p> | 283 files can also be written by hand.</p> |
305 <h3 id="compressing-the-pexe-for-deployment"><span id="pnacl-compress"></span>Co
mpressing the <strong>pexe</strong> for deployment</h3> | 284 <h3 id="compressing-the-pexe-for-deployment"><span id="pnacl-compress"></span>Co
mpressing the <strong>pexe</strong> for deployment</h3> |
306 <p>Size compression is an optional step for deployment, and reduces the size of
the | 285 <p>Size compression is an optional step for deployment, and reduces the size of
the |
307 <strong>pexe</strong> file that must be transmitted over the wire, resulting in
faster | 286 <strong>pexe</strong> file that must be transmitted over the wire, resulting in
faster |
308 download speed. The tool <code>pnacl-compress</code> applies compression strateg
ies that | 287 download speed. The tool <code>pnacl-compress</code> applies compression strateg
ies that |
309 are already built into the <strong>stable</strong> binary format of a <strong>pe
xe</strong> | 288 are already built into the <strong>stable</strong> binary format of a <strong>pe
xe</strong> |
310 application. As such, compressed <strong>pexe</strong> files do not need any ext
ra time to be | 289 application. As such, compressed <strong>pexe</strong> files do not need any ext
ra time to be |
311 decompressed on the client’s side. All costs are upfront when you call | 290 decompressed on the client’s side. All costs are upfront when you call |
312 <code>pnacl-compress</code>.</p> | 291 <code>pnacl-compress</code>.</p> |
313 <p>Currently, this tool will compress <strong>pexe</strong> files by about 25%.
However, | 292 <p>Currently, this tool will compress <strong>pexe</strong> files by about 25%.
However, |
314 it is somewhat slow (can take from seconds to minutes on large | 293 it is somewhat slow (can take from seconds to minutes on large |
315 appications). Hence, this step is optional.</p> | 294 appications). Hence, this step is optional.</p> |
316 <pre> | 295 <pre> |
317 <NACL_SDK_ROOT>/toolchain/win_pnacl/bin/pnacl-compress ^ | 296 nacl_sdk/pepper_<version>/toolchain/win_pnacl/bin/pnacl-compress \ |
318 hello_world.final.pexe | 297 hello_world.final.pexe |
319 </pre> | 298 </pre> |
320 <p><code>pnacl-compress</code> must be called after a <strong>pexe</strong> file
has been finalized for | 299 <p><code>pnacl-compress</code> must be called after a <strong>pexe</strong> file
has been finalized for |
321 deployment (via <code>pnacl-finalize</code>). Alternatively, you can apply this
step as | 300 deployment (via <code>pnacl-finalize</code>). Alternatively, you can apply this
step as |
322 part of the finalizing step by adding the <code>--compress</code> flag to the | 301 part of the finalizing step by adding the <code>--compress</code> flag to the |
323 <code>pnacl-finalize</code> command line.</p> | 302 <code>pnacl-finalize</code> command line.</p> |
324 <p>This compression step doesn’t replace the gzip compression performed we
b servers | 303 <p>This compression step doesn’t replace the gzip compression performed we
b servers |
325 configured for HTTP compression: both compressions are complementary. You’
ll | 304 configured for HTTP compression: both compressions are complementary. You’
ll |
326 want to configure your web server to gzip <strong>pexe</strong> files: the gzipp
ed version of | 305 want to configure your web server to gzip <strong>pexe</strong> files: the gzipp
ed version of |
327 a compressed <strong>pexe</strong> file is smaller than the corresponding uncomp
ressed | 306 a compressed <strong>pexe</strong> file is smaller than the corresponding uncomp
ressed |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 <li><prefix>strip</li> | 351 <li><prefix>strip</li> |
373 </ul> | 352 </ul> |
374 <h3 id="compiling">Compiling</h3> | 353 <h3 id="compiling">Compiling</h3> |
375 <p>Compiling files with the GNU-based toolchain is similar to compiling | 354 <p>Compiling files with the GNU-based toolchain is similar to compiling |
376 files with the PNaCl-based toolchain, except that the output is | 355 files with the PNaCl-based toolchain, except that the output is |
377 architecture specific.</p> | 356 architecture specific.</p> |
378 <p>For example, assuming you’re developing on a Windows machine, targeting
the x86 | 357 <p>For example, assuming you’re developing on a Windows machine, targeting
the x86 |
379 architecture, and using the newlib library, you can compile a 32-bit <strong>.ne
xe</strong> | 358 architecture, and using the newlib library, you can compile a 32-bit <strong>.ne
xe</strong> |
380 for the hello_world example with the following command:</p> | 359 for the hello_world example with the following command:</p> |
381 <pre> | 360 <pre> |
382 <NACL_SDK_ROOT>/toolchain/win_x86_newlib/bin/i686-nacl-gcc hello_world.c ^ | 361 nacl_sdk/pepper_<version>/toolchain/win_x86_newlib/bin/i686-nacl-gcc \ |
383 -I<NACL_SDK_ROOT>/include -L<NACL_SDK_ROOT>/lib/newlib/Release ^ | 362 hello_world.c -Inacl_sdk/pepper_<version>/include \ |
384 -o hello_world_x86_32.nexe -m32 -g -O2 -lppapi | 363 -Lnacl_sdk/pepper_<version>/lib/newlib/Release -o hello_world_x86_32.nex
e \ |
| 364 -m32 -g -O2 -lppapi |
385 </pre> | 365 </pre> |
386 <p>To compile a 64-bit <strong>.nexe</strong>, you can run the same command but
use -m64 instead | 366 <p>To compile a 64-bit <strong>.nexe</strong>, you can run the same command but
use -m64 instead |
387 of -m32. Alternatively, you could also use the version of the compiler that | 367 of -m32. Alternatively, you could also use the version of the compiler that |
388 targets the x86-64 architecture, i.e., <code>x86_64-nacl-gcc</code>.</p> | 368 targets the x86-64 architecture, i.e., <code>x86_64-nacl-gcc</code>.</p> |
389 <p>You should name executable modules with a <strong>.nexe</strong> filename ext
ension, | 369 <p>You should name executable modules with a <strong>.nexe</strong> filename ext
ension, |
390 regardless of what platform you’re using.</p> | 370 regardless of what platform you’re using.</p> |
391 <h3 id="creating-libraries-and-linking">Creating libraries and Linking</h3> | 371 <h3 id="creating-libraries-and-linking">Creating libraries and Linking</h3> |
392 <p>Creating libraries and linking with the GNU-based toolchain is similar | 372 <p>Creating libraries and linking with the GNU-based toolchain is similar |
393 to doing the same with the PNaCl toolchain. The relevant tools | 373 to doing the same with the PNaCl toolchain. The relevant tools |
394 for creating <strong>static</strong> libraries are <code><prefix>ar</code>
and <code><prefix>ranlib</code>. | 374 for creating <strong>static</strong> libraries are <code><prefix>ar</code>
and <code><prefix>ranlib</code>. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 </pre> | 444 </pre> |
465 <p>Your Makefile can be simpler since you will not likely want to build so many | 445 <p>Your Makefile can be simpler since you will not likely want to build so many |
466 different configurations of your module. The example Makefiles define | 446 different configurations of your module. The example Makefiles define |
467 numerous variables near the top (e.g., <code>CFLAGS</code>) that make it easy | 447 numerous variables near the top (e.g., <code>CFLAGS</code>) that make it easy |
468 to customize the commands that are executed for your project and the options | 448 to customize the commands that are executed for your project and the options |
469 for each command.</p> | 449 for each command.</p> |
470 <p>For details on how to use make, see the <a class="reference external" href="h
ttp://www.gnu.org/software/make/manual/make.html">GNU ‘make’ Manual<
/a>.</p> | 450 <p>For details on how to use make, see the <a class="reference external" href="h
ttp://www.gnu.org/software/make/manual/make.html">GNU ‘make’ Manual<
/a>.</p> |
471 <h2 id="libraries-and-header-files-provided-with-the-sdk">Libraries and header f
iles provided with the SDK</h2> | 451 <h2 id="libraries-and-header-files-provided-with-the-sdk">Libraries and header f
iles provided with the SDK</h2> |
472 <p>The Native Client SDK includes modified versions of standard toolchain-suppor
t | 452 <p>The Native Client SDK includes modified versions of standard toolchain-suppor
t |
473 libraries, such as libpthread and libc, plus the relevant header files. | 453 libraries, such as libpthread and libc, plus the relevant header files. |
474 The standard libraries are located in the following directories:</p> | 454 The standard libraries are located under the <code>/pepper_<version></code
> directory |
| 455 in the following locations:</p> |
475 <ul class="small-gap"> | 456 <ul class="small-gap"> |
476 <li>PNaCl toolchain: <code>toolchain/<platform>_pnacl/usr/lib</code></li> | 457 <li>PNaCl toolchain: <code>toolchain/<platform>_pnacl/usr/lib</code></li> |
477 <li>x86 toolchains: <code>toolchain/<platform>_x86_<library>/x86_64-
nacl/lib32</code> and | 458 <li>x86 toolchains: <code>toolchain/<platform>_x86_<c_library>/x86_6
4-nacl/lib32</code> and |
478 <code>/lib64</code> (for the 32-bit and 64-bit target architectures, respectivel
y)</li> | 459 <code>/lib64</code> (for the 32-bit and 64-bit target architectures, respectivel
y)</li> |
479 <li>ARM toolchain: <code>toolchain/<platform>_arm_<library>/arm-nacl
/lib</code></li> | 460 <li>ARM toolchain: <code>toolchain/<platform>_arm_<c_library>/arm-na
cl/lib</code></li> |
480 </ul> | 461 </ul> |
481 <p>For example, on Windows, the libraries for the x86-64 architecture in the | 462 <p>For example, on Windows, the libraries for the x86-64 architecture in the |
482 newlib toolchain are in <code>toolchain/win_x86_newlib/x86_64-nacl/lib64</code>.
</p> | 463 newlib toolchain are in <code>toolchain/win_x86_newlib/x86_64-nacl/lib64</code>.
</p> |
483 <p>The header files are in:</p> | 464 <p>The header files are in:</p> |
484 <ul class="small-gap"> | 465 <ul class="small-gap"> |
485 <li>PNaCl toolchain: <code>toolchain/<platform>_pnacl/usr/include</code></
li> | 466 <li>PNaCl toolchain: <code>toolchain/<platform>_pnacl/usr/include</code></
li> |
486 <li>x86 toolchains: <code>toolchain/<platform>_x86_<library>/x86_64-
nacl/include</code></li> | 467 <li>x86 toolchains: <code>toolchain/<platform>_x86_<c_library>/x86_6
4-nacl/include</code></li> |
487 <li>ARM toolchain: <code>toolchain/<platform>_arm_<library>/arm-nacl
/include</code></li> | 468 <li>ARM toolchain: <code>toolchain/<platform>_arm_<c_library>/arm-na
cl/include</code></li> |
488 </ul> | 469 </ul> |
489 <p>Many other libraries have been ported for use with Native Client; for more | 470 <p>Many other libraries have been ported for use with Native Client; for more |
490 information, see the <a class="reference external" href="http://code.google.com/
p/naclports/">naclports</a> | 471 information, see the <a class="reference external" href="http://code.google.com/
p/naclports/">naclports</a> |
491 project. If you port an open-source library for your own use, we recommend | 472 project. If you port an open-source library for your own use, we recommend |
492 adding it to naclports.</p> | 473 adding it to naclports.</p> |
493 <p>Besides the standard libraries, the SDK includes Pepper libraries. | 474 <p>Besides the standard libraries, the SDK includes Pepper libraries. |
494 The PNaCl Pepper libraries are located in the the | 475 The PNaCl Pepper libraries are located in the the |
495 <code><NACL_SDK_ROOT>/lib/pnacl/<Release or Debug></code> directory. | 476 <code>nacl_sdk/pepper_<version>/lib/pnacl/<Release or Debug></code>
directory. |
496 The GNU-based toolchain has Pepper libraries in | 477 The GNU-based toolchain has Pepper libraries in |
497 <code><NACL_SDK_ROOT>/lib/newlib_<arch>/<Release or Debug></co
de> | 478 <code>nacl_sdk/pepper_<version>/lib/newlib_<arch>/<Release or Deb
ug></code> |
498 and <code><NACL_SDK_ROOT>/lib/glibc_<arch>/<Release or Debug><
/code>. | 479 and <code>nacl_sdk/pepper_<version>/lib/glibc_<arch>/<Release or
Debug></code>. |
499 The libraries provided by the SDK allow the application to use Pepper, | 480 The libraries provided by the SDK allow the application to use Pepper, |
500 as well as convenience libraries to simplify porting an application that | 481 as well as convenience libraries to simplify porting an application that |
501 uses POSIX functions. Here are descriptions of the Pepper libraries provided | 482 uses POSIX functions. Here are descriptions of the Pepper libraries provided |
502 in the SDK.</p> | 483 in the SDK.</p> |
503 <dl class="docutils" id="devcycle-building-nacl-io"> | 484 <dl class="docutils" id="devcycle-building-nacl-io"> |
504 <dt>libppapi.a</dt> | 485 <dt>libppapi.a</dt> |
505 <dd>Implements the Pepper (PPAPI) C interface. Needed for all applications that | 486 <dd>Implements the Pepper (PPAPI) C interface. Needed for all applications that |
506 use Pepper (even C++ applications).</dd> | 487 use Pepper (even C++ applications).</dd> |
507 <dt>libppapi_cpp.a</dt> | 488 <dt>libppapi_cpp.a</dt> |
508 <dd>Implements the Pepper (PPAPI) C++ interface. Needed by C++ applications that | 489 <dd>Implements the Pepper (PPAPI) C++ interface. Needed by C++ applications that |
(...skipping 18 matching lines...) Expand all Loading... |
527 how to use ppapi_simple, <code>see examples/tutorial/using_ppapi_simple</code>.<
/dd> | 508 how to use ppapi_simple, <code>see examples/tutorial/using_ppapi_simple</code>.<
/dd> |
528 </dl> | 509 </dl> |
529 <aside class="note"> | 510 <aside class="note"> |
530 <ul class="small-gap"> | 511 <ul class="small-gap"> |
531 <li>Since the Native Client toolchains use their own library and header search | 512 <li>Since the Native Client toolchains use their own library and header search |
532 paths, the tools won’t find third-party libraries you use in your | 513 paths, the tools won’t find third-party libraries you use in your |
533 non-Native-Client development. If you want to use a specific third-party | 514 non-Native-Client development. If you want to use a specific third-party |
534 library for Native Client development, look for it in <a class="reference extern
al" href="http://code.google.com/p/naclports/">naclports</a>, or port the librar
y yourself.</li> | 515 library for Native Client development, look for it in <a class="reference extern
al" href="http://code.google.com/p/naclports/">naclports</a>, or port the librar
y yourself.</li> |
535 <li>The order in which you list libraries in your build commands is important, | 516 <li>The order in which you list libraries in your build commands is important, |
536 since the linker searches and processes libraries in the order in which they | 517 since the linker searches and processes libraries in the order in which they |
537 are specified. See the *_LDFLAGS variables in the Makefiles of the SDK | 518 are specified. See the <code>\*_LDFLAGS</code> variables in the Makefiles of the
SDK |
538 examples for the order in which specific libraries should be listed.</li> | 519 examples for the order in which specific libraries should be listed.</li> |
539 </ul> | 520 </ul> |
540 | 521 |
541 </aside> | 522 </aside> |
542 <h2 id="troubleshooting">Troubleshooting</h2> | 523 <h2 id="troubleshooting">Troubleshooting</h2> |
543 <p>Some common problems, and how to fix them:</p> | 524 <p>Some common problems, and how to fix them:</p> |
544 <h3 id="undefined-reference-error">“Undefined reference” error</h3> | 525 <h3 id="undefined-reference-error">“Undefined reference” error</h3> |
545 <p>An “undefined reference” error may indicate incorrect link order
and/or | 526 <p>An “undefined reference” error may indicate incorrect link order
and/or |
546 missing libraries. For example, if you leave out <code>-lppapi</code> when | 527 missing libraries. For example, if you leave out <code>-lppapi</code> when |
547 compiling Pepper applications you’ll see a series of undefined | 528 compiling Pepper applications you’ll see a series of undefined |
(...skipping 11 matching lines...) Expand all Loading... |
559 </ol> | 540 </ol> |
560 <p>If your code uses mkdir or other file system calls, you might find the | 541 <p>If your code uses mkdir or other file system calls, you might find the |
561 <a class="reference internal" href="#devcycle-building-nacl-io"><em>nacl_io</em>
</a> library useful. | 542 <a class="reference internal" href="#devcycle-building-nacl-io"><em>nacl_io</em>
</a> library useful. |
562 The nacl_io library essentially does option (3) for you: It lets your | 543 The nacl_io library essentially does option (3) for you: It lets your |
563 code use POSIX-like file system calls, and implements the calls using | 544 code use POSIX-like file system calls, and implements the calls using |
564 various technologies (e.g., HTML5 file system, read-only filesystems that | 545 various technologies (e.g., HTML5 file system, read-only filesystems that |
565 use URL loaders, or an in-memory filesystem).</p> | 546 use URL loaders, or an in-memory filesystem).</p> |
566 <h3 id="can-t-find-libraries-containing-necessary-symbols">Can’t find libr
aries containing necessary symbols</h3> | 547 <h3 id="can-t-find-libraries-containing-necessary-symbols">Can’t find libr
aries containing necessary symbols</h3> |
567 <p>Here is one way to find the appropriate library for a given symbol:</p> | 548 <p>Here is one way to find the appropriate library for a given symbol:</p> |
568 <pre> | 549 <pre> |
569 <NACL_SDK_ROOT>/toolchain/<platform>_pnacl/bin/pnacl-nm -o \ | 550 nacl_sdk/pepper_<version>/toolchain/<platform>_pnacl/bin/pnacl-nm -o
\ |
570 toolchain/<platform>_pnacl/usr/lib/*.a | grep <MySymbolName> | 551 nacl_sdk/pepper_<version>toolchain/<platform>_pnacl/usr/lib/*.a |
\ |
| 552 grep <MySymbolName> |
571 </pre> | 553 </pre> |
572 <h3 id="pnacl-abi-verification-errors">PNaCl ABI Verification errors</h3> | 554 <h3 id="pnacl-abi-verification-errors">PNaCl ABI Verification errors</h3> |
573 <p>PNaCl has restrictions on what is supported in bitcode. There is a bitcode | 555 <p>PNaCl has restrictions on what is supported in bitcode. There is a bitcode |
574 ABI verifier which checks that the application conforms to the ABI restrictions, | 556 ABI verifier which checks that the application conforms to the ABI restrictions, |
575 before it is translated and run in the browser. However, it is best to | 557 before it is translated and run in the browser. However, it is best to |
576 avoid runtime errors for users, so the verifier also runs on the developer’
;s | 558 avoid runtime errors for users, so the verifier also runs on the developer’
;s |
577 machine at link time.</p> | 559 machine at link time.</p> |
578 <p>For example, the following program which uses 128-bit integers | 560 <p>For example, the following program which uses 128-bit integers |
579 would compile with NaCl GCC for the x86-64 target. However, it is not | 561 would compile with NaCl GCC for the x86-64 target. However, it is not |
580 portable and would not compile with NaCl GCC for the i686 target. | 562 portable and would not compile with NaCl GCC for the i686 target. |
(...skipping 10 matching lines...) Expand all Loading... |
591 Function foo has disallowed type: i128 (i128) | 573 Function foo has disallowed type: i128 (i128) |
592 LLVM ERROR: PNaCl ABI verification failed | 574 LLVM ERROR: PNaCl ABI verification failed |
593 </pre> | 575 </pre> |
594 <p>When faced with a PNaCl ABI verification error, check the list of features | 576 <p>When faced with a PNaCl ABI verification error, check the list of features |
595 that are <a class="reference internal" href="/native-client/nacl-and-pnacl.html#
when-to-use-nacl"><em>not supported by PNaCl</em></a>. | 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>. |
596 If the problem you face is not listed as restricted, | 578 If the problem you face is not listed as restricted, |
597 <a class="reference internal" href="/native-client/help.html#help"><em>let us kn
ow</em></a>!</p> | 579 <a class="reference internal" href="/native-client/help.html#help"><em>let us kn
ow</em></a>!</p> |
598 </section> | 580 </section> |
599 | 581 |
600 {{/partials.standard_nacl_article}} | 582 {{/partials.standard_nacl_article}} |
OLD | NEW |