3 ms·
How important is breaking the circular dependency for the compiler, really? To use a more common language and tool as an example: I can't build GCC without al
by JonathonW 12y ago
How important is breaking the circular dependency for the compiler, really?
To use a more common language and tool as an example: I can't build GCC without already having a working C++ compiler. Granted, GCC will accept any reasonably conformant C++98 compiler, but still... If I'm bootstrapping GCC on Linux (or almost any other major *nix), that compiler's almost always going to be another copy of GCC.
If getting started with Rust on another platform is indeed so difficult, I'd think it would be a better use of their resources to make sure that cross-compilation is functional, rather than messing around with distributing LLVM IR and stuff. If I'm building a C/C++ build environment for a new platform, a cross-compile of my tools is probably how I'd start.
- jensnockert 12y agoCross-compilation is functional, and it's how you would bootstrap it. But in theory you could also bootstrap from the old compiler written in ocaml, but that would take ages due to needing a gazillion builds of rustc.
- kibwen 12y agoWe can determine exactly how many builds you'd need by looking at the master snapshot file: https://github.com/rust-lang/rust/blob/master/src/snapshots.txt https://github.com/rust-lang/rust/blob/master/src/snapshots.... According to this, there have been 290 snapshots in total. And keep in mind that you would also need to rebuild LLVM quite a few times as well during this process, as Rust has continually upgraded its custom LLVM fork over the years.
- pjmlp 12y agoThe P-Code used by some Pascal compilers never was intended to be a fully Pascal VM, rather a porting tool. Niklaus Wirth idea was to have a portable assembly that he could use to easily bootstrap the compiler. So porting to a new platform meant: - setting the output format to P-Code - compile the compiler - write a P-Code interpreter without any attention to performance - use it to run the compiler until the new native backend is done This was specially important back in the day each OS had as option their own proprietary system programming language or Assembly. Personally I like this option (using interpreters as porting tool) better than cross-compiling, as you can work directly on the target system, except in embedded platforms case.