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

Unable to find libstd under RUST_SRC_PATH. #146

Closed
PlumpHip opened this issue Oct 27, 2020 · 7 comments
Closed

Unable to find libstd under RUST_SRC_PATH. #146

PlumpHip opened this issue Oct 27, 2020 · 7 comments

Comments

@PlumpHip
Copy link

PlumpHip commented Oct 27, 2020

% racer complete std::io::B
Unable to find libstd under RUST_SRC_PATH. N.B. RUST_SRC_PATH variable needs to point to the src directory inside a rust checkout e.g. "/home/foouser/src/rust/src". Current value ""/nix/store/fjghknnd4x9zpgx6hxznaiw6c7y0jr2s-rust-1.47.0-2020-10-07-18bf6b4f0/lib/rustlib/src/rust/library/libstd""

I use nix Mozilla-rust-overlay stable

  nixpkgs.latest.rustChannels.stable.rust.override {
      extensions = [ #
      # "lldb-preview"
      "clippy-preview"
      # "miri-preview"
      "rls-preview"
      # "rust-analyzer-preview"
      "rustfmt-preview"
      "llvm-tools-preview"
      "rust-analysis"
      "rust-std"
      "rustc-dev"
      # "rustc-docs"
      "rust-src"
      
      ]

Thanks

@SkamDart
Copy link

Same as above but a full shell.nix for repro.

with import <nixpkgs> {};

let
  crust = (rustChannels.stable.rust.override { extensions = [ "rust-src" "rust-analysis" ]; });
in
stdenv.mkDerivation {
  name = "repro";
  buildInputs = [ crust rustracer ];
  RUST_SRC_PATH = "${crust}/lib/rustlib/src/rust/src";
}

@PlumpHip
Copy link
Author

PlumpHip commented Nov 1, 2020

@SkamDart
hmm;; Thank you for your answer, but I can't.

maybe necessary
shell.nix & buildInputs = [ crust rustracer ]; ?

Is it possible to do this only with a local nix project? (I haven't tried it.)

I want a simple global, #140

I'll have to give up nix provisioning and do it manually. T_T. Still, thank you so much for telling me the local method.
I wanted to know.

@PlumpMath
Copy link

I solved this problem.
Reason is racer latest version.
Cargo install racer.
THANKS.

@udalrich
Copy link

udalrich commented Feb 3, 2021

This is failing on Mac OS Catalina.

$ rustup self update
info: checking for self-updates
  rustup unchanged - 1.23.1
$ rustup component add rust-src
info: component 'rust-src' is up to date
$ cargo +nightly install racer
    Updating crates.io index
  Installing racer v2.1.43
   Compiling libc v0.2.85
...
error[E0658]: use of unstable library feature 'array_value_iter'
   --> /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_arena-702.0.0/src/lib.rs:134:40
    |
134 | impl<T, const N: usize> IterExt<T> for std::array::IntoIter<T, N> {
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #65798 <https://github.com/rust-lang/rust/issues/65798> for more information
    = help: add `#![feature(array_value_iter)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'array_value_iter_slice'
   --> /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_arena-702.0.0/src/lib.rs:144:18
    |
144 |             self.as_slice().as_ptr().copy_to_nonoverlapping(start_ptr, len);
    |                  ^^^^^^^^
    |
    = note: see issue #65798 <https://github.com/rust-lang/rust/issues/65798> for more information
    = help: add `#![feature(array_value_iter_slice)]` to the crate attributes to enable

error: aborting due to 2 previous errors
$ uname -a
Darwin my-mac 19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64

Although the issue might be that the installation instructions don't cause libstd to be installed:

$ find ~/.rustup -name libstd
$

Running M-x racer-debug does show that RUST_SRC_PATH is set to a directory that exists. But the only file in that directory is the llvm-project directory.

@udalrich
Copy link

A workaround (at least on a Mac) is to customize racer-rust-src-path. Racer had inferred it to be <stuff>/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src. Changing the last element to library fixed made it work for me. There are comments elsewhere on the net that rust changed where it installs system files, and racer has not caught up to that yet.

@b-naber
Copy link

b-naber commented Mar 2, 2021

I cannot get this to work. Neither re-installing racer not changing racer-rust-src-path works for me. Racer tries to find libstd, that file doesn't exist in the current rust installation, the standard library is named std not libstd. Is this a problem caused by emacs-racer or racer itself?

@Wilfred
Copy link
Member

Wilfred commented Mar 7, 2021

#143 should fix this, but please reopen if you still have issues.

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

No branches or pull requests

6 participants