# \[ANN\] DependencyWalker: walk through your binary shared libraries

**URL:** https://discourse.julialang.org/t/ann-dependencywalker-walk-through-your-binary-shared-libraries/39204
**Category:** Package Announcements
**Created:** [May 10, 2020, 12:36am UTC](https://discourse.julialang.org/t/ann-dependencywalker-walk-through-your-binary-shared-libraries/39204 "2020-05-10T00:36:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [May 10, 2020, 12:36am UTC](https://discourse.julialang.org/t/ann-dependencywalker-walk-through-your-binary-shared-libraries/39204/1 "2020-05-10T00:36:41Z")

</div>

This is to announce the first release of [`DependencyWalker.jl`](https://github.com/giordano/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](https://en.wikipedia.org/wiki/Source_lines_of_code)!) to walk through the dependencies of a binary [shared library](https://en.wikipedia.org/wiki/Library_(computing)#Shared_libraries), to debug mysterious error messages like

```julia-auto
ERROR: could not load library ....
Stacktrace:
 [1] dlopen(...) ...

```

## Installation

In Julia REPL:

```julia-auto
]add DependencyWalker

```

## Usage

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

```julia-auto
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](https://github.com/JuliaPackaging/Yggdrasil/pull/970): @visr couldn’t load a Julia package because of a problem with a binary library:

```julia-auto
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-auto
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 😉
