我在Ubuntu上安装了rust并检查了该版本,但存在rustc版本错误。
myunixx@LAPTOP-JSMKVSS3:~$ rustup --version
rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `(error reading rustc version)`
我需要"rustc"才能使用anchor test
。但是由于这个错误,我无法使用它。我重新安装了铁锈,但没有变化。我该如何解决这个问题?
myunixx@LAPTOP-JSMKVSS3:~/myepicproject$ anchor test
Failed to obtain package metadata: `cargo metadata` exited with an error: error: process didn't exit successfully: `rustc -vV` (exit status: 127)
--- stderr
/home/myunixx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc: error while loading shared libraries: /home/myunixx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/libstd-7c582493123fc1dd.so: file too short
尽管您有rustup
,但安装rustc
时似乎出现了问题。你可以尝试的几件事:
- 也许Rust可以自行修复:运行
rustup update
- 显式添加工具链:运行
rustup toolchain install stable
- 重新安装rustup:运行
rustup self uninstall
,然后返回上的说明https://www.rust-lang.org/tools/install
有关rustup的更多信息,请参阅其书籍:https://rust-lang.github.io/rustup/installation/index.html