Re: Some rather stupid questions about Rust and FreeBSD

From: Charlie Li <vishwin_at_freebsd.org>
Date: Thu, 12 Sep 2024 04:51:35 UTC
Alan Somers wrote:
> On Wed, Sep 11, 2024, 7:33 PM Charlie Li wrote:
>     rustc (lang/rust) supports using an existing LLVM toolchain
>     (devel/llvm*). Since LLVM 8.0, the Rust Project maintain their copy of
>     LLVM nearly the same way we do in base, and as such track the latest
>     two
>     release branches. Using the PORT_LLVM option in the port reduces the
>     build time significantly (from not building LLVM) with no change in
>     runtime behaviour.
> 
> 
> Oh, sweet.  I need to try that out. What's the downside? Do you know why 
> it isn't the default?
> 
Well, it's not the default upstream :-P The port option was resurrected 
after a long while and is maintained by yours truly.

Some history: The rustc config.toml has always had the ability to 
(optionally) specify a path to llvm-config. The port option was 
originally removed during 1.22.1, at which Rust upstream tracked their 
*fork* of LLVM trunk, at the time the development for 7.0 (6.0 was the 
latest release). Rust added an API into their LLVM fork that gecko@ 
software started to use, so building gecko@ software using an external 
LLVM-pilled rustc would fail. Once Rust started tracking LLVM 8.0 
release branch, this problem went away and their current maintenance 
practice similar to us in base [0] started.

Someone started to resurrect the PORT_LLVM option in the port as a phab 
review during the intervening period but didn't go anywhere quick 
because ENOTENOUGHEYEBALLS. It took until me waking up from a fever 
dream on this subject (and of course wanting to reduce port build time) 
to give it the additional work and testing needed to receive blessing 
for this option to return.

The only downside is a minor nit over the WASM target bundling LLD that 
upstream probably didn't catch but we have mitigated it in the port. And 
again, the aforementioned build failures on gecko@ software have long 
been resolved with the changed LLVM tracking practice.

[0] https://rustc-dev-guide.rust-lang.org/backend/updating-llvm.html

-- 
Charlie Li
...nope, still don't have an exit line.