-
Notifications
You must be signed in to change notification settings - Fork 148
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
Sketch troubleshooting (e.g. Rust installation, rust-analyzer) #750
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f7d9c1d
Sketch troubleshooting.
andreibancioiu 119d0fd
Fix command.
andreibancioiu 8557f22
Merge branch 'development' into troubleshoot-19
andreibancioiu 724f507
Merge branch 'simplify-mxpy-install-docs' into troubleshoot-19
andreibancioiu 33874a1
Update rust install troubleshooter.
andreibancioiu 2e42970
Fix sidebar. Add new page for IDEs.
andreibancioiu 3c46698
Fix invocation of mxpy contract new (for mxpy v9).
andreibancioiu 0fabf97
Fix after review.
andreibancioiu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
id: ide-setup | ||
title: Fix IDEs configuration | ||
--- | ||
|
||
[comment]: # (mx-abstract) | ||
|
||
The issues tackled on this page are related to IDEs preferred by MultiversX builders, such as **VSCode** or **RustRover**. The issues are not strictly related to the official MultiversX VSCode extension (also known as [MultiversX IDE](https://marketplace.visualstudio.com/items?itemName=Elrond.vscode-elrond-ide)). | ||
|
||
[comment]: # (mx-context-auto) | ||
|
||
## VSCode: fix configuration for Rust Analyzer | ||
|
||
If `rust-analyzer` is not working properly on VSCode, you might see (one of) the following error messages: | ||
|
||
``` | ||
- rust-analyzer failed to load workspace: Failed to load the project. | ||
- Failed to query rust toolchain version. | ||
- error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured. | ||
``` | ||
|
||
To fix this, first **[make sure Rust is properly installed](/sdk-and-tools/troubleshooting/rust-setup)**. | ||
|
||
Afterwards, check the content of the configuration file `.vscode/settings.json`. | ||
|
||
Basic `.vscode/settings.json` for Linux: | ||
|
||
```json | ||
{ | ||
"terminal.integrated.env.linux": { | ||
"PATH": "${env:HOME}/multiversx-sdk:${env:HOME}/multiversx-sdk/vmtools:${env:PATH}", | ||
} | ||
} | ||
``` | ||
|
||
Basic `.vscode/settings.json` for MacOS: | ||
|
||
```json | ||
{ | ||
"terminal.integrated.env.osx": { | ||
"PATH": "${env:HOME}/multiversx-sdk:${env:HOME}/multiversx-sdk/vmtools:${env:PATH}", | ||
} | ||
} | ||
``` | ||
|
||
Then, restart VSCode. Now, `rust-analyzer` should work properly. If the problem persists, please [contact us](/developers/overview). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
--- | ||
id: rust-setup | ||
title: Fix Rust installation | ||
--- | ||
|
||
[comment]: # (mx-abstract) | ||
|
||
When encountering issues with your Rust installation, we recommend a cleanup (uninstall) first, especially if you have multiple installations (by accident or on purpose). | ||
|
||
[comment]: # (mx-context-auto) | ||
|
||
## Uninstall existing Rust | ||
|
||
If you've installed Rust using your OS package manager: | ||
|
||
```bash | ||
# Ubuntu | ||
sudo apt remove cargo | ||
sudo apt autoremove | ||
``` | ||
|
||
If you've installed Rust using `rustup`: | ||
|
||
```bash | ||
rustup self uninstall | ||
``` | ||
|
||
If you've installed Rust using `mxpy` with a version older than `v9`: | ||
|
||
```bash | ||
rm -rf ~/multiversx-sdk/vendor-rust | ||
``` | ||
|
||
:::note | ||
Since `mxpy v9` (November of 2023), `mxpy deps install rust` does not create an isolated Rust installation anymore in `~/multiversx-sdk/vendor-rust`. Instead, [it installs Rust _globally_](https://www.rust-lang.org/tools/install). | ||
::: | ||
|
||
If you've installed Rust using `mxpy v9` or later: | ||
|
||
```bash | ||
rustup self uninstall | ||
``` | ||
|
||
[comment]: # (mx-context-auto) | ||
|
||
## Installing Rust and sc-meta | ||
|
||
[comment]: # (mx-context-auto) | ||
|
||
:::note | ||
`sc-meta` is universal smart contract management tool. Please follow [this](/developers/meta/sc-meta) for more information. | ||
::: | ||
|
||
### With mxpy | ||
|
||
```bash | ||
mxpy deps install rust --overwrite | ||
``` | ||
|
||
For more information, go to [managing dependencies using `mxpy`](/sdk-and-tools/sdk-py/mxpy-cli/#managing-dependencies). | ||
|
||
[comment]: # (mx-context-auto) | ||
|
||
### Without mxpy | ||
|
||
As recommended on [rust-lang.org](https://www.rust-lang.org/tools/install): | ||
|
||
```bash | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
``` | ||
|
||
Then, choose **Proceed with installation (default)**. | ||
|
||
Once Rust is installed, switch to a nightly version and install the `wasm32-unknown-unknown` target: | ||
|
||
```bash | ||
rustup default nightly-2023-05-26 | ||
rustup target add wasm32-unknown-unknown | ||
``` | ||
|
||
Afterwards, install `sc-meta`: | ||
|
||
```bash | ||
cargo install multiversx-sc-meta | ||
``` | ||
|
||
Optionally, you may also want to install `wasm-opt` and `twiggy`: | ||
|
||
```bash | ||
cargo install wasm-opt | ||
cargo install twiggy | ||
``` | ||
|
||
[comment]: # (mx-context-auto) | ||
|
||
### Without mxpy (CI / CD) | ||
|
||
For CI / CD, use the following: | ||
|
||
```bash | ||
wget -O rustup.sh https://sh.rustup.rs && \ | ||
chmod +x rustup.sh && \ | ||
./rustup.sh --verbose --default-toolchain nightly-2023-05-26 --target wasm32-unknown-unknown -y | ||
|
||
cargo install multiversx-sc-meta | ||
``` | ||
|
||
[comment]: # (mx-context-auto) | ||
|
||
### Handle missing dependencies of sc-meta | ||
|
||
`sc-meta` requires a few dependencies that are not installed by default on some systems. In this case, installation of `sc-meta` fails. | ||
|
||
For a workaround, please follow this [GitHub issue](https://github.com/multiversx/mx-sdk-py-cli/issues/338). | ||
|
||
## Check your Rust installation | ||
|
||
You can check your Rust installation by invoking `rustup show`: | ||
|
||
``` | ||
$ rustup show | ||
|
||
Default host: x86_64-unknown-linux-gnu | ||
rustup home: /home/ubuntu/.rustup | ||
|
||
installed toolchains | ||
-------------------- | ||
|
||
[...] | ||
nightly-2023-05-26-x86_64-unknown-linux-gnu (default) | ||
|
||
installed targets for active toolchain | ||
-------------------------------------- | ||
|
||
[...] | ||
wasm32-unknown-unknown | ||
|
||
|
||
active toolchain | ||
---------------- | ||
|
||
[...] | ||
nightly-2023-05-26-x86_64-unknown-linux-gnu (default) | ||
``` | ||
|
||
You can also check the status of your Rust installation using `mxpy`: | ||
|
||
``` | ||
$ mxpy deps check rust | ||
|
||
INFO cli.deps: Checking dependency: module = rust, tag = nightly-2023-05-26 | ||
INFO modules: which rustc: /home/ubuntu/.cargo/bin/rustc | ||
INFO modules: which cargo: /home/ubuntu/.cargo/bin/cargo | ||
INFO modules: which sc-meta: /home/ubuntu/.cargo/bin/sc-meta | ||
INFO modules: which wasm-opt: /home/ubuntu/.cargo/bin/wasm-opt | ||
INFO modules: which twiggy: /home/ubuntu/.cargo/bin/twiggy | ||
INFO cli.deps: [rust nightly-2023-05-26] is installed. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
id: troubleshooting | ||
title: Overview | ||
--- | ||
|
||
[comment]: # (mx-abstract) | ||
|
||
Here you can find some common issues and their solutions, in the context of [MultiversX SDKs and Tools](/sdk-and-tools/overview). | ||
|
||
1. [Fix Rust installation](/sdk-and-tools/troubleshooting/rust-setup) | ||
2. [Fix IDEs configuration](/sdk-and-tools/troubleshooting/ide-setup) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: maybe would be good to specify that when installing using mxpy
sc-meta
,twiggy
andwasm-opt
are also installed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.