rustsolanaanchor-solanasolana-clirustup

How can fix 'error reading rustc version' when running anchor test?


I installed rust on Ubuntu and checked that version but there's rustc version error.

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)`

I need 'rustc' to use anchor test. But I can't use it due to this error. I've reinstalled rust but there's no change. How can i fix this problem?

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

Solution

  • It looks like there was an issue installing rustc, even though you have rustup. A few things you can try:

    More information about rustup at its book: https://rust-lang.github.io/rustup/installation/index.html