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

Debugging test via VSCode code lens built against sherpa-rs throws dynamic linker error (not present in "run test" code lens or running via cargo test) #19013

Open
vlovich opened this issue Jan 23, 2025 · 1 comment
Labels
C-bug Category: bug

Comments

@vlovich
Copy link

vlovich commented Jan 23, 2025

rust-analyzer version: rust-analyzer version: 0.3.2273-standalone [/home/vlovich/.vscode-server/extensions/rust-lang.rust-analyzer-0.3.2273-linux-x64/server/rust-analyzer]

rustc version: rustc 1.84.0 (9fc6b4312 2025-01-07)

editor or extension: VSCode 0.3.2273

relevant settings: N/A

repository link (if public, optional): https://github.com/thewh1teagle/sherpa-rs

code snippet to reproduce:

#[cfg(test)]
#[test]
fn test() {
    let _config = sherpa_rs::whisper::WhisperConfig::default();
}

If I run the test via "Run Test" code lens or command line "cargo test" it works fine. If I try to debug the test via code lens, the executable fails to launch with error while loading shared libraries: libsherpa-onnx-c-api.so: cannot open shared object file: No such file or directory. The build.rs from sherpa-rs-sys is set up correctly (at least those paths have the .so on them). If I manually add a LD_LIBRARY_PATH to the rust-analyzer.runnables.extraEnv variable pointing to a folder containing the so it works, but it's annoying & non-ideal (since I don't actually know which profile the analyzer is using to launch - don't think there's a variable expansion that works for that which would at least mitigate the short-term pain of that).

This is documented as a known issue:
https://github.com/thewh1teagle/sherpa-rs/blob/main/BUILDING.md#shared-library-not-found-while-its-in-the-same-directly-of-executable

@vlovich vlovich added the C-bug Category: bug label Jan 23, 2025
@vlovich vlovich changed the title Debugging test within VSCode built against sherpa-rs throws dynamic linker error (not present "run test" or running via cargo test) Debugging test via VSCode code lens built against sherpa-rs throws dynamic linker error (not present in "run test" code lens or running via cargo test) Jan 23, 2025
@ChayimFriedman2
Copy link
Contributor

Do you add the SHERPA_BUILD_DEBUG=1 to the build script rust-analyzer runs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants