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

Cargo project update failed: no explicit stdlib or rustup found #2267

Open
devurandom opened this issue Feb 5, 2018 · 15 comments
Open

Cargo project update failed: no explicit stdlib or rustup found #2267

devurandom opened this issue Feb 5, 2018 · 15 comments
Assignees

Comments

@devurandom
Copy link
Contributor

When working on the Rust source code itself, IntelliJ Rust complains "Cargo project update failed: no explicit stdlib or rustup found". I am not sure what this means, exactly.

Further, IntelliJ Rust says at the top of any file that it "Can not attach stdlib sources automatically without rustup", but when I try to "Attach manually", it tells me that "Invalid Rust standard library source path: <.../rust/src/libstd>", where rust/src/libstd is the path to the source code of libstd. What exactly is IntelliJ Rust search for, when it asks for the location of that library source code?

It appears that these error message could be enriched to make it easier for the user to solve the issue. I would be glad to contribute such a patch, but am unable to do so without additional help and information.

@vlad20012 vlad20012 self-assigned this Feb 5, 2018
@devurandom
Copy link
Contributor Author

Is it possible, that what IntelliJ Rust actually wants, is the path to the Rust source code containing a "libstd" directory?

In which case it might get a little bit more automatism by looking at src/Cargo.toml and seeing that this is a copy of the Rust source code, and ask me whether I want to use that one.

@devurandom
Copy link
Contributor Author

I'd like to assign this to myself, if possible, and see whether I can come up with some wording that's more detailed and easier to understand.

devurandom added a commit to devurandom/intellij-rust that referenced this issue Feb 7, 2018
The original intention was to improve error message, which was confusing
 some users.  Since the source code itself was also referring to the
 Rust source as "stdlib" or "standard library", I fixed that as well.

Fixes: intellij-rust#2267

Signed-off-by: Dennis Schridde <devurandom@gmx.net>
@devurandom
Copy link
Contributor Author

Please note that #2275 does NOT yet detect that the currently open project is a copy of the Rust source code and hence it does not yet offer the user to just use this source.

@QasimK
Copy link

QasimK commented Mar 15, 2018

