Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Aug 2024 12:37:36 +0900
From:      Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
To:        Theron <theron.tarigo@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: The Case for Rust (in the base system)
Message-ID:  <20240804123736.3db9da477c91659775d3c530@dec.sakura.ne.jp>
In-Reply-To: <f55375a1-9d49-496d-9446-f879545860c3@gmail.com>
References:  <CAOtMX2hAUiWdGPtpaCJLPZB%2Bj2yzNw5DSjUmkwTi%2B%2BmyemehCA@mail.gmail.com> <vdmg5zocd6wqcwc2bvzvzqn4bii2pwdc2r4mgnisukfkboj6nf@f7lv5quu4fjx> <CAOtMX2iDK3uN_oQgzzZAdoOZCfNsnvpefeZvKoTCRmPBhZywzA@mail.gmail.com> <CANCZdfqB1%2B-8BkpKwKoCM%2BzM4mCOFy63yHr1Pco7MnT1DFkb4w@mail.gmail.com> <knnsh327gxyvaajwrymvflnivf3tsnigyqw2d6etfhb4irft3x@ydkh3zmb6uch> <CANCZdfoHjYUDeNo78qk6BjHfRgwgDbuuVjD5D9uG6tyCk81-ew@mail.gmail.com> <f55375a1-9d49-496d-9446-f879545860c3@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 3 Aug 2024 20:41:22 -0400
Theron <theron.tarigo@gmail.com> wrote:

> On 8/3/24 13:36, Warner Losh wrote:
> > We already have clang and gcc external tool chains, so there's a proven
> > mechanism for that. But there's not a good notion of the concept "I have
> > a rust compiler" or "I depend on rust". And there's no concept of crates
> > or similar that rust programs use, but that will be one thorny area that
> > we'll have to design for. Do we just pull them in and junk any notion of
> > a reproducible build for these components into the future (since any crate
> > can go away), or do we have a way to build up our own set of crates
> > in the tree that the optional components depend on. How do we do change
> > management on that if we have multiple programs that depend on a crate
> > that's updated? how do we keep things fresh while not having update
> > cascades be too burdensome a task. How does this tie into pkgbase?
> >
> > These are the things to think about. We don't need to solve all of
> > them, but the Rust ecosystem is quite a bit different than the C ecosystem
> > in the details of a number of these points, so we have to address them
> > if we want to use Rust in base with the same traits as all the other bits
> > in base today (or we need to have a thoughtful discussion on paradigm
> > shift and settle on that). To my thinking, pkgbase might be a good way
> > to segregate crates that are build from the base tree and express 
> > dependencies
> > on optional components that use it, and have the ultimate dependency
> > be a pkg from ports.
> >
> > These questions and design points aren't hard and aren't designed to
> > block anything, but a bare minimum of what we need to articulate is the
> > vision for these components. Likely a design document that spells these
> > out in some degree of detail (or that we punt in this phase) would be good
> > as well. I can help with that as well.
> >
> > Warner
> 
> Rust must be adapted to the established practice of keeping base 
> dependencies in-tree, not the other way around.  Whatever shift of 
> thinking is required within Rust for cooperating with this kind of 
> stability within a project will be good for the Rust ecosystem as well.
> 
> Theron

Putting other problems (like managements of crates, moving goals) aside.

At least, Rust components for base should be built with
--crate-type=cdylib option [1] to allow dynamically linking with other
components. Otherwise, base llvm/clang would be forced to generate
Rust-style object format even for libc, I fear.

[1] https://doc.rust-lang.org/reference/linkage.html

-- 
Tomoaki AOKI    <junchoon@dec.sakura.ne.jp>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20240804123736.3db9da477c91659775d3c530>