How can we add target without rustup

My server is behind the firewall and cannot add target using rustup

my setup is like below:

  1. downloaded standalone installer(.msi) for windows and installed on my server

Now, i want to build for Linux(musl) target from my windows rust setup. Rustup is not available with standalone installer and also need to connect internet to add target using "rustup add traget . This is not possible in my server.

Any help will be really appreciated.

To add a new target yourself, you’ll need to download the standard library package and unpack it into your Rust installation folder. For Linux, that’ll be https://static.rust-lang.org/dist/2020-11-19/rust-std-1.48.0-x86_64-unknown-linux-musl.tar.gz.

There’s an index of all available files in https://static.rust-Lang.org/dist/channel-rust-stable.toml

2 Likes

Thanks for the links.

I did unpack in Rust installation folder and we need to configure this target somewhere ? how can i do it?

No real configuration needed, but you need to make sure you unpack it correctly. Your Rust installation will have a folder called lib and your rust-std add on will also have a folder called lib, and those folders should be merged.

Thanks @notriddle for the help. I am able to build for target linux_musl successfully

I did unpack as shown below.
Directory of C:\Program Files\Rust stable MSVC 1.48\lib\rustlib

12/15/2020 01:18 PM .
12/15/2020 01:18 PM ..
12/14/2020 05:33 PM etc
12/14/2020 05:33 PM x86_64-pc-windows-msvc
12/15/2020 01:18 PM x86_64-unknown-linux-musl

Directory of C:\Program Files\Rust stable MSVC 1.48\lib\rustlib\x86_64-unknown-linux-musl

12/15/2020 01:18 PM .
12/15/2020 01:18 PM ..
12/15/2020 01:18 PM lib

1 Like