Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] cargo version > 1.76 results in build errors when risc0 deps are specified as git dependencies in Cargo.toml #1840

Closed
SchmErik opened this issue May 15, 2024 · 1 comment · Fixed by #1867
Labels
bug Something isn't working

Comments

@SchmErik
Copy link
Contributor

Bug Report

When using risc0 crates as git dependencies (meaning git = is used in the Cargo.toml instead of version =), compiling risc0-zkvm crate results in the following error when running cargo build on a risc zero project:

error: invalid inline table
expected `}`
 --> ../../../../../../../home/ubuntu/.cargo/git/checkouts/risc0-7d6ab9951628e5b1/ecb7a53/templates/rust-starter/host/Cargo.toml:8:16
  |
8 | risc0-zkvm = { {{ risc0_zkvm }} }
  |                ^
  |
error: invalid inline table
expected `}`
 --> ../../../../../../../home/ubuntu/.cargo/git/checkouts/risc0-7d6ab9951628e5b1/ecb7a53/templates/rust-starter/methods/Cargo.toml:7:17
  |
7 | risc0-build = { {{ risc0_build }} }
  |                 ^
  |
error: invalid inline table
expected `}`
 --> ../../../../../../../home/ubuntu/.cargo/git/checkouts/risc0-7d6ab9951628e5b1/ecb7a53/templates/rust-starter/methods/guest/Cargo.toml:2:9
  |
2 | name = {{ guest_package_name }}
  |         ^
  |

What appears to be happening is that the risc0 rust-starter template is getting compiled. I found that removing the templates directory from the dependency makes this error message disappear.

A few solutions off the top of my head:

  1. get rid of cargo-generate
  2. move the template to a separate repo
  3. figure out a way to suppress compilation of the template directory. I tried to exclude this in the workspace's Cargo.toml but this had no effect.

Steps to Reproduce

  1. create a project, use git = for risc0 dependencies
  2. run cargo build. Be sure to run cargo update to ensure that the deps are updated (helpful in certain situations where cargo does not pick up the newest changes pushed to a repo).
  3. error is displayed

Expected behavior

Error should not be displayed.

Your Environment

  • risc0-zkvm version: 1.0.0-rc.4
  • Rust version: host side = 1.77, 1.78
  • Platform/OS: mac and linux
@SchmErik SchmErik added the bug Something isn't working label May 15, 2024
SchmErik added a commit that referenced this issue May 22, 2024
The `cargo-generate` crate is designed with the assumption that
templates to reside in a small repository. Our template is a part of a
large repository and takes anywhere between 3-10 seconds to run `cargo
risczero new` because it has to clone the repo. This change drops
cargo-generate and instead uses regex patterns to search and replace the
template during generation. Locally, this takes about 0.5 seconds to
run. I've dropped several options that seemed irrelevant. Another
notable change is the renaming of the template's `Cargo.toml` to
`Cargo-toml`. By doing so, I have fixed
#1840.

Fixes: #1840
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant