Skip to content

Rust templates fail to build/missing RISC-V target architecture #244

@masiedu4

Description

@masiedu4

Ran into an issue while trying to build the Rust template.

  • cartesi build works fine (because Dockerfile handles RISC-V setup)
  • But cargo build locally fails with:these errors:
error[E0463]: can't find crate for `core`
  |
  = note: the `riscv64gc-unknown-linux-gnu` target may not be installed
  = help: consider downloading the target with `rustup target add riscv64gc-unknown-linux-gnu`

error[E0463]: can't find crate for `std`

Fix

To provide value for developers who want to use their IDE's Rust support

  1. Add the RISC-V target

rustup target add riscv64gc-unknown-linux-gnu

  1. Edit the Cargo.toml file
[build]
target = "riscv64gc-unknown-linux-gnu" 

or build with(on Apple SIlicon)

cargo build --target aarch64-apple-darwin

Docs

Could we add a small note in here about this? Something like:

If you're building the Rust template, make sure to run rustup target add riscv64gc-unknown-linux-gnu first.
Otherwise, you'll get compilation errors about missing core and std crates.

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