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

error: command failed: 'rust' error: caused by: No such file or directory (os error 2) #2565

Closed
corvinux opened this issue Nov 22, 2020 · 12 comments
Labels

Comments

@corvinux
Copy link

cat /proc/cpuinfo
Processor : AArch64 Processor rev 4 (aarch64)
processor : 0
processor : 1
processor : 2
processor : 3
processor : 4
processor : 5
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 wp half thumb fastmult vfp edsp neon vfpv3 tlsi vfpv4 idiva idivt
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

Hardware : Qualcomm Technologies, Inc MSM8956

uname -a
Linux XperiaX 3.10.84 #1 SMP PREEMPT Sun Jul 12 19:46:59 UTC 2020 aarch64 GNU/Linux

ldd .cargo/bin/rustc
/usr/lib/libpreloadpatchmanager.so (0xf6f68000)
libdl.so.2 => /lib/libdl.so.2 (0xf6f48000)
librt.so.1 => /lib/librt.so.1 (0xf6f32000)
libpthread.so.0 => /lib/libpthread.so.0 (0xf6f0b000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf6ef2000)
libc.so.6 => /lib/libc.so.6 (0xf6dd9000)
libm.so.6 => /lib/libm.so.6 (0xf6d6f000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xf6c5d000)
/lib/ld-linux-armhf.so.3 (0xaab87000)

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

/home/defaultuser/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory located at:

/home/defaultuser/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

/home/defaultuser/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

/home/defaultuser/.profile
/home/defaultuser/.bash_profile

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:

default host triple: aarch64-unknown-linux-gnu
default toolchain: stable
profile: default
modify PATH variable: yes

  1. Proceed with installation (default)
  2. Customize installation
  3. Cancel installation

1

info: profile set to 'default'
info: setting default host triple to aarch64-unknown-linux-gnu
info: syncing channel updates for 'stable-aarch64-unknown-linux-gnu'
info: latest update on 2020-11-19, rust version 1.48.0 (7eac88abb 2020-11-16)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std'
25.0 MiB / 25.0 MiB (100 %) 5.9 MiB/s in 4s ETA: 0s
info: downloading component 'rustc'
61.8 MiB / 61.8 MiB (100 %) 6.3 MiB/s in 10s ETA: 0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: Defaulting to 500.0 MiB unpack ram
4.6 MiB / 4.6 MiB (100 %) 3.5 MiB/s in 1s ETA: 0s
info: installing component 'clippy'
info: installing component 'rust-std'
25.0 MiB / 25.0 MiB (100 %) 4.6 MiB/s in 5s ETA: 0s
info: installing component 'rustc'
61.8 MiB / 61.8 MiB (100 %) 5.9 MiB/s in 10s ETA: 0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable'

stable installed - (error reading rustc version)

Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
environment variable. Next time you log in this will be done
automatically.

To configure your current shell run source $HOME/.cargo/env
I tried this code:

rustc -V
I expected to see this happen: rustc 1.48.0 (7eac88a 2020-11-16)

Instead, this happened: error: command failed: 'cargo' error: caused by: No such file or directory (os error 2)'

Meta

There is the same in the beta or nightly versions.

rustc --version --verbose:

error: command failed: 'rustc'
error: caused by: No such file or directory (os error 2)
RUST_BACKTRACE=1 rustc -V --verbose
error: backtrace:
0: backtrace::capture::Backtrace::new_unresolved

1: error_chain::backtrace:👿:InternalBacktrace::new

2: rustup_init::main

3: std::rt::lang_start_internal::{{closure}}::{{closure}}
at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7/src/libstd/rt.rs:52
std::sys_common::backtrace::__rust_begin_short_backtrace
at /rustc/c7087fe00d2ba919df1d813c040a5d47e43b0fe7/src/libstd/sys_common/backtrace.rs:130

4: main

5: __libc_start_main

@kinnison
Copy link
Contributor

Hi, this is fascinating because clearly the rustup itself works, and yet the installed toolchain does not.

Could you please ensure strace is installed on your system and then do:

rustup run strace -o try-run-rustc.txt rustc --version

Attach the resulting file, and paste the output, in a new comment.

Thanks.

@corvinux
Copy link
Author

Hi Daniel,
Yes, it is, fascinating :) I'm trying running rustup (rustc, cargo) on Sony Xperia X running Sailfish OS 3.4.0.24. Otherwise there is distribution rust installation package (rust, cargo, Version: 1.44.0+git3-1.2.3.jolla) which works just fine.

rustup run stable strace -o try-run-rustc.txt rustc --version
[error:]command failed: 'rustc'
error: caused by: No such file or directory (os error 2)
try-run-rustc.txt

