OLD | NEW |
1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
2 | 2 |
3 <section id="dynamic-linking-and-loading-with-glibc"> | 3 <section id="dynamic-linking-and-loading-with-glibc"> |
4 <h1 id="dynamic-linking-and-loading-with-glibc">Dynamic Linking and Loading with
glibc</h1> | 4 <h1 id="dynamic-linking-and-loading-with-glibc">Dynamic Linking and Loading with
glibc</h1> |
5 <div class="contents local" id="contents" style="display: none"> | 5 <div class="contents local" id="contents" style="display: none"> |
6 <ul class="small-gap"> | 6 <ul class="small-gap"> |
7 <li><a class="reference internal" href="#c-standard-libraries-glibc-and-newlib"
id="id1">C standard libraries: glibc and newlib</a></li> | 7 <li><a class="reference internal" href="#c-standard-libraries-glibc-and-newlib"
id="id1">C standard libraries: glibc and newlib</a></li> |
8 <li><a class="reference internal" href="#sdk-toolchains" id="id2">SDK toolchains
</a></li> | 8 <li><a class="reference internal" href="#sdk-toolchains" id="id2">SDK toolchains
</a></li> |
9 <li><p class="first"><a class="reference internal" href="#specifying-and-deliver
ing-shared-libraries" id="id3">Specifying and delivering shared libraries</a></p
> | 9 <li><p class="first"><a class="reference internal" href="#specifying-and-deliver
ing-shared-libraries" id="id3">Specifying and delivering shared libraries</a></p
> |
10 <ul class="small-gap"> | 10 <ul class="small-gap"> |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 shared library dependencies (for example, dependencies specified with the -l | 307 shared library dependencies (for example, dependencies specified with the -l |
308 flag for the compiler/linker). If you want to include libraries that you | 308 flag for the compiler/linker). If you want to include libraries that you |
309 intend to dlopen() at runtime you must explcitly list them in your call to | 309 intend to dlopen() at runtime you must explcitly list them in your call to |
310 <code>create_nmf</code>. | 310 <code>create_nmf</code>. |
311 </aside> | 311 </aside> |
312 <p>As an alternative to using <code>create_nmf</code>, it is possible to manuall
y calculate | 312 <p>As an alternative to using <code>create_nmf</code>, it is possible to manuall
y calculate |
313 the list of shared library dependencies using tools such as <code>objdump_</code
>.</p> | 313 the list of shared library dependencies using tools such as <code>objdump_</code
>.</p> |
314 <h3 id="deploying-a-dynamically-linked-application">Deploying a dynamically link
ed application</h3> | 314 <h3 id="deploying-a-dynamically-linked-application">Deploying a dynamically link
ed application</h3> |
315 <p>As described above, an application’s manifest file must explicitly list
all the | 315 <p>As described above, an application’s manifest file must explicitly list
all the |
316 executable code modules that the application directly depends on, including | 316 executable code modules that the application directly depends on, including |
317 modules from the application itself (.nexe and .so files), modules from the | 317 modules from the application itself (<code>.nexe</code> and <code>.so</code> fil
es), modules from |
318 Native Client SDK (e.g., libppapi_cpp.so), and perhaps also modules from | 318 the Native Client SDK (e.g., <code>libppapi_cpp.so</code>), and perhaps also mod
ules from |
319 <a class="reference external" href="http://code.google.com/p/naclports/">naclpor
ts</a> or from | 319 <a class="reference external" href="http://code.google.com/p/naclports/">naclpor
ts</a> or from <a class="reference external" href="../../community/middleware">m
iddleware systems</a> that the application uses. You must provide all |
320 <a class="reference external" href="../../community/middleware">middleware syste
ms</a> that | 320 of those modules as part of the application deployment process.</p> |
321 the application uses. You must provide all of those modules as part of the | 321 <p>As explained in <a class="reference internal" href="/native-client/devguide/d
istributing.html"><em>Distributing Your Application</em></a>, there |
322 application deployment process.</p> | 322 are two basic ways to deploy a <a class="reference external" href="/apps">Chrome
app</a>:</p> |
323 <p>As explained in <a class="reference internal" href="/native-client/devguide/d
istributing.html"><em>Distributing Your Application</em></a>, there are two basi
c ways to deploy an application:</p> | |
324 <ul class="small-gap"> | 323 <ul class="small-gap"> |
325 <li><strong>hosted application:</strong> all modules are hosted together on a we
b server of | 324 <li><strong>hosted application:</strong> all modules are hosted together on a we
b server of |
326 your choice</li> | 325 your choice</li> |
327 <li><strong>packaged application:</strong> all modules are packaged into one fil
e, hosted in | 326 <li><strong>packaged application:</strong> all modules are packaged into one fil
e, hosted in |
328 the Chrome Web Store, and downloaded to the user’s machine</li> | 327 the Chrome Web Store, and downloaded to the user’s machine</li> |
329 </ul> | 328 </ul> |
| 329 <p>The web store documentation contains a handy guide to <a class="reference ext
ernal" href="https://developer.chrome.com/webstore/choosing">help you choose whi
ch to |
| 330 use</a>.</p> |
330 <p>You must deploy all the modules listed in your application’s manifest f
ile for | 331 <p>You must deploy all the modules listed in your application’s manifest f
ile for |
331 either the hosted application or the packaged application case. For hosted | 332 either the hosted application or the packaged application case. For hosted |
332 applications, you must upload the modules to your web server. For packaged | 333 applications, you must upload the modules to your web server. For packaged |
333 applications, you must include the modules in the application’s Chrome Web | 334 applications, you must include the modules in the application’s Chrome Web
Store |
334 Store .crx file. Modules should use URLs/names that are consistent with those | 335 .crx file. Modules should use URLs/names that are consistent with those in the |
335 in the Native Client manifest file, and be named relative to the location of | 336 Native Client manifest file, and be named relative to the location of the |
336 the manifest file. Remember that some of the libraries named in the manifest | 337 manifest file. Remember that some of the libraries named in the manifest file |
337 file may be located in directories you specified with the -L option to | 338 may be located in directories you specified with the <code>-L</code> option to |
338 <code>create_nmf.py</code>. You are free to rename/rearrange files and directori
es | 339 <code>create_nmf.py</code>. You are free to rename/rearrange files and directori
es |
339 referenced by the Native Client manifest file, so long as the modules are | 340 referenced by the Native Client manifest file, so long as the modules are |
340 available in the locations indicated by the manifest file. If you move or | 341 available in the locations indicated by the manifest file. If you move or rename |
341 rename modules, it may be easier to re-run <code>create_nmf.py</code> to generat
e a new | 342 modules, it may be easier to re-run <code>create_nmf.py</code> to generate a new
manifest |
342 manifest file rather than edit the original manifest file. For hosted | 343 file rather than edit the original manifest file. For hosted applications, you |
343 applications, you can check for name mismatches during testing by watching the | 344 can check for name mismatches during testing by watching the request log of the |
344 request log of the web server hosting your test deployment.</p> | 345 web server hosting your test deployment.</p> |
345 <h3 id="opening-a-shared-library-at-runtime">Opening a shared library at runtime
</h3> | 346 <h3 id="opening-a-shared-library-at-runtime">Opening a shared library at runtime
</h3> |
346 <p>Native Client supports a version of the POSIX standard <code>dlopen()</code>
interface | 347 <p>Native Client supports a version of the POSIX standard <code>dlopen()</code>
interface |
347 for opening libraries explicitly, after an application is already running. | 348 for opening libraries explicitly, after an application is already running. |
348 Calling <code>dlopen()</code> may cause a library download to occur, and automat
ically | 349 Calling <code>dlopen()</code> may cause a library download to occur, and automat
ically |
349 loads all libraries that are required by the named library.</p> | 350 loads all libraries that are required by the named library.</p> |
350 <aside class="note"> | 351 <aside class="note"> |
351 <strong>Caution:</strong> Since <code>dlopen()</code> can potentially block, you
must initially | 352 <strong>Caution:</strong> Since <code>dlopen()</code> can potentially block, you
must initially |
352 call <code>dlopen()</code> off your application’s main thread. Initial cal
ls to | 353 call <code>dlopen()</code> off your application’s main thread. Initial cal
ls to |
353 <code>dlopen()</code> from the main thread will always fail in the current | 354 <code>dlopen()</code> from the main thread will always fail in the current |
354 implementation of Native Client. | 355 implementation of Native Client. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 in the .nmf file – either the files are the wrong type or kind, or an | 412 in the .nmf file – either the files are the wrong type or kind, or an |
412 expected library is missing.</dd> | 413 expected library is missing.</dd> |
413 <dt><strong>undefined reference to ‘dlopen’ collect2: ld returned 1
exit status</strong></dt> | 414 <dt><strong>undefined reference to ‘dlopen’ collect2: ld returned 1
exit status</strong></dt> |
414 <dd>This is a linker ordering problem that usually results from improper orderin
g | 415 <dd>This is a linker ordering problem that usually results from improper orderin
g |
415 of command line flags when linking. Reconfigure your command line string to | 416 of command line flags when linking. Reconfigure your command line string to |
416 list libraries after the -o flag.</dd> | 417 list libraries after the -o flag.</dd> |
417 </dl> | 418 </dl> |
418 </section> | 419 </section> |
419 | 420 |
420 {{/partials.standard_nacl_article}} | 421 {{/partials.standard_nacl_article}} |
OLD | NEW |