Re: The Case for Rust (in the base system)
- In reply to: Theron : "Re: The Case for Rust (in the base system)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 04 Aug 2024 03:37:36 UTC
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>