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

[BUG] Rustacean no longer works - rustanalyizer can't find dynamically linked cargo #2172

Closed
1 task done
clotodex opened this issue Sep 5, 2024 · 5 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@clotodex
Copy link

clotodex commented Sep 5, 2024

Field Description
Plugin rustacean
Nixpkgs unstable
Home Manager unstable
  • I have read the FAQ and my bug is not listed there.

Description

Since a month or so Rustacean does not start the rust-analyzer anymore. Looking into the logs this is a linking issue.

Caused by:
    0: Failed to query rust toolchain version at /home/<user>/projects/<project>, is your toolchain setup correctly?
    1: cd "<path>" && RUSTUP_TOOLCHAIN="/nix/store/3dpmxz017c7w9rjqicymjk4az220d78n-rust-mixed" "/home/<user>/.cargo/bin/cargo" "--version" failed, exit status: 127
       stderr:
       Could not start dynamically linked executable: /home/<user>/.cargo/bin/cargo
       NixOS cannot run dynamically linked executables intended for generic
       linux environments out of the box. For more information, see:
       https://nix.dev/permalink/stub-ld

While the error is obvious, I am curious why that started happening out of the blue?
And since this makes rustacean not work out of the box anymore I am raising this issue.
Anyone has a nicer workaround than force-linking a version of cargo?

Minimal, Reproducible Example (MRE)

Open any rust file with an installed rust-analyzer. (Tried NixOS, devenv and fenix)

programs.nixvim = {
      plugins = {
        rustaceanvim = {
        enable = true;
        settings = {
          server.default_settings.files.excludeDirs = [".direnv"];
          dap.autoloadConfigurations = true;
        };
      };
    }:
}
@clotodex clotodex added the bug Something isn't working label Sep 5, 2024
@clotodex clotodex changed the title [BUG] Rustacean no longer works [BUG] Rustacean no longer works - rustanalyizer can't find dynamically linked cargo Sep 5, 2024
@traxys
Copy link
Member

traxys commented Sep 5, 2024

I personally install cargo/rustc through nix using https://github.com/nix-community/fenix or https://github.com/oxalica/rust-overlay to avoid those kinds of issues

@clotodex
Copy link
Author

clotodex commented Sep 5, 2024

I am using fenix as well. However it seems to be not limited to rust analyzer but all cargo linked commands.

@clotodex
Copy link
Author

clotodex commented Sep 6, 2024

cachix/devenv#1419
Investigating if this might be a devenv issue.
I am now very sure this is not unique to nixvim - I just noticed it here first - so happy with closing.
The issue is not yet resolved but I am trying to figure out if it is generally bricked in nixpkgs, a nixos issue or a devenv specific issue.
I will update my findings in the linked issue.

@clotodex
Copy link
Author

fixed - was a nix linking user error :D A binary was erroneously linked in my ~/.cargo/bin from before nix times

@GaetanLepage
Copy link
Member

fixed - was a nix linking user error :D A binary was erroneously linked in my ~/.cargo/bin from before nix times

Thank you for reporting your success ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants