[ANN] DependencyWalker: walk through your binary shared libraries

This is to announce the first release of DependencyWalker.jl. No, this isn’t a tool to visualise the dependencies of your Julia libraries, but a very small package (less than 100 sloc!) to walk through the dependencies of a binary shared library, to debug mysterious error messages like

ERROR: could not load library ....
Stacktrace:
 [1] dlopen(...) ...

Installation

In Julia REPL:

]add DependencyWalker

Usage

The package exports a single function, Library , which takes as only argument the path to the shared library:

julia> using DependencyWalker, LibSSH2_jll

julia> LibSSH2_jll.libssh2_path # Path to the libssh2 library
"/home/user/.julia/artifacts/26c7d3a6c17151277018b133ab0034e93ddc3d1e/lib/libssh2.so"

julia> Library(LibSSH2_jll.libssh2_path)
◼ /home/user/.julia/artifacts/26c7d3a6c17151277018b133ab0034e93ddc3d1e/lib/libssh2.so
  ◼ /usr/bin/../lib/julia/libmbedtls.so.12
    ◼ /usr/bin/../lib/julia/libmbedx509.so.0
      ◼ /usr/bin/../lib/libc.so.6
        ◼ /lib64/ld-linux-x86-64.so.2
      ◼ /usr/bin/../lib/julia/libmbedcrypto.so.3
        ◼ /usr/bin/../lib/libc.so.6
          ◼ /lib64/ld-linux-x86-64.so.2
    ◼ /usr/bin/../lib/libc.so.6
      ◼ /lib64/ld-linux-x86-64.so.2
    ◼ /usr/bin/../lib/julia/libmbedcrypto.so.3
      ◼ /usr/bin/../lib/libc.so.6
        ◼ /lib64/ld-linux-x86-64.so.2
  ◼ /usr/bin/../lib/julia/libmbedx509.so.0
    ◼ /usr/bin/../lib/libc.so.6
      ◼ /lib64/ld-linux-x86-64.so.2
    ◼ /usr/bin/../lib/julia/libmbedcrypto.so.3
      ◼ /usr/bin/../lib/libc.so.6
        ◼ /lib64/ld-linux-x86-64.so.2
  ◼ /usr/bin/../lib/libc.so.6
    ◼ /lib64/ld-linux-x86-64.so.2
  ◼ /usr/bin/../lib/julia/libmbedcrypto.so.3
    ◼ /usr/bin/../lib/libc.so.6
      ◼ /lib64/ld-linux-x86-64.so.2

Real-world example

In the case above all dependencies are found, so this package isn’t particularly useful. Instead, a nice example of usage is provided by this pull request: @visr couldn’t load a Julia package because of a problem with a binary library:

julia> using Libtiff_jll
ERROR: InitError: could not load library "C:\Users\visser_mn\.julia\artifacts\f98adb5b4de5c29a8d77def412b792beaec6180b\bin\libtiff-5.dll"
The specified module could not be found.
Stacktrace:
 [1] dlopen(::String, ::UInt32; throw_error::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Libdl\src\Libdl.jl:109
 [...]

and used DependencyWalker to figure out what was missing:

julia> using DependencyWalker

julia> Library(raw"C:\Users\visser_mn\.julia\artifacts\f98adb5b4de5c29a8d77def412b792beaec6180b\bin\libtiff-5.dll")
◼ C:\Users\visser_mn\.julia\artifacts\f98adb5b4de5c29a8d77def412b792beaec6180b\bin\libtiff-5.dll
  ◼ C:\Users\visser_mn\.julia\artifacts\217f5fb6408fcad8ec290be23f14646aab4e53b0\bin\libjpeg-62.dll
  ✗ libzstd.dll (NOT FOUND)
  ◼ C:\Users\visser_mn\.julia\artifacts\12dda53f058e2ad8360473e1df8d31d709724a38\bin\libz.dll

The output suggested him that libtiff-5.dll was looking for a library called libzstd.dll but couldn’t find it.

Final remarks

DependencyWalker is in a very early stage of development. Please, do let me know if you have any problem by filing bugs, and open issues to suggest new features. Pull requests are also welcome :wink:

17 Likes