Skip to content
This repository was archived by the owner on Mar 8, 2025. It is now read-only.

I think this solves the rust-analyzer problem #20

Closed
wants to merge 1 commit into from
Closed

I think this solves the rust-analyzer problem #20

wants to merge 1 commit into from

Conversation

NireBryce
Copy link

Hey, I saw your post on mastodon and decided to investigate.

I got here from error message -> search for "rust standard library environment variable" -> find rust-lang/rust-analyzer#4172 -> search for "RUST_SRC_PATH" nixOS -> https://discourse.nixos.org/t/rust-src-not-found-and-other-misadventures-of-developing-rust-on-nixos/11570/5

which just requires plopping RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; in flake.nix, at least on my machine (nixOS, though, so I haven't tested other OSes)

I don't know much of the rust ecosystem on nix, and I'm fairly new to nix (via nixOS), but this seems to fix the rust analyzer issues for me.

I'm having other rust problems because nixOS, but if you could test this and see if it works it might be an easy fix -- it got rid of the error you were talking about.

@bluelinden
Copy link
Member

Thank you so much for the investigation! I made my way to a band-aid fix that works on my machine like two hours ago, completely on accident. The solution was just to add:

[build]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]

to backend/.cargo/config.toml. I think the problem may have been something to do with rustc linking to glibc in a weird way, and my patch solved the problem at least temporarily. I'll look into your fix as well. Thank you for the effort, and have a good day!

@bluelinden
Copy link
Member

it turns out that the problem was in BuildFHSEnv anyway - closing this now as i ended up figuring it out for real.

@bluelinden bluelinden closed this Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants