rustrustup

Install wasm-32 for stable rust without rustup


I have a cloud node where I need a rust toolchain installed. Until now I have installed both stable and nightly with some curl magic and scripts from here:

    static-host            = "https://static.rust-lang.org/"
    stable-installer-path  = "dist/rust-1.74.0-x86_64-unknown-linux-gnu.tar.gz"
    nightly-installer-path = "dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz"
    nightly-wasm-path      = "dist/rust-std-nightly-wasm32-unknown-unknown.tar.gz"
    curl -ssL "${static-host}/${stable-installer-path}" -o "/etc/rust/$(basename ${stable-installer-path})"
    tar -xzf "/etc/rust/$(basename ${stable-installer-path})" -C /etc/rust

    curl -ssL "${static-host}/${nightly-installer-path}" -o "/etc/rust/$(basename ${nightly-installer-path})"
    tar -xzf "/etc/rust/$(basename ${nightly-installer-path})" -C /etc/rust

    curl -ssL "${static-host}/${nightly-wasm-path}" -o "/etc/rust/$(basename ${nightly-wasm-path})"
    tar -xzf "/etc/rust/$(basename ${nightly-wasm-path})" -C /etc/rust

Since our project nolonger uses the nightly tool-chain, I removed all about nightly above, the stable toolchain still gets installed and runs fine, but it also removes the wasm-target.

On a developer machine it could have been solved by running rustup to install it:

rustup target add wasm32-unknown-unknown --toolchain stable

But I cannot find the stable equivalent to https://static.rust-lang.org/dist/rust-std-nightly-wasm32-unknown-unknown.tar.gz as

https://static.rust-lang.org/dist/rust-std-stable-wasm32-unknown-unknown.tar.gz leads to nowhere.

How shall I modify my static install wasm32 to stable without rustup?


Solution

  • The static urls can be obtained from rustup by checking the verbose output.

    rustup -v target add wasm32-unknown-unknown --toolchain stable
    

    In my case it downloaded https://static.rust-lang.org/dist/2023-12-07/rust-std-1.74.1-wasm32-unknown-unknown.tar.xz a gnuzip compressed file was also available at almost the same destination. https://static.rust-lang.org/dist/2023-12-07/rust-std-1.74.1-wasm32-unknown-unknown.tar.gz

    To get the new uri for an upgrade rustup upgrade could be ran from a developer machine with the verbose flag, the output is massive but the urls are printed near the top.

    rustup -v  upgrade