Building Firefox from source and Rust versions

April 14, 2022

Over on Twitter, I said something related to Ubuntu 22.04 switching how they distribute Firefox that may sound surprising:

On the other hand: Firefox gives Ubuntu LTS heartburn, because building the current Firefox from source requires a current Rust (Firefox releases are tied tightly to Rust releases, don't ask). This mostly forces Ubuntu LTS to keep ratcheting Rust versions up despite 'stable'.

As of today, this is true of the past few years of Firefox releases; a particular Firefox release is fairly tightly coupled to the version of Rust that was current at the time it was released. It most likely can't be built with a significantly older version of Rust, such as you might have on a 'long term support' Unix distribution where people didn't want versions of things changing, and similarly it may not build with a newer version.

A while back I wrote a grumpy entry about how Rust 1.x seemed to not be backward compatible in practice because I kept having problems compiling old Firefox versions on new Rust versions. In comments, people educated me on what was really going on (mostly), which is that the Firefox build process deliberately turns on unstable internal Rust toolchain features (using the RUSTC_BOOTSTRAP environment variable) in order to get access to things that are not stable Rust yet and are normally only used when building Rust itself. These unstable features can change from Rust release to Rust release, creating an implicit requirement for building Firefox with the right Rust version (generally the Rust version that was current when any given Firefox release was made).

(This isn't the only thing that can go wrong when trying to build an older Firefox with a newer Rust toolchain, but it's probably the big one.)

In addition, sometimes these or other unstable Rust features are promoted to stable features. When this happens, Firefox generally increases its official minimum Rust version to the relevant Rust release, sometimes a very recent one (for example). Right now, for example, Firefox Nightly (which I think will become version 100 or 101) officially requires Rust 1.59, which was released in late February, less than two months ago.

The reason that Ubuntu and other Unixes care about the latest version of Firefox at all is that Firefox doesn't support old releases for long enough (Ubuntu LTS releases have a five year lifetime) and Canonical is too sane to try to take on the burden of finding and fixing Firefox security problems on their own. Even Firefox ESR releases are only supported for a year or so, and regular Firefox releases stop being supported more or less the moment the next one comes out. If you package Firefox at all, you're on a treadmill of keeping up with Firefox releases. If you want to build from source instead of just putting a wrapper around the Mozilla binaries, you need to keep up on Rust too (at least for the version of Rust you use to build Firefox, which could always be a special thing).

Written on 14 April 2022.
« A reason why Unix programs sometimes support '-?' for help
I need (or at least want) a new virtual machine (GUI) environment »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Thu Apr 14 23:25:26 2022
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.