edubkendo / atom-racer

Intelligent code completion for Rust in the Atom Editor. Requires Racer.
MIT License
115 stars 24 forks source link

racer returned a non-zero exit code: 1 null #57

Open amosjyng opened 8 years ago

amosjyng commented 8 years ago

Path to the Racer executable is /home/amos/custom/racer/target/release/racer. It looks right to me:

➜  rust git:(master) which racer
/home/amos/custom/racer/target/release/racer

Path to the Rust source code directory is /home/amos/custom/rust. Also looks right to me:

➜  rust git:(master) pwd
/home/amos/custom/rust
➜  rust git:(master) ls
AUTHORS.txt      COPYRIGHT       LICENSE-MIT  README.md
config.mk        dist            Makefile     RELEASES.md
config.stamp     dl              Makefile.in  src
configure        doc             man          tmp
CONTRIBUTING.md  LICENSE-APACHE  mk           x86_64-unknown-linux-gnu

language-rust is installed.

Do you recognize this error message, or is it a bug with racer? If so, how can I get more information so I can file it with the racer folks?

dwtj commented 8 years ago

I ran into this same issue at first.

In the atom-racer settings, try setting your "Path to the Rust source code directory" not to the root of the rust repo but to the src/ directory within it. So, in your case, try /home/amos/custom/rust/src/.

Maybe the README.md could be slightly clearer on this point.

edubkendo commented 8 years ago

I'd happily take a PR that fixed this to support both sets of paths :)

charleskorn commented 8 years ago

Also seeing this problem... is there a way I can see the output from racer to try to work out what's going on?

CNLambda commented 8 years ago

I have this problem, but I don't see anything I may have configured wrong. I have the racerBinPath pointing to the executable (/Users/CodenameLambda/.cargo/bin/racer) and I have the rustSrcPath pointing to the source directory in the Rust-Repository (/Users/CodenameLambda/rust/src). The best thing is: It does work under the shell with no problems (racer complete std::f yields me the three modules fmt, ffi and fs). Any idea where this could come from? The best thing about it is: It works if I start atom from the shell. I have no idea why. (MacOS X, and I am not proud of it, put I have no choice. I want my linux back! Everything just works under linux, but I had so many problems under MacOS X now...)

isomorpheme commented 8 years ago

Had the same issue on Windows, but setting the RUST_SRC_PATH environment variable manually seems to have fixed it.

chriskrycho commented 7 years ago

I can confirm that manually setting RUST_SRC_PATH fixed the same issue on OS X as well.

fanyer commented 7 years ago

same problem, also fixed by setting RUST_SRC_PATH, which is linked to the rust repo cloned from github

White-Oak commented 7 years ago

Had the same problem, was fixed setting RUST_SRC_PATH on Arch Linux

versions `rustc 1.14.0-nightly (a7bfb1aba 2016-10-09)` ``` Atom : 1.10.2 Electron: 0.37.8 Chrome : 49.0.2623.75 Node : 5.10.0 ``` ``` > apm show racer racer ├── 0.20.0 ```
aurabindo commented 7 years ago

Mine was working for a few days, but suddenly it started failing with this error. Any hints to debug?

bunnybooboo commented 7 years ago

@aurabindo I fixed my installation using this method https://github.com/edubkendo/atom-racer/issues/61#issuecomment-272695463

thomanski commented 7 years ago

I've tried @bunnybooboo's suggestion but am still getting non-zero exit code: 1 null. My paths in atom are set to /home/MYUSER/.cargo/bin/racer and /home/MYUSER/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src

They don't contain any trailing whitespace, RUST_SRC_PATH is set almost the same as in Atom but with an additional /rust/src at the end (i.e. /home/MYUSER/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src).

This all works beautifully from the command-line:

$ RUST_SRC_PATH=/home/$USER/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src /home/$USER/.cargo/bin/racer complete std::io::B | wc -l
4

And completion does work to an extent in Atom as well (though only for entities in my source code and language keywords, use std in contrast does not offer anything) but not without a lot of the non-zero exit code messages.

This is on Debian Jessie, Atom 1.13.1, atom-racer 0.20.0.

NfNitLoop commented 7 years ago

I'm having this issue above. The real problem here is that it's not obvious at all what's causing the error. If the stdout/stderr output of the command was shown along with the exit code, we all might be able to figure this out for ourselves. :)

thomanski commented 7 years ago

@NfNitLoop I remember that I found an earlier version of this issue where someone provided a PR to add the error message and that's what you are seeing coming through as "1 null".

In the end I installed VS Code, added the vscode-rust extension (a very active fork of the now unmaintained RustyCode, brilliantly maintained & developed by @KalitaAlexey) plus TOML Language Support and Native Debug (haven't used that one yet, actually).

I am really impressed with it all.

Nokel81 commented 7 years ago

This is still happening for myself on Windows, my settings are the following:

C:\Users\snmalton.cargo\bin\racer.exe C:\Users\snmalton.rustup\toolchains\stable-x86_64-pc-windows-msvc

Emka877 commented 5 years ago

Reporting in as ticket is not closed, the plugin works 100%.

@Nokel81 Your second path is erroneous I'm afraid: It should read: [your custom path]\toolchains\stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/ (Adapt the path to your case, I'm on linux and have a completely different path) After that, restart Atom (important), and it should work without issue.

troglodyt commented 5 years ago

For me, it seems that the relevant difference was the slash at the end of the path:

jasex commented 3 years ago

This is rediculous. I am working on arch linux. Have set RUST_SRC_PATH (tried both with / and without) Tried start from terminal There is no src directory under /home/zj/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust There is Cargo.lock and a directory names library. SO I git clone https://github.com/rust-lang/rust.git and point the path to ~/rust/src (tried both with and without slash) None of these work!! Almost drive me CRAZY

jasex commented 3 years ago

This is rediculous. I am working on arch linux. Have set RUST_SRC_PATH (tried both with / and without) Tried start from terminal There is no src directory under /home/zj/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust There is Cargo.lock and a directory names library. SO I git clone https://github.com/rust-lang/rust.git and point the path to ~/rust/src (tried both with and without slash) None of these work!! Almost drive me CRAZY

Solved this problem. Just change the RUST_SRC_PATH=/home/$USER/rust/library(not src)

vmperrone commented 2 years ago

Reporting in as ticket is not closed, the plugin works 100%.

@Nokel81 Your second path is erroneous I'm afraid: It should read: [your custom path]\toolchains\stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/ (Adapt the path to your case, I'm on linux and have a completely different path) After that, restart Atom (important), and it should work without issue.

I was just experiencing this issue on Atom for Windows and found the solution was in fact to use the path [*]\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\

That is, using library at the end, not src. Also, restarting Atom is necessary for the message to go away, as you noted.

This is implied on the racer-rust github repo, they wrote in their README, "Fetch the Rust sourcecode automatically via rustup and run rustup component add rust-src in order to install the source to $(rustc --print sysroot)/lib/rustlib/src/rust/library (or $(rustc --print sysroot)/lib/rustlib/src/rust/src in older toolchains"

So it appears in newer versions you need library, not src.