1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 5 <meta http-equiv="X-UA-Compatible" content="IE=9"/> 6 <meta name="generator" content="Doxygen 1.8.5"/> 7 <title>NDK Programmer's Guide: <code>ndk-depends</code> Tool</title> 8 <link href="tabs.css" rel="stylesheet" type="text/css"/> 9 <script type="text/javascript" src="jquery.js"></script> 10 <script type="text/javascript" src="dynsections.js"></script> 11 <link href="navtree.css" rel="stylesheet" type="text/css"/> 12 <script type="text/javascript" src="resize.js"></script> 13 <script type="text/javascript" src="navtree.js"></script> 14 <script type="text/javascript"> 15 $(document).ready(initResizable); 16 $(window).load(resizeHeight); 17 </script> 18 <link href="doxygen.css" rel="stylesheet" type="text/css" /> 19 </head> 20 <body> 21 <div id="top"><!-- do not remove this div, it is closed by doxygen! --> 22 <div id="titlearea"> 23 <table cellspacing="0" cellpadding="0"> 24 <tbody> 25 <tr style="height: 56px;"> 26 <td style="padding-left: 0.5em;"> 27 <div id="projectname">NDK Programmer's Guide 28 </div> 29 </td> 30 </tr> 31 </tbody> 32 </table> 33 </div> 34 <!-- end header part --> 35 <!-- Generated by Doxygen 1.8.5 --> 36 </div><!-- top --> 37 <div id="side-nav" class="ui-resizable side-nav-resizable"> 38 <div id="nav-tree"> 39 <div id="nav-tree-contents"> 40 <div id="nav-sync" class="sync"></div> 41 </div> 42 </div> 43 <div id="splitbar" style="-moz-user-select:none;" 44 class="ui-resizable-handle"> 45 </div> 46 </div> 47 <script type="text/javascript"> 48 $(document).ready(function(){initNavTree('md_4__additional__info__n_d_k-_d_e_p_e_n_d_s.html','');}); 49 </script> 50 <div id="doc-content"> 51 <div class="header"> 52 <div class="headertitle"> 53 <div class="title"><code>ndk-depends</code> Tool </div> </div> 54 </div><!--header--> 55 <div class="contents"> 56 <div class="textblock"><h2>Introduction</h2> 57 <p>The <code>ndk-depends</code> tool that comes with this Android NDK allows you to dump the ELF dependencies of a given ELF shared library or executable.</p> 58 <p>With the –print-java option, it can also be used to generate a Java source fragment to load your native library and its dependencies in the correct order (see example below).</p> 59 <p>Use '<code>ndk-depends --help</code>' for complete usage information.</p> 60 <p>This tool is designed to support:</p> 61 <ul> 62 <li>Either 32-bit or 64-bit ELF binaries.</li> 63 <li>Either little-endian or big-endian ELF binaries.</li> 64 <li>Unicode file paths, on Windows.</li> 65 </ul> 66 <p>Note: The Windows binary will NOT work with Cygwin paths !</p> 67 <h2>Examples</h2> 68 <ul> 69 <li><code>ndk-depends path/to/libfoo.so</code> Dump all dependencies of libfoo.so, in topological order, so that any library listed in the result appears before any other library it depends on.</li> 70 <li><code>ndk-depends --print-paths path/to/libfoo.so</code> Same as above, but also prints the path of the libraries on your host file system.</li> 71 <li><code>ndk-depends -L some/other/path path/to/libfoo.so</code> Append 'some/other/path' to the search path for depending libraries when looking at the dependencies for 'libfoo.so'</li> 72 <li><code>ndk-depends --print-direct path/to/libfoo.so</code> Only print the <em>direct</em> dependencies of libfoo.so, and nothing else, in the order they appear in the file.</li> 73 <li><code>ndk-depends path/to/libfoo.so --print-java</code> Prints a Java source fragment that corresponds to the load of 'libfoo' with System.loadLibrary(). This lists all libraries in reverse order, and ignores system libraries (e.g. libc.so).</li> 74 <li><code>ndk-depends path/to/libfoo.so --print-dot | dot -Tpng -o /tmp/graph.png</code> Prints the dependency graph as Graphviz .dot file, then generate a PNG image for it.</li> 75 <li><code>ndk-depends --help</code> Print complete usage details.</li> 76 </ul> 77 <p>Let's assume your project has the several libraries: </p> 78 <pre class="fragment"> libfoo.so -> depends on libbar.so and libzoo.so 79 libbar.so -> depends on the system's liblog.so 80 libzoo.so -> depends on libbar.so 81 </pre><p>Then '<code>ndk-depends libs/armeabi/libfoo.so</code>' will typically print: </p> 82 <pre class="fragment"> libfoo.so 83 libzoo.so 84 libbar.so 85 liblog.so 86 </pre><p>And '<code>ndk-depends --print-java libs/armeabi/libfoo.so</code>' will print: </p> 87 <pre class="fragment"> System.loadLibrary("bar"); 88 System.loadLibrary("zoo"); 89 System.loadLibrary("foo"); 90 </pre><p>This is handy to avoid computing the reverse library order yourself for complex projects.</p> 91 <p>For more details, see the output of '<code>ndk-depends --help</code>'. </p> 92 </div></div><!-- contents --> 93 </div><!-- doc-content --> 94 <!-- start footer part --> 95 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> 96 <ul> 97 <li class="footer">Generated on Wed Jun 25 2014 00:51:19 for NDK Programmer's Guide by 98 <a href="http://www.doxygen.org/index.html"> 99 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li> 100 </ul> 101 </div> 102 </body> 103 </html> 104