Skip to content

Add Rust binary examples and compilation support #11

@danbugs

Description

@danbugs

Add Rust example programs that compile to Nanvix binaries and document the compilation process. Current binary support works for C/C++ but Rust compilation succeeds but runtime execution fails with socket errors. Need to investigate Rust-specific runtime requirements, add working Rust examples to guest-examples/, and document the cargo compilation workflow using the nanvix target. Should include simple and complex Rust programs demonstrating std library features.

Repro:

cd guest-examples/
cargo new hello-rust
docker pull nanvix/toolchain:latest
docker run --rm -v "$(pwd):/mnt" -v "$HOME/.cache/nanvix-registry:/nanvix-registry:ro" nanvix/toolchain:latest /bin/bash -l -c 'cd /mnt && cargo +nanvix-x86 build --release --target i686-unknown-nanvix'
cp hello-rust/target/i686-unknown-nanvix/release/hello-rust.elf hello-rust.elf
cargo run -- guest-examples/hello-rust.elf

Output:

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/hyperlight-nanvix guest-examples/hello-rust.elf`
Error running workload: failed to connect to gateway socket (address=/tmp/hyperlight-nanvix/nvx:hello-rust.elf:gw-2856724221.debug.socket)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions