Skip to content

libkrun: Produce a proper Rust library#588

Draft
d-e-s-o wants to merge 2 commits intocontainers:mainfrom
d-e-s-o:topic/rust-lib
Draft

libkrun: Produce a proper Rust library#588
d-e-s-o wants to merge 2 commits intocontainers:mainfrom
d-e-s-o:topic/rust-lib

Conversation

@d-e-s-o
Copy link
Contributor

@d-e-s-o d-e-s-o commented Mar 14, 2026

Produce a proper Rust library to avoid the need for C library
installation as well as binding generation/definition. Basically, we can
now reference the crate via Cargo.toml:

[dependencies]
libkrun = ...

instead of having to rely on constructs like:

#[link(name = "krun")]
extern "C" {
  pub fn krun_create_ctx() -> i32;
  ...
}

For a brief discussion of the topic, see #494 (comment)

Make all workspace members compatible with vm-memory in version 0.18 and
remove the dependency on vm-memory 0.16.2. Also fix up the version range
specification, which was not correct (at least one version was not
actually building) and in any event untested.
The reason we need this change is because we need to use a single
version of vm-memory, or we will see type/trait mismatches due to semver
incompatible versions being used.

Signed-off-by: Daniel Müller <deso@posteo.net>
@d-e-s-o
Copy link
Contributor Author

d-e-s-o commented Mar 14, 2026

Still blocked on rust-vmm/linux-loader#223 and it being included in a new release.

@d-e-s-o d-e-s-o force-pushed the topic/rust-lib branch 3 times, most recently from 2f00f43 to 5987285 Compare March 14, 2026 18:15
Produce a proper Rust library to avoid the need for C library
installation as well as binding generation/definition. Basically, we can
now reference the crate via Cargo.toml:

  [dependencies]
  libkrun = ...

instead of having to rely on constructs like:

  #[link(name = "krun")]
  extern "C" {
    pub fn krun_create_ctx() -> i32;
    ...
  }

Signed-off-by: Daniel Müller <deso@posteo.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant