Debian, Rust, and librsvg
Debian, Rust, and librsvg
Posted Nov 14, 2018 16:05 UTC (Wed) by mathstuf (subscriber, #69389)In reply to: Debian, Rust, and librsvg by moltonel
Parent article: Debian, Rust, and librsvg
This is no different than CPython being the only implementation of 3.x while PyPy and other projects only had 3.x-2 support or so. Now with CPython explicitly slowing down after the BDFL stuff (and calling out letting other implementations catch up). I imagine that Rust will, at some point, slow down for other implementations, but it took CPython 20+ years to do that. And 10 years (Jython started in 2001) for alternate implementations to even get an initial release.
Posted Nov 15, 2018 6:25 UTC (Thu)
by edomaur (subscriber, #14520)
[Link] (34 responses)
https://blog.rust-lang.org/2018/07/27/what-is-rust-2018.html
Posted Nov 15, 2018 9:54 UTC (Thu)
by ceplm (subscriber, #41334)
[Link] (32 responses)
Posted Nov 15, 2018 18:23 UTC (Thu)
by peter-b (guest, #66996)
[Link] (1 responses)
Sorry, I don't really understand this argument. Does openSUSE build GCC without GCC?
Posted Nov 18, 2018 10:27 UTC (Sun)
by roblucid (guest, #48964)
[Link]
Posted Nov 15, 2018 20:14 UTC (Thu)
by josh (subscriber, #17465)
[Link] (29 responses)
Posted Nov 15, 2018 20:57 UTC (Thu)
by ceplm (subscriber, #41334)
[Link] (28 responses)
Posted Nov 15, 2018 21:14 UTC (Thu)
by josh (subscriber, #17465)
[Link] (27 responses)
Posted Nov 15, 2018 21:23 UTC (Thu)
by ceplm (subscriber, #41334)
[Link] (24 responses)
Posted Nov 15, 2018 21:45 UTC (Thu)
by ssokolow (guest, #94568)
[Link]
(mrustc is a Rust compiler, written in C++, which makes some assumptions about the correctness of the code, but is complete enough to compile certain older versions of rustc so that it can be proved free of a Trusting Trust attack.)
Posted Nov 15, 2018 21:46 UTC (Thu)
by josh (subscriber, #17465)
[Link] (20 responses)
You might check with the Debian folks on reproducible build strategies for self-hosting compilers.
Posted Nov 15, 2018 22:15 UTC (Thu)
by ceplm (subscriber, #41334)
[Link] (9 responses)
Posted Nov 15, 2018 23:01 UTC (Thu)
by nybble41 (subscriber, #55106)
[Link] (7 responses)
To build the minimal version still requires GCC, and to bootstrap GCC you need some form of C compiler (though not necessarily GCC itself).
I don't know of any distros with a requirement to be able to build every package "from scratch" with no outside dependencies. Frankly I'm not even sure how that would work; does every rebuild need to start with procuring a blank-slate system with a direct hardware interface for loading hand-generated machine code? In practice you always start out using host tools of one form or another. If you look at the bootstrap process for something like Linux From Scratch[1] it involves building the toolchain three times: First you build a cross-compiler using the host tools, then you use that cross-compiler on the host to build a native toolchain and other packages required for standalone operation (what LFS calls the "temporary system"), and finally use this temporary system to build the host-independent tools.
This is for a complete system, of course, but bootstrapping a compiler is similar. Use the host's Rust compiler to build a cross-compiler which doesn't rely on the host environment, then use that to build the native Rust compiler. The result of the second build should be deterministic even if the first stage isn't due to variations in host compilers.
Posted Nov 16, 2018 1:11 UTC (Fri)
by pabs (subscriber, #43278)
[Link]
Posted Nov 16, 2018 15:39 UTC (Fri)
by moltonel (guest, #45207)
[Link] (5 responses)
I understand that many platforms get a C compiler before any other, but that doesn't change anything to the fact that a pre-existing binary was used to compile that "initial" compiler. The language of the pre-existing binary shouldn't matter, as long as it can generate native code for your target platform. It's a mindset issue, not a technical issue.
For fun, have a look at https://github.com/nebulet/nebulet, a microkernel written in Rust that only executes wasm, and does so in ring 0. No C in sight ;)
Posted Nov 16, 2018 16:47 UTC (Fri)
by zlynx (guest, #2285)
[Link] (1 responses)
Posted Nov 23, 2018 10:03 UTC (Fri)
by ewen (subscriber, #4772)
[Link]
If you’re thinking of another one and do find the link I’d be curious to read about their approach.
Ewen
Posted Nov 16, 2018 17:11 UTC (Fri)
by madscientist (subscriber, #16861)
[Link] (2 responses)
You can find a C compiler from decades ago that is sufficient to build GCC (because GCC starts out by building a "stage 1" version of the GCC compiler which relies only on very portable C, then builds the rest of GCC, including all the different front-ends like C++, gfortran, etc., using that stage 1 compiler). You can cache some obsolete version of GCC, or get TinyCC or something like that, and use that for bootstrapping. It's super-easy and virtually never has to change.
Posted Nov 16, 2018 18:30 UTC (Fri)
by josh (subscriber, #17465)
[Link]
Rust doesn't systematically demand the latest prior release to build itself; it simply does not refrain from using features as they become available. As mentioned elsewhere in this thread, folks are working on creating a minimized series of rustc versions to successively bootstrap from the last OCaml version.
Posted Nov 20, 2018 5:57 UTC (Tue)
by mirabilos (subscriber, #84359)
[Link]
Posted Nov 16, 2018 14:09 UTC (Fri)
by glondu (subscriber, #70274)
[Link]
Not exactly.
In OCaml world, there is a portable bytecode for binaries (like Java) and the OCaml sources contain a binary of the full compiler (to bytecode) that is used to compile everything (including the compiler itself). The interpreter for that bytecode is written in C. Hence, "bootstrapping" a new architecture is just porting the interpreter to the new architecture, which is easy.
Additionally, there is a compiler to native code, but it is not strictly needed to enjoy OCaml on a new architecture. And it can be compiled using the bytecode compiler, so no bootstrapping issues.
Posted Nov 15, 2018 22:25 UTC (Thu)
by nix (subscriber, #2304)
[Link] (3 responses)
For Rust, this makes sense, because the language is evolving fast and this does mean that at least the compiler can dogfood experimental features added in compiler version N in version N+1, then mark them non-experimental once they know they work for at least that use case. :)
Posted Nov 16, 2018 0:01 UTC (Fri)
by josh (subscriber, #17465)
[Link]
Posted Nov 18, 2018 1:45 UTC (Sun)
by rgmoore (✭ supporter ✭, #75)
[Link] (1 responses)
Maybe it's just me, but it's hard to see a system like this as ready for building OS critical components. When the compiler demands bleeding edge features such that it can't be built with a version of itself that's even 3 months old, it is not a stable platform on which to build a system.
Posted Nov 18, 2018 23:51 UTC (Sun)
by nix (subscriber, #2304)
[Link]
Posted Nov 16, 2018 14:11 UTC (Fri)
by plugwash (subscriber, #29694)
[Link] (5 responses)
As the maintainer of Raspbian there have been several things that have made rust particuarly painful for us. I suspect some of these would also be applicable to re-bootstrapping efforts.
1. The upgrade treadmill is unusually rapid. You need the previous release of rust and rust makes a new release about every 6 weeks.
Posted Nov 16, 2018 15:14 UTC (Fri)
by Ieee754 (guest, #128655)
[Link] (1 responses)
I have no idea what you expected from googling "rust fabricate", but if I just go to the documentation site of the toolchain: https://doc.rust-lang.org/rustc/index.html , there is a frickin book about how the Rust toolchain is built, how to run tests, debug issues, configure everything, the overall design of the compiler, the different modules, etc.
Posted Nov 17, 2018 2:02 UTC (Sat)
by plugwash (subscriber, #29694)
[Link]
I was hoping to find some documentation on what "fabricate" (which was hanging during the rustc build on one of our buildboxes, I suspect a bug in the arm32 compatibility layer of the arm64 kernel on said box) did and how to troubleshoot problems with it.
But instead I just found a load of results about metal fabrication :(
Someone did later tell me what fabricate was (apparently it's the rust-installer crate), though I haven't got around to trying to take a closer look. For now I have been working around the issue by doing our rust builds on a different system.
> there is a frickin book about how the Rust toolchain is built
Using the search tool in said book to search for fabricate doesn't seem to turn up any results.
Still thanks for the pointer.
Posted Nov 16, 2018 21:09 UTC (Fri)
by josh (subscriber, #17465)
[Link] (2 responses)
My understanding is that both Rust and Cargo only require the previous stable version at most, and should never have dependency loops between their latest versions.
> 4. After a failed build attempting to re-run the failed command manually using the command line printed by the build process (for example to run it in a debugger or under strace or something) produces completely unrelated errors. I guess there are some special environment variables or something but I can't seem to find any documentation of them if there are.
This is being fixed right now, and yes, there are environment variables. See https://github.com/rust-lang/cargo/pull/5683 for details.
Posted Nov 19, 2018 14:15 UTC (Mon)
by dgm (subscriber, #49227)
[Link] (1 responses)
Doesn't that imply that you (potentially) have to build each and every version in succession to get the latest one?
Posted Nov 20, 2018 11:57 UTC (Tue)
by nix (subscriber, #2304)
[Link]
Posted Nov 16, 2018 15:04 UTC (Fri)
by Ieee754 (guest, #128655)
[Link] (1 responses)
(what you are saying does not make sense for a toolchain)
Posted Nov 18, 2018 0:01 UTC (Sun)
by JoeBuck (subscriber, #2330)
[Link]
Posted Nov 20, 2018 5:56 UTC (Tue)
by mirabilos (subscriber, #84359)
[Link] (1 responses)
That sounds ridiculous.
Posted Nov 20, 2018 9:01 UTC (Tue)
by Jonno (subscriber, #49613)
[Link]
Of course not, rust support cross-compilation perfectly well!
Sure, that means that if you want to re-verify the chain of trust from scratch you are going to need two computers (one of each arch), but that is a comparatively minor inconvenience...
Posted Nov 15, 2018 20:13 UTC (Thu)
by josh (subscriber, #17465)
[Link]
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
A phase of the compiler build, created a GCC subset, that could then bootstrap the full compiler.
If you didn't have a C working on target, then cross compiling was another possibility. GCC was used on Sun h/w to build code for telephone exchanges for example, unsuitable to run a compiler natively.
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
2. There are interdependencies between rust versions and cargo versions that aren't always obvious until you try particular combinations.
3. There does not seem to be any way to disable multithreading in the build. Threading can easilly lead to failures that only show their face on particular hardware/kernel configurations.
4. After a failed build attempting to re-run the failed command manually using the command line printed by the build process (for example to run it in a debugger or under strace or something) produces completely unrelated errors. I guess there are some special environment variables or something but I can't seem to find any documentation of them if there are.
5. It's virtually impossible to google anything about rust. If I google say "rust fabricate" most of the results have nothing to do with the language.
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg
Debian, Rust, and librsvg