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

rust-src component not found. #70

Closed
ntduan opened this issue Aug 10, 2020 · 10 comments · Fixed by #71
Closed

rust-src component not found. #70

ntduan opened this issue Aug 10, 2020 · 10 comments · Fixed by #71

Comments

@ntduan
Copy link

ntduan commented Aug 10, 2020

When I execute cargo +nightly Contract build, I got an error.

 `rust-src` component not found. Run `rustup component add rust-src`.

But I think I have rust-src installed, and the rustup component list | grep rust-src also shows that I have rust-src installed.

I tried to specify rust-src manually through export XARGO_RUST_SRC=/home/nzzt/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library, and I succeeded in the next step, but unfortunately another error occurred.

I checked the directory on my computer and found that it didn't match the actual directory.

image

image

@ascjones
Copy link
Collaborator

It does look like nightly is your default toolchain, but anyway double check that it is installed with rustup component list --toolchain nightly | grep rust-src. If it's not you can do rustup component add rust-src --toolchain nightly

@ntduan
Copy link
Author

ntduan commented Aug 11, 2020

@ascjones
➜ flipper rustup component list --toolchain nightly | grep rust-src
rust-src (installed)

=========================
I compared the code with someone else who could build normally, and I found an interesting problem. His rust-src directory is .rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src, but my rust-src directory is .rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library.

image

This looks like a version upgrade issue. I'm not very familiar with Rust, I'm not sure.

@ascjones
Copy link
Collaborator

Yeah mine is also rust/src, which is what I would expect it to be. Could try reinstalling everything, or perhaps do rustup update --toolchain nightly && rustup component add rust-src --toolchain nightly

@ntduan
Copy link
Author

ntduan commented Aug 11, 2020

@ascjones
In fact, not only have I reinstalled it, I've also tried it on a newly installed server. I've tried it on three computers. I get the same error.

@ntduan
Copy link
Author

ntduan commented Aug 11, 2020

image
image
Perhaps it is because of a recent change in the structure of rust's source code. Just a few days ago.

@ntduan
Copy link
Author

ntduan commented Aug 11, 2020

After I installed the old version nightly, The problem was solved. When installing rust-src, It also need to specify the version. like rustup component add rust-src --toolchain nightly-2020-07-11

@ascjones
Copy link
Collaborator

ascjones commented Aug 11, 2020

@ascjones
Copy link
Collaborator

See #71, I won't merge this yet but you can install from the PR branch if you want to use it in the meantime.

@MaciejBaj
Copy link

@aniiantt Bumping cargo-xbuild to 0.6.0 works

@Valentine-Mario
Copy link

Upgrading cargo-xbuild didn't seem to work for me.

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.

4 participants