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] blst does not build using cargo risczero test #1761

Open
SchmErik opened this issue Apr 30, 2024 · 1 comment
Open

[BUG] blst does not build using cargo risczero test #1761

SchmErik opened this issue Apr 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@SchmErik
Copy link
Contributor

Bug Report

Running cargo risczero test in the blst crate's bindings/rust directory does not work.

Steps to Reproduce

  1. install cargo risczero with the experimental feature by running cargo install --force --path risc0/cargo-risczero -F experimental
  2. clone BLST by running https://github.com/supranational/blst.git
  3. add this change to patch getrandom
diff --git a/bindings/rust/Cargo.toml b/bindings/rust/Cargo.toml
index ce6ba53..d6ecfbe 100644
--- a/bindings/rust/Cargo.toml
+++ b/bindings/rust/Cargo.toml
@@ -50,6 +50,9 @@ serde = { version = "1.0.152", optional = true }
 
 [target.'cfg(not(any(target_arch="wasm32", target_os="none", target_os="unknown", target_os="uefi")))'.dependencies]
 threadpool = "^1.8.1"
+[target.'cfg(all(target_os = "zkvm", target_arch = "riscv32"))'.dependencies]
+getrandom = { version = "0.2", features = ["custom"] }
+
 
 [dev-dependencies]
 rand = "0.8"
  1. run cargo risczero test from the directory bindings/rust in the blst directory.
  2. The following warning appears in the terminal output:
warning: blst@0.3.11: warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive library: /Users/erik/blst/bindings/rust/target/riscv32im-risc0-zkvm-elf/debug/build/blst-66bf3377eb4d0726/out/libblst.a the table of contents is empty (no object file members in the library define global symbols)

followed by linker errors like these:

  = note: rust-lld: error: /Users/erik/blst/bindings/rust/target/riscv32im-risc0-zkvm-elf/debug/build/blst-66bf3377eb4d0726/out/libblst.a(9cfc24e6b3ae334c-server.o):(.debug_rnglists+0x11): unknown relocation (60) against symbol .LFE0
          rust-lld: error: /Users/erik/blst/bindings/rust/target/riscv32im-risc0-zkvm-elf/debug/build/blst-66bf3377eb4d0726/out/libblst.a(9cfc24e6b3ae334c-server.o):(.debug_rnglists+0x11): unknown relocation (61) against symbol .LFB0
          rust-lld: error: /Users/erik/blst/bindings/rust/target/riscv32im-risc0-zkvm-elf/debug/build/blst-66bf3377eb4d0726/out/libblst.a(9cfc24e6b3ae334c-server.o):(.debug_rnglists+0x17): unknown relocation (60) against symbol .LFE1

Expected behavior

I would expect cargo risczero test compile and link successfully and start running tests

Your Environment

  • risc0-zkvm version: 0.21
  • Rust version: 1.77.2
  • Platform/OS: macOS

Additional context

Without the change to the Cargo.toml the compilation will fail with an error that originates from the getrandom crate. I'll file a separate issue for this.

@SchmErik SchmErik added the bug Something isn't working label Apr 30, 2024
Copy link

linear bot commented Apr 30, 2024

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

No branches or pull requests

1 participant