rust-script icon indicating copy to clipboard operation
rust-script copied to clipboard

No such file or directory (os error 2)

Open joshcangit opened this issue 1 year ago • 8 comments

Version 0.23.0 keeps giving me an error whenever I run a script.

error: No such file or directory (os error 2)

Had to use the previous version for it to work.

Version info:

cargo 1.68.1
rustc 1.68.1 (8460ca823 2023-03-20) (built from a source tarball)

Get readelf -p .comment

String dump of section '.comment':
  [     0]  mold 1.11.0 (compatible with GNU ld)
  [    25]  Android (9352603, based on r450784d1) clang version 14.0.7 (https://android.googlesource.com/toolchain/llvm-project 4c603efb0cca074e9238af8b4106c30add4418f6)

joshcangit avatar Mar 26 '23 05:03 joshcangit

However on my PC, it works fine.

String dump of section '.comment':
  [     0]  GCC: (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0
  [    2b]  mold 1.11.0 (cca255e6be069cdbc135c83fd16036d86b98b85e; compatible with GNU ld)

joshcangit avatar Mar 26 '23 07:03 joshcangit

Also to add, Rust is now broken on Termux Android.

termux/termux-packages#15851

After the libllvm package updated from 15.0.7-3 to 16.0.0, the rust package had to be removed.

This was just 2 days after I posted this issue. I'll try to test this again after Rust is fixed.

joshcangit avatar Apr 01 '23 10:04 joshcangit

Nope, 0.23.0 still won't work. This issue still persists in later versions.

Something changed after 0.22.0 that caused it to stop working. https://github.com/fornwall/rust-script/compare/0.22.0...0.23.0

Tried running with this configuration.

[build]
RUSTFLAGS = ["-Clink-arg=-Wl,-rpath=/data/data/com.termux/files/usr/lib", "-Clink-arg=-Wl,--enable-new-dtags"]

Also won't work.

joshcangit avatar Apr 02 '23 03:04 joshcangit

Are you installing rust-script via Nix or similar? I realized that using it via nix this error occurs, but via cargo install it works. :thinking:

tennox avatar May 16 '23 21:05 tennox

Are you installing rust-script via Nix or similar?

I'm using the rust package installed by apt in Termux. No, I didn't install Nix-on-Droid.

joshcangit avatar May 17 '23 04:05 joshcangit

Could this be an issue regarding glibc? Termux uses Bionic libc so if this requires glibc it won't work.

joshcangit avatar Dec 13 '23 13:12 joshcangit

I get this error when CARGO_BUILD_TARGET is defined (I use it to compile to musl). The binary is built in the $HOME/.cache/rust-script/binaries/$CARGO_BUILD_TARGET directory and I can run it manually, so probably rust-script is not looking in the correct build directory when cross compiling.

migel avatar Jan 06 '24 00:01 migel

Same here. I use CARGO_BUILD_TARGET=aarch64-linux-android to get Rust to work on Termux.

Thought it was just rust-script that hard coded pathnames to follow the Linux File System.

joshcangit avatar Jan 06 '24 05:01 joshcangit