I have also tried to solve this by providing the path "/usr/lib/rustlib/src/rust/src/libstd" but it is not being accepted :(

Edit: Go with /usr/lib/rustlib/src/rust/src.

@dkandalov
Copy link

The problem still exists in the latest IJ (Build #IU-182.3911.13), Rust plugin Version: 0.2.0.2101-182.

In my case the problem seemed to be with rust installed via brew. After brew uninstall rust I followed installation instructions here https://www.rust-lang.org/en-US/install.html, i.e. curl https://sh.rustup.rs -sSf | sh. I had to point IJ to ~/.cargo/bin/rustc in a UI dialog but the error message was gone.

@TriplEight
Copy link

TriplEight commented Aug 20, 2018

Faced the same problem, that's because I was following setup instructions from TheBook.

To prove it won't work type $ which rustup and it won't answer.

So to avoid that in IDEA you should uninstall Rust first:

  1. run /usr/local/lib/rustlib/uninstall.sh as root to uninstall Rust

  2. follow installation instructions on https://www.rust-lang.org/en-US/install.html or just $ curl r/[https://sh.rustup.rs](https://sh.rustup.rs) \-sSf | sh

  3. now $ which rustup should work, copy that path to IDEA.

  4. now it will loose the toolchain, which is here: /home/username/.cargo/bin

  5. and the standard library, IDEA will tell it can download it

Now it works.

devurandom added a commit to devurandom/intellij-rust that referenced this issue Sep 27, 2018
The original intention was to improve error message, which was confusing
 some users.  Since the source code itself was also referring to the
 Rust source as "stdlib" or "standard library", I fixed that as well.

Fixes: intellij-rust#2267

Signed-off-by: Dennis Schridde <devurandom@gmx.net>
devurandom added a commit to devurandom/intellij-rust that referenced this issue Sep 27, 2018
The original intention was to improve error message, which was confusing
 some users.  Since the source code itself was also referring to the
 Rust source as "stdlib" or "standard library", I fixed that as well.

Fixes: intellij-rust#2267

Signed-off-by: Dennis Schridde <devurandom@gmx.net>
@rkmax
Copy link

rkmax commented Jan 25, 2019

I can confirm this issue, create a new project from Rust application binary template and receive no explicit stdlib or rustup, but in my case I've installed rust 1.32.0 from my package manager. adding the path /usr/lib/rustlib/src/rust/src when the proyect is being created or later on the project settings solves the issue

@t0r0X
Copy link

t0r0X commented Mar 31, 2019

On macOS had the same issue, with both InelliJ and CLion, and like @dkandalov I had Rust initially installed with Homebrew. With CLion I was able to build (IntelliJ kept complaining about missing SDK), but the error message was annoying. It looks like Homebrew does not install the sources, if I understand the problem correctly.

To get rid of it, I first uninstalled Rust: brew uninstall rust, brew cleanup. Then I installed rustup-init, and then with it I installed rustup (yes, I could have installed rustup manually, but I try to use as much as possible Homebrew and Sdkman):

  • brew install rustup-init
  • rustup-init with some interactive options, downloads and installs Rust and rustup.

After that, in the welcome dialogue I've let CLion retrieve the standard library:
Configure > Preferences > Languages & Frameworks > Rust > 'Download via rustup'

Screenshot 2019-03-31 15 02 28

The library is then in /Users/USERNAME/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src:
Screenshot 2019-03-31 15 20 37

New projects then have the settings already.
Screenshot 2019-03-31 15 32 57

@omenos
Copy link

omenos commented Feb 28, 2020

I was in the process of filling out an addition to this thread as I thought I had this problem, but I found a related issue. I hadn't personally gone into the global settings or project settings and set the Rust toolchain preferences as they were being autofilled at project creation time. However, I was still getting the issue reported above. While in the project (and global) settings, if I navigated to the Rust settings, the settable fields would be empty then autofill with the Apply button ready to be pressed. Once doing so the plugin works fine. It seems the settings (though showing correctly initially) actually weren't being set in the background.

CLion: 2019.3.4
Rust: 0.2.116.2163-193

@kxxu
Copy link

kxxu commented Apr 24, 2020

rustup did not successfully install and configure the stable toolchain, you can do it manually(in $home/.cargo/bin):
rustup install stable
rustup default stable
after that, restart idea

@f35f0ef9d0e827dae86552d3899f78fc

rustup did not successfully install and configure the stable toolchain, you can do it manually(in $home/.cargo/bin):
rustup install stable
rustup default stable
after that, restart idea

This helped me. As an Arch user, I ran these commands to essentially reinstall Rust the way PyCharm wanted me to (I guess?):

sudo pacman -S rustup
When it asks to remove Rust since it's in conflict, answer Y.
rustup toolchain install stable
Restart the IDE

@itsmeadi
Copy link

itsmeadi commented Feb 10, 2021

on MacOS, adding the rust path in global PATH worked for me
sudo echo $HOME/.cargo/bin>>/etc/paths

@Leniorko
Copy link

Leniorko commented Oct 8, 2021

rustup did not successfully install and configure the stable toolchain, you can do it manually(in $home/.cargo/bin):
rustup install stable
rustup default stable
after that, restart idea

This helped me. As an Arch user, I ran these commands to essentially reinstall Rust the way PyCharm wanted me to (I guess?):

sudo pacman -S rustup When it asks to remove Rust since it's in conflict, answer Y. rustup toolchain install stable Restart the IDE

Worked for me. Thanks!

@Daxe9
Copy link

Daxe9 commented Apr 27, 2022

as a linux user, i solved this problem by uninstall rust and install rustup using

curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh

and restarting the ide should finish the work

@devurandom devurandom removed their assignment Dec 27, 2022
@aduntong
Copy link

aduntong commented Feb 15, 2023

I think I know how to fix this issue for Windows 10 +.
The toolchain location and standard library location is different with in the documents.
Just set paths like following:
toolchain location:
C:\Users[username].rustup\toolchains\stable-x86_64-pc-windows-msvc\bin
standard library:
C:\Users[username].rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib

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

Successfully merging a pull request may close this issue.