News for hackers. Stuff that matters.
Re:mrustc: In-progress alternative Rust compiler (to C) by dataflow on Sunday February 28, 2021 @04:05PM (#26297048)
Wow I see. Could they not use the initial Rust compilers (and however those were bootstrapped? I have no idea how) to get a Rust compiler going? I'm guessing it's just too painful?
Re:mrustc: In-progress alternative Rust compiler (to C) by spijdar on Sunday February 28, 2021 @04:09PM (#26297084)
Bootstrapping rust is really, really painful as is. The rust compiler itself tends to require a recent version of the rust compiler to work. So to bootstrap from the original versions of rustc (which were written in OCaml) you'd have to incrementally step up really slowly.

Being able to target a pretty recent version of Rust with a compiler written in C would be so, so useful for these purposes.

Re:mrustc: In-progress alternative Rust compiler (to C) by Blikkentrekker on Sunday February 28, 2021 @04:34PM (#26297287)
Certainly that could be automated quite easily.

I would assume that on such compilation farms that these systems generally use, this could be done very quickly.

Perhaps there would be an interest for the Rustc team to provide a recursive automated setup that is capable of compiling the latest Rustc from OCaml, and finally from C as well since one must follow a similar process with OCaml.

Re:mrustc: In-progress alternative Rust compiler (to C) by LegionMammal978 on Sunday February 28, 2021 @04:44PM (#26297374)
The automation for this is actually trickier than it would first appear: especially with the earlier snapshots, a number of patches are needed to compile the LLVM interfaces written in C++. Also, due to linking issues, some snapshots require a stage2 compiler, while others can only use a stage1 compiler. I agree that it would be trivial once you have the chain in place, but that chain can only be built through trial and error.
Re:mrustc: In-progress alternative Rust compiler (to C) by Blikkentrekker on Sunday February 28, 2021 @05:24PM (#26297686)
And no one has done this before?

Methinks that building this chain by trial and error is rather trivial compared to the actual work in building a compiler.

Re:mrustc: In-progress alternative Rust compiler (to C) by qqii on Sunday February 28, 2021 @07:57PM (#26298651)
Guix performed the bootstrap from mrustc 0.8 for rust 1.19 all the way to rust 1.28 in 2018: https://guix.gnu.org/en/blog/2018/bootstrapping-rust/

Since them they've bootstrapped this all the way to 1.50: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages...

The work done here is non trivial, this chain of versions are required for the final binary to be reproducible.

Re:mrustc: In-progress alternative Rust compiler (to C) by sanxiyn on Sunday February 28, 2021 @05:32PM (#26297736)
We are discussing mrustc here. The reason it hasn't been done yet is that nearly everyone interested in this agrees mrustc is a better bootstrapping path than starting from the last OCaml version.
Re:mrustc: In-progress alternative Rust compiler (to C) by Blikkentrekker on Sunday February 28, 2021 @06:04PM (#26297946)
That it's a better bootstrapping process for the user has no relationship with the ease of development for the developer.

Typically, they are inversely correlated.

Re:mrustc: In-progress alternative Rust compiler (to C) by tedunangst on Sunday February 28, 2021 @05:24PM (#26297682)
And when you port to a new CPU architecture you're going to backport those changes to 200 obsolete versions as well?
Re:mrustc: In-progress alternative Rust compiler (to C) by monocasa on Sunday February 28, 2021 @04:09PM (#26297086)
Yeah, rustc dogfoods new features, so it's _very_ painful. It'd probably be close to 100 or so compilers to go back to the ocaml that it started from.
Re:mrustc: In-progress alternative Rust compiler (to C) by LegionMammal978 on Sunday February 28, 2021 @04:38PM (#26297326)
I've actually been trying this for real. Right now, I'm at the 82-compiler mark, including the ~6 LLVM versions needed. For a sense of scale, the most recent compiler in this chain is the 2011-12-07 snapshot, which is still older than Rust 0.1 (2012-01-20). In most cases, additional compilers are needed only to resolve syntax errors, but there are occasional LLVM-related segfaults that create most of my headaches.
Re:mrustc: In-progress alternative Rust compiler (to C) by wh33zle on Sunday February 28, 2021 @04:47PM (#26297404)
Is your work publicly available somewhere?
Re:mrustc: In-progress alternative Rust compiler (to C) by LegionMammal978 on Sunday February 28, 2021 @05:20PM (#26297655)
The scripts are still pretty messy right now. I'll probably clean them up a bit and upload them once I reach 0.1.
Re:mrustc: In-progress alternative Rust compiler (to C) by maccam94 on Sunday February 28, 2021 @04:10PM (#26297099)
The earliest versions of the rust compiler were written in Ocaml, which is also unlikely to have been built in a trusted way by these organizations. mrustc exists to be a way to bootstrap trusted builds of rustc.
Re:mrustc: In-progress alternative Rust compiler (to C) by shakow on Sunday February 28, 2021 @04:10PM (#26297096)
> I'm guessing it's just too painful?

Indeed. Although it is being worked on, the whole bootstrap process of rustc is currently a major hassle, requiring to start from the oldest CaML versions of the compiler up to the most recent ones.