lambdaclass / cairo-vm

cairo-vm is a Rust implementation of the Cairo VM. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly without the need for this party to re-execute the same program.
https://lambdaclass.github.io/cairo-vm
Apache License 2.0
508 stars 142 forks source link

Compilation Errors when Using std Feature with cairo-vm and lambdaworks dependencies #1598

Closed raphaelDkhn closed 7 months ago

raphaelDkhn commented 7 months ago

When attempting to compile a project that includes both the lambdaworks and cairo-vm dependencies with the std feature enabled, I encounter compilation error. Below is the relevant part of my project's Cargo.toml file:

[dependencies]
cairo-platinum-prover = { git = "https://github.com/lambdaclass/lambdaworks", rev = "fed12d674418e4f09bc843b71bc90008a85b1aed", default-features = false }
cairo-vm = { git = "https://github.com/lambdaclass/cairo-vm.git", rev = "1a78237", default-features = false, features = [
    "std",
    "cairo-1-hints",
] }

The compilation errors are as follows:

error[E0433]: failed to resolve: use of undeclared crate or module `std`
  --> /Users/raphaeldoukhan/.cargo/git/checkouts/cairo-vm-0c3551b29fd6ce3c/e61ae17/vm/src/vm/errors/vm_errors.rs:22:17
   |
22 | #[derive(Debug, Error)]
   |                 ^^^^^ use of undeclared crate or module `std`
   |
   = note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
   |
4  + use core::option::Option;
   |
4  + use nom::lib::std::option::Option;
   |
4  + use serde::__private::Option;
   |
help: if you import `Option`, refer to it directly
   |
22 | #[derive(Debug, Error)]
raphaelDkhn commented 7 months ago

I finally managed to compile it, by replacing thiserror with thiserror-no-std dependency in my project