Location to store Rust binaries
mcalhoun at macports.org
mcalhoun at macports.org
Thu Dec 22 13:31:49 UTC 2022
I am sure everyone who cares about Rust is already familiar with the issues involved, but just for the sake of documentation, I will try to provide an overview.
The main issue is that a Rust compiler is required to build a Rust compiler.
On an Apple silicon machine running macOS 13, the Rust Portfile version 1.66 downloads
These are prebuilt binaries of the previous version (1.65) of the Rust compiler, Rust standard library, and Rust package manager respectively.
Upstream provides these prebuilt binaries for many different architectures .
This “stage0 compiler” is then used to build a local copy of Rust .
The problem is that the upstream binaries will only run on macOS 10.9+.
Upstream says 10.7+, but that is just the language .
The combination of the language, standard library, and package manager make the minimum higher .
Also, there is a proposal to set the minimum supported version to 10.12 .
So the question is how to get a working stage0 Rust compiler on older systems?
*) The alternative Rust compilers gccrs is still “in a very early stage” .
*) Mutabah's Rust Compiler (mrustc) is a Rust compiler written in C++ , so it may be a viable choice.
However mrustc can build Rust up to 1.55, so, as pointed out by Kirill in another thread , the dependency chain could get quite long.
If possible, it would be nice to avoid a similar issue with Clang .
*) There does not seem to be much enthusiasm upstream for re-adding support for older systems .
*) Previous versions of the Rust Portfile tried to modify the upstream binaries to work on older systems .
This strategy certainly worked but could only go so far.
The current strategy is to build our own stag0 compiler in the port rust-bootstrap.
A 10.9+ machine builds the stage0 compiler.
The stage0 compiler is uploaded somewhere (currently my personal GitHub repository).
10.5-10.8 machines then download the stage0 compiler from us instead of upstream.
Our stage0 compiler makes extensive use of the MacPorts ecosystem, so that is another reason upstream would unlikely be interested.
Sorry if this is clear to everyone, but it took me a while to wrap my head around, and I am sure there are subtleties I am missing.
> On Dec 21, 2022, at 9:02 PM, mcalhoun at macports.org wrote:
> As many of you know, the Rust compiler is self-hosting, so Rust is required to build Rust.
> The problem is that the Rust binaries provided by upstream only work on macOS 10.9 and above.
> To get around this, there is a rust-bootstrap port that build Rust binaries on 10.9+ intended to build Rust on previous macOS version.
> Currently, these binaries are stored on using my personal GitHub account.
> So the entire upgrade process is essentially:
> 1) Update the version in rust-bootstrap.
> 2) Build Rust binaries on a 10.9 VM.
> 3) Upload Rust binaries to GitHub account.
> 4) On older machines, use MacPorts Rust binaries to build Rust.
> On newer machines, us the upstream provides binaries to build Rust.
> This is far from ideal, but it has allowed us to get Rust working back to 10.5 (both i386 and x86_64).
> This entire procedure may be modified, and there are a few suggestions on the mailing list
> However, until consensus is reached about major changes, it would be nice to make some incremental improvements.
> The easiest change: does anyone know of a better place to store the MacPorts generated binaries?
> More challenging: can anyone think of a way to automate the process of building the MacPorts Rust binaries after rust-bootstrap is update?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the macports-dev