添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
帅气的伏特加  ·  [fennec] build fails ...·  5 小时前    · 
很拉风的酱牛肉  ·  No such file or ...·  6 小时前    · 
无聊的生姜  ·  DDP num_workers>0 ...·  8 小时前    · 
有腹肌的啄木鸟  ·  Git 打补丁 | ...·  11 小时前    · 
老实的香槟  ·  page.waitForNavigation ...·  9 月前    · 

Good everyone, I am installing magic mirror, I would like to install spotify and for that I need the librespot library, librespot needs rust to work, but I always get the error "No such file or directory (os error 2) ". I've searched the forum but I haven't seen anything. I don't understand much either, I'm a newbie. OS: Raspbian 11 32bits.

[package]
name = "librespot"
version = "0.4.2"
authors = ["Librespot Org"]
license = "MIT"
description = "An open source client library for Spotify, with support for Spotify Connect"
keywords = ["spotify"]
repository = "https://github.com/librespot-org/librespot"
readme = "README.md"
edition = "2018"
[workspace]
[lib]
name = "librespot"
path = "src/lib.rs"
error: command failed: 'cargo': No such file or directory (os error 2)

Command (no matter the command, they all fail):

cargo build --release
cargo install librespot
              

Yes, I have the "cargo" folder with the executable, it is also added in the PATH.

pruden@raspberrypi:~/.cargo $ echo $PATH
/home/pruden/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
pruden@raspberrypi:~ $ ls .cargo/bin/
cargo         cargo-miri     rust-analyzer  rustfmt      rust-lldb
cargo-clippy  clippy-driver  rustc          rust-gdb     rustup
cargo-fmt     rls            rustdoc        rust-gdbgui
              

When I do an update I also get this error:

pruden@raspberrypi:~ $ rustup update
info: syncing channel updates for 'stable-aarch64-unknown-linux-gnu'
info: checking for self-update
  stable-aarch64-unknown-linux-gnu unchanged - ***(error reading rustc version)***
info: cleaning up downloads & tmp directories
              

Hmm, maybe you have a second version of Rust installed from a package of your OS? What does it say when your run:

> whereis rustup
> whereis rustc
> whereis cargo
              
pruden@raspberrypi:~ $ whereis rustup
rustup: /home/pruden/.cargo/bin/rustup
pruden@raspberrypi:~ $ whereis rustc
rustc: /home/pruden/.cargo/bin/rustc
pruden@raspberrypi:~ $ whereis cargo
cargo: /usr/share/cargo /home/pruden/.cargo/bin/cargo
              
pruden@raspberrypi:~ $ ls /usr/share/cargo/registry/*
/usr/share/cargo/registry/alsa-sys-0.2.0:
build.rs  Cargo.toml  LICENSE  README.md  src
/usr/share/cargo/registry/libc-0.2.80:
build.rs  Cargo.toml  CONTRIBUTING.md  LICENSE-APACHE  LICENSE-MIT  README.md  rustfmt.toml  src  tests  triagebot.toml
/usr/share/cargo/registry/pkg-config-0.3.18:
Cargo.toml  CHANGELOG.md  debian  LICENSE-APACHE  LICENSE-MIT  README.md  src  tests
              

Weird. I don't know where this is coming from but it looks fishy to me. I'm a little bit out of my depth here and I don't want to recommend just deleting it and breaking something on your machine :sweat_smile:

Maybe if your run ~/.cargo/bin/cargo build --release, it will work?

Same mistake... I am so confused...

pruden@raspberrypi:~ $ .cargo/bin/cargo build --release
error: command failed: 'cargo': No such file or directory (os error 2)
              

The other reason you can get “No such file or directory” for an executable that clearly exists is when the error is for a dynamically linked library instead. Cargo doesn’t have any unusual dependencies, but you could try

ldd .cargo/bin/cargo

and see if it's successful or not.

pruden@raspberrypi:~ $ ldd .cargo/bin/cargo
	/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v8l.so (0xf7170000)
	libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0xf7130000)
	librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0xf7118000)
	libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xf70ec000)
	libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xf707d000)
	libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xf7069000)
	libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xf6f15000)
	/lib/ld-linux-armhf.so.3 (0xf794a000)
              

I notice you said you’re using 32-bit Raspbian, but the rustup output you included says

info: syncing channel updates for 'stable-aarch64-unknown-linux-gnu'

which is obviously for 64-bit ARM. I would expect this to be either arm-unknown-linux-gnueabihf or armv7-unknown-linux-gnueabihf. I don’t know about the error message, but this can’t be helping.

I believe the commands to install a different toolchain for ARM would be:

rustup toolchain install stable-arm-unknown-linux-gnueabihf
rustup default stable-arm-unknown-linux-gnueabihf
              

That was the problem, I was using the wrong version, I don't understand why I was downloading that version, now everything works correctly.

Thank you all for the help! ^-^