Search code examples
visual-studio-coderustcodelldb

How do I debug a Rust executable that uses a shared library?


My current crate (X) I wish to debug uses another library crate of mine (Y), which loads a C shared library with Rusts ffi. The executable from crate X work fine, I can even debug it fine using GDB. However, when I want to debug the executable in visual studio code with CodeLLDB I am hit with "/<dir>/target/debug/<exe name>: error while loading shared libraries: .so: cannot open shared object file: No such file or directory".

I am puzzled as the library exists, Rust can build the executable, and GDB can debug perfectly fine without errors, but CodeLLDB cannot. So, my question is, how can I debug this Rust project with CodeLLDB, as this provides a nicer debugging experience (GDB has no interpretation of Rust in anyway)?


Solution

  • I was sloppy it seems. I think I only added the library directory to my .bashrc.

    I now added a symbolic link to /usr/lib and debugging in VS Code works as expected.