Skip to content

Rust toolchain #3

@lrettig

Description

@lrettig

Right now we're using the SP1 toolchain: https://github.com/succinctlabs/rust. It should be possible to switch to riscv32im-risc0-zkvm-elf which has at least partial mainline Rust support, see rust-lang/rust@75d7d70. But I don't see this target listed for rustc 1.78.0 and I'm getting errors when trying to build using mainline rust rather than the custom toolchain (about missing std support).

This works:

> RUSTC=/home/lane/.rustup/toolchains/risc0/bin/rustc CFLAGS_riscv32im_risc0_zkvm_elf="-march=rv32im -nostdlib" CC=/home/lane/.local/share/cargo-risczero/cpp/bin/riscv32-unknown-elf-gcc RUSTFLAGS="-Cpasses=loweratomic -Clink-arg=-Ttext=0x00200800 -Clink-arg=--fatal-warnings -Cpanic=abort" cargo build --target riscv32im-risc0-zkvm-elf

This also works:

> LD_LIBRARY_PATH=$HOME/opt/lib:$LD_LIBRARY_PATH RUSTUP_TOOLCHAIN=risc0 cargo build

This does not work:

> RUSTFLAGS="-Cpasses=loweratomic -Clink-arg=-Ttext=0x00200800 -Clink-arg=--fatal-warnings -Cpanic=abort" cargo build --target riscv32im-risc0-zkvm-elf
   Compiling zeroize v1.8.1
   Compiling typenum v1.17.0
   Compiling cfg-if v1.0.0
   Compiling subtle v2.5.0
   Compiling const-oid v0.9.6
   Compiling tap v1.0.1
   Compiling funty v2.0.0
   Compiling base16ct v0.2.0
   Compiling ppv-lite86 v0.2.17
   Compiling generic-array v0.14.7
   Compiling num-traits v0.2.19
   Compiling radium v0.7.0
   Compiling proc-macro2 v1.0.84
   Compiling serde v1.0.203
   Compiling hex v0.4.3
   Compiling anyhow v1.0.86
error[E0463]: can't find crate for `core`
  |
  = note: the `riscv32im-risc0-zkvm-elf` target may not be installed
  = help: consider downloading the target with `rustup target add riscv32im-risc0-zkvm-elf`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

For more information about this error, try `rustc --explain E0463`.
   Compiling once_cell v1.19.0
error: could not compile `tap` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `const-oid` (lib) due to 1 previous error
error: could not compile `cfg-if` (lib) due to 1 previous error
error: could not compile `zeroize` (lib) due to 1 previous error
error: could not compile `base16ct` (lib) due to 1 previous error
error: could not compile `funty` (lib) due to 1 previous error
error: could not compile `subtle` (lib) due to 1 previous error
error: could not compile `ppv-lite86` (lib) due to 1 previous error
error: could not compile `radium` (lib) due to 1 previous error
error[E0463]: can't find crate for `std`
  |
  = note: the `riscv32im-risc0-zkvm-elf` target may not be installed
  = help: consider downloading the target with `rustup target add riscv32im-risc0-zkvm-elf`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

error: could not compile `once_cell` (lib) due to 1 previous error
error: could not compile `hex` (lib) due to 1 previous error

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