@kinnison
Copy link
Contributor

Next could you run ls -l .rustup/toolchains/stable*/bin/ and assuming that shows a rustc binary, try running ldd on that binary.
e.g. ldd .rustup/toolchains/stable*/bin/rustc

@corvinux
Copy link
Author

ldd rustc
not a dynamic executable
[defaultuser@XperiaX bin]$ ls -lsah rustc
16 -rwxr-xr-x 1 defaultu defaultu 14.3K Nov 24 21:18 rustc
[defaultuser@XperiaX bin]$ file rustc
rustc: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 4.2.6, not stripped

@kinnison
Copy link
Contributor

Okay, so when you posted the ldd of rustup I assumed you had a multiarch system.

The output of ldd rustc suggests you don't - and in fact despite having an aarch64 CPU you're running an armhf userland which is something we weren't expecting.

Were you expecting to run the 64 bit arm toolchain on that system, or were you hoping for an armhf toolchain?

@corvinux
Copy link
Author

Yes, exactly that's it. SailfishOS is actually running 32bit apps in userspace. I remember now, that I also asked this question on Jolla forum https://together.jolla.com/question/192062/whan-will-sailfish-os-become-full-64-bit-os/
Also, when I've installed Rust package from SailfishOS repository
Repository : jolla
Name : rust
Version : 1.44.0+git3-1.2.3.jolla
Arch : armv7hl
Vendor : meego
Installed Size : 56.9 MiB
Installed : Yes
Status : up-to-date
Source package : rust-1.44.0+git3-1.2.3.jolla.src
Summary : The Rust Programming Language
Description :
Rust is a systems programming language that runs blazingly fast, prevents
segfaults, and guarantees thread safety.

This package includes the Rust compiler and documentation generator.

[defaultuser@XperiaX ~]$ file /usr/bin/rustc
/usr/bin/rustc: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=2d629045db0e85454db1c4e8e048069a1bf2bc61, for GNU/Linux 3.2.0, not stripped

I wasn't thinking about toolchain, I just wanted to install rust with rustup.

@corvinux
Copy link
Author

I'm back on track, thank you Daniel.

Current installation options:

default host triple: armv7-unknown-linux-gnueabihf
default toolchain: stable
profile: default
modify PATH variable: yes

  1. Proceed with installation (default)
  2. Customize installation
  3. Cancel installation

1

info: profile set to 'default'
info: setting default host triple to armv7-unknown-linux-gnueabihf
info: syncing channel updates for 'stable-armv7-unknown-linux-gnueabihf'
info: latest update on 2020-11-19, rust version 1.48.0 (7eac88abb 2020-11-16)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-std'
18.2 MiB / 18.2 MiB (100 %) 6.4 MiB/s in 3s ETA: 0s
info: downloading component 'rustc'
66.8 MiB / 66.8 MiB (100 %) 6.2 MiB/s in 10s ETA: 0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: Defaulting to 500.0 MiB unpack ram
4.7 MiB / 4.7 MiB (100 %) 3.7 MiB/s in 1s ETA: 0s
info: installing component 'clippy'
info: installing component 'rust-std'
18.2 MiB / 18.2 MiB (100 %) 4.5 MiB/s in 3s ETA: 0s
info: installing component 'rustc'
66.8 MiB / 66.8 MiB (100 %) 6.1 MiB/s in 10s ETA: 0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable'

stable installed - rustc 1.48.0 (7eac88abb 2020-11-16)

Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
environment variable. Next time you log in this will be done
automatically.

To configure your current shell run source $HOME/.cargo/env
[defaultuser@XperiaX ~]$ source $HOME/.cargo/env
[defaultuser@XperiaX ~]$ rustc -V
rustc 1.48.0 (7eac88abb 2020-11-16)

@komal-1
Copy link

komal-1 commented Apr 3, 2022

rustup run strace -o try-run-rustc.txt rustc --version

After running this command i am getting this :

error: Found argument '-o' which wasn't expected, or isn't valid in this context

USAGE:
rustup run [FLAGS] ...

For more information try --help

please guide me towards it.

@komal-1
Copy link

komal-1 commented Apr 3, 2022

Screenshot from 2022-04-03 22-19-47

@corneliusroemer
Copy link

Possibly related on Stackoverflow

@bek-shoyatbek
Copy link

hi , I have a question . I deleted .cargo file by mistake in my ubuntu system folder then when i turn on my pc , my pc displays bash: /home/bek/.cargo/env: No such file or directory . How can I fix it.

@01mf02
Copy link

01mf02 commented Nov 27, 2023

@bek-shoyatbekov, try removing the line . "$HOME/.cargo/env" from your ~/.profile file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants