Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot debug error while loading shared libraries: libtest-758a09c353a92957.so #8711

Open
furstenheim opened this issue Apr 2, 2022 · 6 comments
Assignees
Labels
subsystem::debugger Issues related to debugger

Comments

@furstenheim
Copy link

Environment

  • IntelliJ Rust plugin version:
  • 0.4.167.4525-213
  • Rust toolchain version:
  • rustc 1.59.0
  • IDE name and version:
  • clion 11.0.14.1+1-b1751.46 amd64
  • Operating system:
  • Linux 18

Problem description

When debugging some tests it fails with a failure to find a shared library. Other tests run just as fine

Steps to reproduce

This project has two cargos https://github.com/furstenheim/challenge_deserializer/tree/test-macro-directly,
One for the macro, the other that uses the macro. Both of them have one test.

From intellij I can execute both tests and I can debug the test in challenge_encoding_macro.

However, If I try to debug the test in https://github.com/furstenheim/challenge_deserializer/blob/test-macro-directly/challenge_encoding_derive/src/test.rs it fails with " error while loading shared libraries: libtest-758a09c353a92957.so: cannot open shared object file: No such file or directory"

@nyurik
Copy link

nyurik commented Jul 19, 2022

I am having the same issue, IntelliJ 221.5921.22, rust plugin 0.4.174.4743-221, rustc 1.61.1 on Linux Mint. I was trying to debug some rust-clippy unit tests. I have also seen it elsewhere. Running tests (without debug) works just fine.

UPDATE: Seems like the issue was related to the missing LD_LIBRARY_PATH, so adding it to the debug configuration makes it work:

LD_LIBRARY_PATH=~/.rustup/toolchains/nightly-2022-07-15-x86_64-unknown-linux-gnu/lib/:$LD_LIBRARY_PATH

@Undin Undin added the subsystem::debugger Issues related to debugger label Jul 19, 2022
@frederickjjoubert
Copy link

frederickjjoubert commented Aug 25, 2022

I'm also using CLion with the Rust plugin, I'm working on a game using the Bevy game engine and I'm getting the same error but with libbevy_dylib:

error while loading shared libraries: libbevy_dylib-3888e9814c2a97bf.so: cannot open shared object file: No such file or directory

How would I go about fixing this error for the libbevy_dylib?

Update 1:

I found this stack overflow page: https://stackoverflow.com/questions/480764/linux-error-while-loading-shared-libraries-cannot-open-shared-object-file-no-s and used the command sudo find / -name libbevy_dylib-3888e9814c2a97bf.so to find where this file is at /home/my_user/Development/rust/bevy-game/target/debug/deps/libbevy_dylib-3888e9814c2a97bf.so and exported the path as the instructions state.

Now I'm not sure how to add that to my CLion+Rust project configuration for the debugger to find.

I opened my project configuration, opened the environment variables tab, and added an entry with key LD_LIBRARY_PATH and value /home/my_user/Development/rust/bevy-game/target/debug/deps/libbevy_dylib-3888e9814c2a97bf.so and I am still getting the same error.

@artemmukhin
Copy link
Member

@frederickjjoubert I guess the path to the containing directory should be used, instead of the file itself. Please try setting
LD_LIBRARY_PATH environment variable in the Run Configuration settings to $PROJECT_DIR$/target/debug/deps/:$LD_LIBRARY_PATH and let us know if that helps.

@frederickjjoubert
Copy link

frederickjjoubert commented Aug 26, 2022

@ortem Thank you for your reply. I changed my project environment variables to be key LD_LIBRARY_PATH and value $PROJECT_DIR$/target/debug/deps/:$LD_LIBRARY_PATH and I'm still getting the same error unfortunately.

After following the other guide, when I run echo $LD_LIBRARY_PATH I get output :/home/my_user/Development/rust/bevy-game/target/debug/deps/

@nccurry
Copy link

nccurry commented Feb 23, 2023

Setting an environment variable in my CLion Cargo Run configuration to

LD_LIBRARY_PATH="/path/to/project/target/debug/deps:/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib:$LD_LIBRARY_PATH" 

allowed me to properly use the CLion debugger.

@AxiomaticSemantics
Copy link

See rust-lang/cargo#4895 for the upstream issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subsystem::debugger Issues related to debugger
Projects
None yet
Development

No branches or pull requests

7 participants