Offline install (tar file) for cortxM3 series?

I must do an offline install in a closed environment, no internet connection.

I can find the linux x86 host version of the tools here:

https://forge.rust-lang.org/infra/other-installation-methods.html

Where can I find a tar file for the target: cortexm3? aarch64? and riscV?

I cannot use "rustup" or any of those methods - as they auto-download things

download the manifest file first, and search for the rust-std component for your target, for example, here's the section for aarch64 linux

[pkg.rust-std.target.aarch64-unknown-linux-gnu]
available = true
url = "https://static.rust-lang.org/dist/2025-06-26/rust-std-1.88.0-aarch64-unknown-linux-gnu.tar.gz"
hash = "91f61c01a960c37ae1032c4450d329253112ab46f02d61fe0203b366d75527c0"
xz_url = "https://static.rust-lang.org/dist/2025-06-26/rust-std-1.88.0-aarch64-unknown-linux-gnu.tar.xz"
xz_hash = "e9ac4ff3c87247a2195fcceddbf1bdeee5c4fd337f014d8f4c4e3ac99002021f"

download the tarball from the url and merge the content of the rust-std component into your host toolchain directory. there's also a install.sh script that updates the components list to let rustup know, but you can just copy the files manually since you don't use rustup.

the manifest file for the latest stable (you can replace stable with beta or nightly):

https://static.rust-lang.org/dist/channel-rust-stable.toml

for a specific nightly version, insert the date in between, for example:

https://static.rust-lang.org/dist/2025-07-06/channel-rust-nightly.toml

Thanks, this is quite helpful.

Any attempt at googling "rust manifest.toml" is rather useless, it talks about what cargo uses only.

a) I have my host: x86_64-unknown-linux-gnu

I believe most of my targets are: TEIR2 targets

b) First target: cortexM3 (stm32 is an example) - bare metal target
c) Second target: aarch64 - I need baremetal not a linux os target.
d) Third target riscv-32 - bare metal target

what I seem to be finding in the manifest file is for example: arm64-linux targets, ie: the compiler expects to run on an ARM64 - targeting an ARM64, ie: A cross compiler.

Do you know what manifest file I would find that in? Google is not helping here :frowning:

the manifest itself is versioned, but not platform specific, you just download the correct components for your environment.

there are different profiles, but a minimal toolchain requires at least the rustc, cargo, and rust-std components for your host.

the profiles are also listed in the manifest, at the end of the file. there are also "meta" packages which bundle individual components into combined tarballs. these correspond to the "default" profile of tier 1 toolchains, for example:

[pkg.rust.target.x86_64-unknown-linux-gnu]
available = true
url = "https://static.rust-lang.org/dist/2025-06-26/rust-1.88.0-x86_64-unknown-linux-gnu.tar.gz"
hash = "ad6f0cc845e7fcca17fd451bafd2c04a7bbcb543f8f3ef5bc412fd1fef99ef7b"
xz_url = "https://static.rust-lang.org/dist/2025-06-26/rust-1.88.0-x86_64-unknown-linux-gnu.tar.xz"
xz_hash = "7b5437c1d18a174faae253a18eac22c32288dccfc09ff78d5ee99b7467e21bca"

[[pkg.rust.target.x86_64-unknown-linux-gnu.components]]
...

[[pkg.rust.target.x86_64-unknown-linux-gnu.extensions]]
...

typically for manual installation, you just use the bundled "default" toolchain packages, the individual components are mostly used by rustup, but you can also use manually merge the components too.

in your situation, at minimal, you need to download rustc.target.x86_64-unknown-linux-gnu, rust-std.target.x86_64-unknown-linux-gnu, and cargo.target.x86_64-unknown-linux-gnu.

for development purpose, I recommend also these components: rust-src, rust-docs, rust-fmt, clippy, and also rust-analyzer if your editor's plugin doesn't have a bundled lsp server.

for supported cross-compiled targets, you just need the rust-std components for that specific targets:

  • cortex-m3:
    if I recall correctly, the target triple for cortex-m3 is thumbv7m-none-eabi.

    note, not all stm32 MCUs are cortex-m3, e.g. some are cortex-m0, some are cortex-m4, some come with hardware floating point unit, etc.

    check the corresponding hal crates for the correct target triple you should use. for example, this is the cargo config file for stm32c0xx-hal

  • aarch64 bare metal:
    I don't the exact target for your platform, I think it's probably one of

    • aarch64-unknown-none,
    • aarch64-unknown-none-softfloat, and maybe also
    • aarch64-unknown-uefi,
      pick the one based on your hardware.
  • riscv32:
    this is very complicated, since it depends on the configuration of the ISA core and extensions, for example, the archtecture could be riscv32e, riscv32i, riscv32im, riscv32imc, riscv32imac, etc, but for bare metal, you want none for os and elf for abi, (and typically vendor is unknown), i.e. riscv32*-unknown-none-elf.

there's a chance that your target does not come with a pre-compiled rust-std component in the manifest, in which case you'll need to use nightly toolchain and use the -Z build-std cargo option when compiling your code:

1 Like

Ok - getting further down this road and need some more questions.

I can download the X86_64_LINUX_UNKNOWN_GNU package and install that.

What I am looking in the manifest file is the 'THUMBV7" (or aarch64) generator.

I am expecting a traditional cross compiler, ie:
I have an X86_64 binary application that compiles RUST -> X86 opcodes

