News for hackers. Stuff that matters.
Re:I stopped everything and started writing C again by ryukoposting on Wednesday March 12, 2025 @07:36AM (#43342147)
Not really. Rustup only ships a limited number of toolchains, with some misses that (for me) are real head-scratchers. i686-unknown-none, for example. Can't get it from rustup. I'm sure there's a way to roll your own toolchain, but Rust's docs might as well tell you to piss up a rope for how much they talk about that.

Why is this important? C is the lingua franca of digital infrastructure. Whether that's due to merit or inertia is left as an exercise for the reader. I sure hope your new project isn't meant to supplant that legacy infrastructure, 'cause if it needs to run on legacy hardware, Rust won't work.

This is an incredibly annoying constraint when you're starting a new project, and Rust won't let you because you can't target the platform you need to target. For example, I spent hours building a Rust async runtime for Zephyr, only to discover it can't run on half the platforms Zephyr supports because Rust doesn't ship support for those platforms.

Re:I stopped everything and started writing C again by MaulingMonkey on Wednesday March 12, 2025 @03:07PM (#43346617)
> toolchains

Are what cargo, rustc, etc. are expected to run on. You probably meant target.

> i686-unknown-none

Is admittedly a missing target. `x86_64-unknown-none` specifies stuff like `extern "C"`'s ABI (per https://doc.rust-lang.org/rustc/platform-support/x86_64-unkn... ) which is a lot less universal/appropriate for i686, where AFAIK everyone chooses their own different incompatible ABIs - which might be the reason it's not provided? Usually you want to pick an i686-unknown-* target that aligns more closely with your own needs (e.g. your desired object/library/binary file format, abi, bootloader, ...?)

    C:\local>rustup target list | findstr i686
    i686-linux-android
    i686-pc-windows-gnu
    i686-pc-windows-gnullvm
    i686-pc-windows-msvc (installed)
    i686-unknown-freebsd
    i686-unknown-linux-gnu
    i686-unknown-linux-musl
    i686-unknown-uefi
If, truly, none of them are appropriate for your needs, that's when it's time to use a custom target (per https://doc.rust-lang.org/rustc/targets/custom.html ) and `build-std` (per https://doc.rust-lang.org/cargo/reference/unstable.html#buil... .) Using a toolchain file to pin your nightly rustc version might be appropriate (per https://rust-lang.github.io/rustup/overrides.html#the-toolch... .)

The last time I played with custom targets was on https://github.com/MaulingMonkey/rust-opendingux-test/tree/m... , using the old `xargo` instead of `build-std`. Notes.md details modifications made to make things work.

Re:I stopped everything and started writing C again by moron4hire on Wednesday March 12, 2025 @09:42PM (#43349584)
> C is the lingua franca of digital infrastructure

Is it, though? It feels more like how the French saw the French language as "the" language of the world, by basically discounting as unimportant everywhere that didn't use French.

Ok, no, yeah, I see it now. The Lingua Franca is right