termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.33k stars 3.07k forks source link

[Bug]: rustup could not choose a version of rustc #19565

Closed tmak2002 closed 7 months ago

tmak2002 commented 7 months ago

Problem description

~ $ rustc --version error: rustup could not choose a version of rustc to run, because one wasn't specified explicitly, and no default is configured. help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.

What steps will reproduce the bug?

pkg install rust
rustc --version

What is the expected behavior?

No response

System information

termux-info:

~ $ termux-info
Termux Variables:
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=15224
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirrors.sau.edu.cn/termux/apt/termux-main stable main
Updatable packages:
All packages up to date
termux-tools version:
1.41.2
Android version:
14
Kernel build information:
Linux localhost 5.10.209-android13-4-g6ef5c4eb0baf #1 SMP PREEMPT Thu Mar 21 15:09:43 UTC 2024 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 6
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.styling versionCode:31
Grimler91 commented 7 months ago

I cannot reproduce the issue, rustc --version works fine on my aarch64 device.

Title and error message mentions rustup. Are you running rustc or some (non-termux-compiled) rustup?

sylirre commented 7 months ago

Did you ever tried to use rustup? It is not going to work as Rust officially doesn't provide rustc binaries compatible with Android OS. -- Termux isn't standard distribution: https://wiki.termux.com/wiki/Differences_from_Linux

Check your PATH and your home directory to ensure that no rustup parts hijacking Termux rustc executable, remove all parts of rustup.


On Termux Rust compiler can be installed only using pkg install rust.

If you need some std components, look what is available by running pkg search rust or pkg search rust-std.

Shoresh613 commented 6 months ago

I get the same problem. I install it using pkg install rust and it seems to be all fine. But then it complains there's no default set. Nothing I've tried had worked (like setting environment variables or creating a config.toml file in .cargo/bin to point to the libraries that are installed).

tmak2002 commented 6 months ago

I have reinstalled Termux since then it works.

Shoresh613 commented 6 months ago

Did that the day before I got the message. So didn't work for me apparently, but maybe could try again..

On Thu, May 9, 2024 at 6:08 PM Torben Kahnert | トルベン カネルト < @.***> wrote:

I have reinstalled Termux since then it works.

— Reply to this email directly, view it on GitHub https://github.com/termux/termux-packages/issues/19565#issuecomment-2102969352, or unsubscribe https://github.com/notifications/unsubscribe-auth/AESE4AJBJTZPD7HDXNED563ZBONQNAVCNFSM6AAAAABFFVHRRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBSHE3DSMZVGI . You are receiving this because you commented.Message ID: @.***>

wakearray commented 5 months ago

Did you ever tried to use rustup? It is not going to work as Rust officially doesn't provide rustc binaries compatible with Android OS. -- _Termux isn't standard distribution: https://wiki.termux.com/wiki/Differences_from_Linux_

Check your PATH and your home directory to ensure that no rustup parts hijacking Termux rustc executable, remove all parts of rustup.

This was exactly it for me.

I got this issue (even though it was working previously) and when I saw this comment it reminded me that I had tried to use rustup at one point. I checked my $PATH variable and found that the first path in the variable was /data/data/com.termux/files/home/.cargo/bin, once I removed that rustc commands worked without issue. 👍