logoalt Hacker News

lrvick • today at 4:47 PM • 14 replies • view on HN

The linux distribution I co-maintain uses mold as our bootstrap linker to bootstrap rust itself, and it saved us -hours- on long version-by-version build chains. Mold being in c meant we could build it very early and use it as the default linker distro wide and enjoy build speedups everywhere.

Now sadly we will have to fork and maintain the c version as mold2 forever.

Rust is not actually the right tool for all problems.


Replies

jdc-pub • today at 8:34 PM

Like some other commenters, I do not understand why using a cached binary isn’t sufficient. Why not use the mold3 binary and build that first, and then cache it and never rebuild it again? I’m guessing it has to do with hermiticity and build provenance guarantees in your distro.

Do you have any reading material that you can share that might help me understand better? Docs for the distro, or an issue tracker I can search through?

➕ show 1 reply
karavelov • today at 5:11 PM

Why not use LLD for linking Rust? You already must have the LLVM for Rust to be buildable, so that do not add any dependency.

➕ show 3 replies
MayeulC • today at 5:54 PM

I have been thinking about Rust bootstrapping recently. Couldn't a Rust compiler without borrow checker be put together relatively easily?

Assuming the source code contains no issues (which can be checked later once the Rust compiler is built), one could leave that piece behind, and take the shortest path from .rs to executed code (C transpilation, or even an interpreter).

➕ show 1 reply
Orphis • today at 5:39 PM

It seems like you would benefit from having reproducible and hermetic builds with a good caching layer so you don't do the same work again and again.

Then you can just use the latest built version to build mold and the next version of rust.

➕ show 1 reply
nicce • today at 5:03 PM

If the need is well justified, maybe there is great chance to ask adding #[no_mangle] and extern C support? Since release is very fresh. If that is causing the problem. Or is some dependency the issue?

➕ show 1 reply
danudey • today at 7:11 PM

Could you not either bootstrap rust with lld or bootstrap rust with mold2?

➕ show 1 reply
mohamedkoubaa • today at 6:21 PM

Have you considered using Eurydice?

➕ show 1 reply
KolmogorovComp • today at 6:40 PM

how's bootstrapping rust story nowadays?

➕ show 1 reply
DetroitThrow • today at 4:55 PM

I'm a bit confused why a decision to decrease the maintenance burden of Mold by switching languages makes Rust the wrong tool here? Fearless concurrency sounds like a huge benefit for what they're doing, given the resources they have.

➕ show 2 replies
someonebaggy • today at 4:50 PM

[flagged]

➕ show 1 reply
well_ackshually • today at 5:31 PM

>Rust is not actually the right tool for all problems.

"my problems (that are not mold's) are not solved by mold. How dare mold make those decisions?"

Maybe you should rewrite more of your linux distribution in rust so it's available earlier in the build process and get back to it being the default linker.

➕ show 1 reply
ChickeNES • today at 6:32 PM

Luckily Mr Clanker can do most of the work for you at least (I myself have already had Claude/Codex rewrite a couple of Rust projects in C, worked great)

➕ show 1 reply
duped • today at 6:20 PM

Why do you need to bootstrap a toolchain to bootstrap a distro?

I know this is common but it seems like either an aesthetic decision, or glibc cruft.

➕ show 1 reply