On 09/06/14 20:12, Zoltán Tóth wrote:
My question is rather theoretical, from the
libre-and-open-source-software point of view.
Bootstrapping needs an already existing language to compile the first
executable version of Rust.
I read that this was OCaml at some time. I do not have OCaml on my
machine, but still managed to build from a cloned Rust repo. The
documentation says that building requires a C++ compiler. These
suggest that the project moved from OCaml to C++.
But there are also some texts on the web and in the source that
suggests that stage0 is actually not compiled from the source
repository, but is downloaded as a binary snapshot. If this latter is
the case, then can someone compile a suitable stage0 from [C++|OCaml]
source himself?
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev
Yes, those texts are correct, one downloads a stage0 compiler as a
binary snapshot to compile Rust from source. The stage0 compiler is just
stored binaries compiled from some commit in the past. Every so often
someone makes a new stage0 by making the buildbots build a snapshot of a
more recent commit, allowing the libraries to be completely written in a
newer iteration of Rust (they no longer have to be able to be compiled
by the old snapshot).
There's a wiki page about this snapshot process:
https://github.com/mozilla/rust/wiki/Note-compiler-snapshots
If one was really interested, one could theoretically backtrace through
history, all the way back to the last version[1] of rustboot (the OCaml
compiler), and use this to do a "full bootstrap". That is, use the
rustboot compiler to build the first written-in-Rust compiler as a
snapshot, and then use this snapshot to build the next one, following
the chain of snapshotted commits[2] through to eventually get to modern
Rust.
As others have said, the C++ dependency is just for building LLVM, which
is linked into rustc as a library, it's not used by the snapshot (that
is, LLVM is a dependency required when building librustc to get a rustc
compiler for the next stage; one can use the snapshot to compile
libraries like libstd etc. without needing LLVM).
Huon
[1]:
https://github.com/mozilla/rust/tree/ef75860a0a72f79f97216f8aaa5b388d98da6480/src/boot
[2]: https://github.com/mozilla/rust/blob/master/src/snapshots.txt
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev