Trying to use wasm32-unknown-unknown on termux

I have been trying to use wasm32-unknown-unknown on termux (an app that emulates linux on android). It has worked before by using this tutorial: Non-rustup setups - Hello wasm-pack!
But after updating my packages it doesn't work anymore. (Even when reinstalling wasm32-unknown-unknown with the correct version). The error I get says, that wasm32-unknown-unknown has been compiled by the wrong compiler. I suppose this is because the (new) rustc termux provides is compiled from a source tarball. Is there a way to compile wasm32-unknown-unknown myself?
the error:



error[E0514]: found crate `core` compiled by an incompatible version of rustc
  |
  = note: the following crate versions were found:
          crate `core` compiled by rustc 1.66.1 (90743e729 2023-01-10): /data/data/com.termux/files/usr/lib/rustlib/wasm32-unknown-unknown/lib/libcore-f216917744caf94d.rlib
  = help: please recompile that crate using this compiler (rustc 1.66.1 (90743e729 2023-01-10) (built from a source tarball)) (consider running `cargo clean` first)

error: could not compile `cfg-if` due to previous error
warning: build failed, waiting for other jobs to finish...
2023-01-22T13:48:59.596019Z ERROR ❌ error

You can pass -Zbuild-std=std when building. This only works for nightly rustc though as it is an unstable feature.

sadly rust nightly isn't available on termux

Building on Android | Writing an OS in Rust has a guide on how to install nightly rustc on termux. Not sure how up to date these instructions are though.

imho Rust should change Android from Tier 2 w/o host tools to Tier 2 with host tools

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.