-
Notifications
You must be signed in to change notification settings - Fork 294
Description
Context:
We are collaborating with the Novanet team to implement zkML using Jolt. As a first step, we are writing Jolt guest code to load a simple Gradient Boosting model from an ONNX file and execute inference. However, during compilation of our guest code, we are encountering errors related to the filetime crate.
Steps to Reproduce:
- Clone our guest implementation here run onnx in guest ICME-Lab/zkml-jolt#4
- Build and run the guest code using:
cargo run -r -p onnx --bin prove_onnx
Expected Behavior:
The code should compile without issues and perform inference using the ONNX model.
Actual Behavior:
Compilation fails with errors originating from the filetime crate. Key error messages include:
- Error regarding missing Unix module:
error[E0433]: failed to resolve: could not find `unix` in `os` --> filetime-0.2.25/src/unix/mod.rs:4:14 | 4 | use std::os::unix::prelude::*; | ^^^^ could not find `unix` in `os` - Additional errors related to
libcand missing methods (e.g.,as_raw_fd,mtime,atime):error[E0432]: unresolved import `libc` error[E0599]: no method named `as_raw_fd` found for reference `&File` in the current scope ...
Workarounds Attempted:
-
Default Features Disabled:
We setfiletime = { version = "0.2", default-features = false }in our guest project’s Cargo.toml to disable Unix-specific code. However, the error still occurs. -
Patching filetime via [patch.crates-io]:
We attempted to override filetime using a patch in our guest project’s Cargo.toml and then in the workspace root. The patch was rejected with the message:warning: patch for `filetime` uses the features mechanism. default-features and features will not take effect because the patch dependency does not support this mechanism error: failed to resolve patches for `https://github.com/rust-lang/crates.io-index` Caused by: patch for `filetime` in `https://github.com/rust-lang/crates.io-index` points to the same source, but patches must point to different sourcesThis indicates that patching the filetime crate in this way isn’t working because it points to the same source as crates.io.
-
Target Configuration:
We considered whether our build target might be causing the issue (i.e., a non-Unix or custom target environment wherestd::os::unixis unavailable). However, it is unclear whether adjusting target specifications alone can resolve the issue.
Additional Information:
- The
filetimecrate’s own Cargo.toml uses conditional dependencies to includelibcon Unix platforms. It appears that on our target, the#[cfg(unix)]condition is being incorrectly evaluated, leading to compilation of Unix-specific code on a non-Unix target. - Our project’s workspace includes Jolt’s
jolt-core, which does not seem to modify the dependency onfiletimedirectly. - We have confirmed that the guest code and workspace Cargo.toml do not override filetime elsewhere.
Request:
Could you please advise on how to resolve these compilation issues?
- Is there a known workaround for building Jolt guest code on our target environment?
- Should we use a fork of filetime with modifications for non-Unix targets?
- Are there any adjustments required in Jolt’s dependency management for proper cross-platform compatibility?
Thank you for your assistance.
found very similar issue on RISC0 space: risc0/risc0#2401