Since I have a X86_64 host, I am expecting to find {and cannot find}
I am looking for the X86_64 binary application that compiles RUST-> ARM CODE
ie: Target: thumbv7m-none-eabi

If my host was a MAC, would expect a
DARWIN Binary application that compiles RUST->ARM CODE
BUT - I do not see this option or combination in the manifest
I am confused

If the answer is:
RUST is actually like the old: "cfront"
RUST first translates RUST -> C code, then executes the target specific cross compiler
Then I totally understand the method

BUT without that trick, I am still looking for the X86_64 binary that reads rust and produces thumbv7m-none-eabi output

Any hints would be helpful here.

rustc by itself is a universal cross-compiler — it can compile code for any target that's supported at all. What you need to install in addition to rustc is

  • the rust-std component for the specific target you want to cross-compile against (which contains a pre-compiled copy of the Rust standard library), and
  • a linker for the target,

and rustc will then be able to compile your programs.

No, there is no language translation step (unless you count LLVM intermediate representations that live and die entirely within the rustc process). rustc directly generates code for whichever target you ask for. You just run cargo or rustc with --target thumbv7m-none-eabi and you get what you ask for.

ok that is not at all what i expected this means every cpu target is in the one compiler
and all obj formats for all cpus are there too so rustc can produce elf objs directly..

yea all targets are generally elf objs but riscv elf opcode fixups are unique to riscv and arm cortex fixups are there too all in the same compiler…. that is very unlike all other cross compilers i have ever worked with..

i guess that cargo is effectively a replacement for the make tool too..by way of the toml files

and from what i read the only true traditional cross compiler type tool is the linker
because cargo and/or rust use the target specific linker…
( i have seen posts about the linker failing after cross compiling)

there are not target specific code generator, rustc is capable to generate binary code for all supported targets. run

$ rustc --print target-list

to see the full list.

again, rust does not work like, say, gcc, where you have target specific cross compilers such as arm-none-eabi-gcc, arm-linux-gcc, etc.

instead, there is only rustc but you use a command line option to specify the target, e.g. --target thumbv6em-none-eabihf

assuming you are on macos with intel CPU, to download package for the rustc component, you should looking for this section:

[pkg.rustc.target.x86_64-apple-darwin]
available = true
url = "https://static.rust-lang.org/dist/2025-06-26/rustc-1.88.0-x86_64-apple-darwin.tar.gz"
hash = "3887a121fe1185f23df98bf78eae17ee6d5586f00988b61f75db1dfd8aad605f"
xz_url = "https://static.rust-lang.org/dist/2025-06-26/rustc-1.88.0-x86_64-apple-darwin.tar.xz"
xz_hash = "c8f1ea4fc3e507c8e733809bd3ad91a00f5b209d85620be9013bea5f97f31f24"

note, here the triple name of pkg.*.target.x86_64-apple-darwin states what target platform the package itself is built for, or in other words, what platforms you can run the binary.

for the rustc component, which is itself a compiler, this is known as the "host" triple, but for other components like rust-std, which is not a compiler, the concept of "host" doesn't apply.

specifically, this does NOT mean this is a cross compiler for specific target.


so, what do you need for a toolchain that is used as a "cross compiler" then? here's a short break down:

  • rustc: the (cross) compiler

    the triple name of the package determines what target it was built for (thus it can run on), a.k.a. your "host" platform.

  • cargo: the and package manager and build tool.

    choose the same target triple as rustc, since you need to run it on the "host" platform.

  • rust-std: the pre-built standard library

    the triple name of the package determines what target it is built for, a.k.a. the "target" triple

    • when this is the same as rustc, it is linked when you do "native" compilation;
    • when this is different from rustc, it is used when you do "cross" compilation;
  • rust-src: the source code of the standard library

    this component is the same for every triple, thus the manifest uses a whildcard.

    some lower tier targets don't have the standard library distributed as pre-built packages, i.e. you can find them in rustc --print target-list but NOT in rustup target list, so there's no package for the rust-std component of these targets in the manifest.

    in such cases, you need to install rust-src and build the standard library from source code on demand. this means if you have one of such rare targets, you must use a nightly toolchain.


seriously, why all these hassle at all? why not just use rustup to install the required tools on a local machine with internet connection, and then pack the $RUSTUP_HOME directory up and transfer it to the gapped environment using portable storage device?

rustup can install non-"native" toolchain just fine, you just need to enable the --force-non-host flag, but other than that, everything just works.

for example, suppose you are on a linux machine with amd cpu, the native host triple is x86_64-unknown-linux-gnu, you can install a toolchain that would run on apple machines like this:

$ rustup toolchain install --force-non-host aarch64-apple-darwin

if you want use the toolchain for thumbv6m-none-eabi, just add the rust-std component of the target to the toolchain:

# these two commands are equivalent:
$ rustup target add --toolchain stable-aarch64-apple-darwin thumbv6m-none-eabi
$ rustup component add --toolchain stable-aarch64-apple-darwin rust-std-thumbv6m-none-eabi

you can also add other components to the toolchain, such as rust-docs for offline documentations, and rust-analyzer for editor integration, etc.

after the toolchain is set up locally, just tar or zip the $HOME/.rustup directory (or to be more precise, the $RUSTUP_HOME/toolchains/stable-aarch64-apple-darwin directory), and transfer it to the apple machine, and setup the $PATH environment variable, you are good to go.

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.