---
title: "Rust, July 15, 2022"
tags: unikraft, rust
datetime: 2022-07-15T15:00:00+02:00
location: Online, Discord (https://bit.ly/UnikraftDiscord), the `#monkey-business` voice channel
teams:
- rust
participants:
- TODO
---
## :dart: Agenda
- Current state of Rust support
- Goals and requirements
- Next steps & tasks
## :closed_book: Discussions
VB: We did something similar to the Linux guys.
We can compile with rustc an object file and link that to the rest of Unikraft.
VB: What we were looking for is integrate Cargo.
A solution to our problem is a big guard to use Cargo.
VB: In Tock they have a similar issue.
From the GNU Make system.
VB: We build `core`, `alloc` crates.
MK: Why do you build it manually?
MK: In theory you should be able to use Cargo.
AJ: Maybe we could use: https://github.com/matklad/cargo-xtask/
MK: What about applications in Rust?
DK: I used the Make system to do the same thing.
Then I pivoted to using Cargo inside the Make system.
Everything is then covered by Cargo.
AJ: I'm interested in using tooling to build applications.
AJ: As I understand it, you just mention the main file and then the build system takes care of dependencies.
DK: You just edit the `Cargo.toml` file and add the source file.
After building you could link it against Unikraft libraries.
MK: For RustyHermit, we encapsulated the kernel in a crate.
The end user would then just plugin a dependency that links together.
MK: Support for `standard` is important.
AJ: Could Unikraft be built as a crate?
MK: There is a `build.rs` file that could then get Rust files.
AJ: Could we have a separate repository for `build.rs`?
MK: Yes, this should work.
AJ: Would it be possible to have a platform + architecture pair?
MK: When you invoke `cargo` you invoke a target.
For us, it's just the RustyHermit target.
MK: You would have to create a `unikraft` target.
MK: In the end we would have to have a target for each combination.
MK: For Rust, the platform shouldn't matter (`kvm` or `xen`).
MK: I'm not sure about how that would look in reality.
You always have to add a cargo spec each time you add a new target / architecture.
AJ: dynamic = could we have them listed somewhere?
MK: It should be possible to list them one in one place.
DK: What this does is add a rule to allow building Cargo-based files.
MK: Why do you want to integrate Cargo?
AJ: We can inject Makefile rules?
DK: In the PR (https://github.com/unikraft/unikraft/pull/291) we just do a pattern match for file types and call the appropriate build rules.
## :wrench: TODOs and Decisions
DK: Point Alex to where he can see how we can build applications in Rust using tooling.
VB/DK: Provide updates to the Cargo-build PR (https://github.com/unikraft/unikraft/pull/291).
MK: Take a look in the Cargo-build PR and provide your vision on proper integration of Rust + Unikraft.
RD: Schedule another meeting on Wednesday-Thursday, July 20-21, 2022.