Cannot install Rust on a Synology Nas

Hi all,
I tried to install Rust on my (old) Synology NAS (processsor Feroceon 88FR131 according to ‘cat /proc/cpuinfo’) using the standard way

curl https://sh.rustup.rs -sSf | sh

and then

curl https://sh.rustup.rs -sSf | sh -s – --default-toolchain=nightly -y

I get the same error:

rustup: unknown CPU type: armv5tel

Is there a plan to support this architecture?

Thank you.

Have a look here.

2 Likes

Do you need to run the Rust compiler itself on your Synology device, or just compile programs that run on the device?

Running the rustc compiler on armv5te processors is not possible yet, though it looks like this could be fixed if some knowledgeable people have time to work on it. This email describes some of the known issues that currently prevent bootstrapping rustc for armv5te.

However, you may be able to run rustc on a different computer (the “host”), and cross-compile to get binaries that will run on your armv5te system (the “target”). You’ll need to install rustup as usual on the host computer, then run rustup target add armv5te-unknown-linux-gnueabi. You will also need to install a C toolchain (or at least a linker and libc) that can cross-compile for your target device. This is usually easiest if your host machine is running a Debian-based Linux distribution. This repo has general information and instructions about cross-compiling Rust programs.

5 Likes

Thank you jjpe for the link, and thank you very much mbrubeck for the detailed answer.

I indeed just would like to “compile programs that run on the device” and assumed it would be simpler to compile directly on the NAS.

I also wrongly assumed that if it was not possible to run the rustc compiler on a specific target, then it was not possible to cross-compile for that target (I come from the Java word…).

Additional question on a different matter: I resort to bmi2 instructions in a RUST code (using the nightly version).
When I execute

rustc --print cfg

I see (among others):

target_feature=“sse2”

But I do not see something like:

target_feature=“bmi2”

even if my x86_64 supports them.
To activate bmi2 instructions, I have to compile using explicitly the bmi2 target-feature:

RUSTFLAGS=’-C target-feature=+bmi,+bmi2’ cargo build --release

Is this an expected behaviour?

yes—rustc, by default, targets a wide range of CPUs, to allow for convenient distribution—so it doesn't optimize specifically for what happens to be the system it compiles on

Note also, depending how old the device and its software (specifically, glibc) is, you may need the armv5te-unknown-linux-musleabi target instead.

Yes. You can also use -C target-cpu=native if you're just buiding to run on the compile host only.

See:

rustc --print target-cpus
rustc --print target-features