1 'ndk-depends' Overview 2 === 3 4 Introduction: 5 ------------- 6 7 The `ndk-depends` tool that comes with this Android NDK allows you to dump 8 the ELF dependencies of a given ELF shared library or executable. 9 10 With the --print-java option, it can also be used to generate a Java 11 source fragment to load your native library and its dependencies in the 12 correct order (see example below). 13 14 Use '`ndk-depends --help`' for complete usage information. 15 16 This tool is designed to support: 17 18 - Either 32-bit or 64-bit ELF binaries. 19 - Either little-endian or big-endian ELF binaries. 20 - Unicode file paths, on Windows. 21 22 Note: The Windows binary will NOT work with Cygwin paths ! 23 24 Examples: 25 --------- 26 27 * `ndk-depends path/to/libfoo.so` 28 > Dump all dependencies of libfoo.so, in topological order, so 29 that any library listed in the result appears before any other 30 library it depends on. 31 32 * `ndk-depends --print-paths path/to/libfoo.so` 33 > Same as above, but also prints the path of the libraries on 34 your host file system. 35 36 * `ndk-depends -L some/other/path path/to/libfoo.so` 37 > Append 'some/other/path' to the search path for depending libraries 38 when looking at the dependencies for 'libfoo.so' 39 40 * `ndk-depends --print-direct path/to/libfoo.so` 41 > Only print the _direct_ dependencies of libfoo.so, and nothing 42 else, in the order they appear in the file. 43 44 * `ndk-depends path/to/libfoo.so --print-java` 45 > Prints a Java source fragment that corresponds to the load 46 of 'libfoo' with System.loadLibrary(). This lists all libraries 47 in reverse order, and ignores system libraries (e.g. libc.so). 48 49 * `ndk-depends path/to/libfoo.so --print-dot | dot -Tpng -o /tmp/graph.png` 50 > Prints the dependency graph as Graphviz .dot file, then generate 51 a PNG image for it. 52 53 * `ndk-depends --help` 54 > Print complete usage details. 55 56 Let's assume your project has the several libraries: 57 58 libfoo.so -> depends on libbar.so and libzoo.so 59 libbar.so -> depends on the system's liblog.so 60 libzoo.so -> depends on libbar.so 61 62 Then '`ndk-depends libs/armeabi/libfoo.so`' will typically print: 63 64 libfoo.so 65 libzoo.so 66 libbar.so 67 liblog.so 68 69 And '`ndk-depends --print-java libs/armeabi/libfoo.so`' will print: 70 71 System.loadLibrary("bar"); 72 System.loadLibrary("zoo"); 73 System.loadLibrary("foo"); 74 75 This is handy to avoid computing the reverse library order yourself 76 for complex projects. 77 78 For more details, see the output of '`ndk-depends --help`'. 79 80