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

Error compiling with latest rust: could not compile packed_simd_2 (lib) due to 6 previous errors #66

Closed
cdesch opened this issue Nov 15, 2023 · 3 comments

Comments

@cdesch
Copy link

cdesch commented Nov 15, 2023

When compiling a project using the Spartan Lib (Code Below) on the current nightly (rustc 1.76.0-nightly (ba7c7a301 2023-11-13)), I get the following error (below) that packed_simd_2 could not be compiled. I'm not sure what is causing this, although in doing some searching, it seems support was dropped in rust 1.72 for this function [Ref: https://github.com/dtolnay/proc-macro2/issues/398]. However, I did try falling back to rust 1.71 stable and received a different error because the dependencies need the nightly features to work. It seems that this may be related, although I am not sure: rust-lang/packed_simd#356

For what it is worth, I get the same error when compiling on Rust 1.74 nightly (rustc 1.74.0-nightly (7d9bce327 2023-09-16))

Error:

>  cargo check
    Blocking waiting for file lock on build directory
    Checking cfg-if v1.0.0
    Checking byteorder v1.5.0
    Checking byte-tools v0.3.1
    Checking keccak v0.1.4
    Checking ppv-lite86 v0.2.17
    Checking adler v1.0.2
    Checking either v1.9.0
    Checking libc v0.2.150
    Checking typenum v1.17.0
    Checking libm v0.1.4
    Checking opaque-debug v0.2.3
    Checking subtle v2.5.0
    Checking unicode-ident v1.0.12
    Checking serde v1.0.192
    Checking zeroize v1.6.0
    Checking crc32fast v1.3.2
    Checking block-padding v0.1.5
    Checking miniz_oxide v0.7.1
    Checking proc-macro2 v1.0.69
    Checking itertools v0.10.5
    Checking packed_simd_2 v0.3.8
    Checking flate2 v1.0.28
    Checking generic-array v0.12.4
    Checking generic-array v0.14.7
    Checking getrandom v0.1.16
    Checking getrandom v0.2.11
    Checking rand_core v0.6.4
    Checking rand_core v0.5.1
    Checking block-buffer v0.7.3
    Checking digest v0.8.1
    Checking merlin v3.0.0
    Checking sha3 v0.8.2
    Checking rand_chacha v0.2.2
    Checking digest v0.9.0
    Checking rand v0.7.3
    Checking bincode v1.3.3
error: unrecognized platform-specific intrinsic function: `simd_shuffle2`
  --> /home/cj/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/codegen/llvm.rs:10:5
   |
10 |     pub fn simd_shuffle2<T, U>(x: T, y: T, idx: [u32; 2]) -> U;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unrecognized platform-specific intrinsic function: `simd_shuffle4`
  --> /home/cj/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/codegen/llvm.rs:11:5
   |
11 |     pub fn simd_shuffle4<T, U>(x: T, y: T, idx: [u32; 4]) -> U;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unrecognized platform-specific intrinsic function: `simd_shuffle8`
  --> /home/cj/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/codegen/llvm.rs:12:5
   |
12 |     pub fn simd_shuffle8<T, U>(x: T, y: T, idx: [u32; 8]) -> U;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unrecognized platform-specific intrinsic function: `simd_shuffle16`
  --> /home/cj/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/codegen/llvm.rs:13:5
   |
13 |     pub fn simd_shuffle16<T, U>(x: T, y: T, idx: [u32; 16]) -> U;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unrecognized platform-specific intrinsic function: `simd_shuffle32`
  --> /home/cj/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/codegen/llvm.rs:14:5
   |
14 |     pub fn simd_shuffle32<T, U>(x: T, y: T, idx: [u32; 32]) -> U;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unrecognized platform-specific intrinsic function: `simd_shuffle64`
  --> /home/cj/.cargo/registry/src/index.crates.io-6f17d22bba15001f/packed_simd_2-0.3.8/src/codegen/llvm.rs:15:5
   |
15 |     pub fn simd_shuffle64<T, U>(x: T, y: T, idx: [u32; 64]) -> U;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: could not compile `packed_simd_2` (lib) due to 6 previous errors

Project Code

Cargo.toml

[package]
name = "spartan-pocf"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
merlin = "3.0.0"
spartan = "0.8.0"

main.rs

extern crate libspartan;
extern crate merlin;
use libspartan::{Instance, SNARKGens, SNARK};
use merlin::Transcript;

fn main() {
    test_libspartan();
}

fn test_libspartan() {
      // specify the size of an R1CS instance
      let num_vars = 1024;
      let num_cons = 1024;
      let num_inputs = 10;
      let num_non_zero_entries = 1024;
  
      // produce public parameters
      let gens = SNARKGens::new(num_cons, num_vars, num_inputs, num_non_zero_entries);
  
      // ask the library to produce a synthentic R1CS instance
      let (inst, vars, inputs) = Instance::produce_synthetic_r1cs(num_cons, num_vars, num_inputs);
  
      // create a commitment to the R1CS instance
      let (comm, decomm) = SNARK::encode(&inst, &gens);
  
      // produce a proof of satisfiability
      let mut prover_transcript = Transcript::new(b"snark_example");
      let proof = SNARK::prove(&inst, &comm, &decomm, vars, &inputs, &gens, &mut prover_transcript);
  
      // verify the proof of satisfiability
      let mut verifier_transcript = Transcript::new(b"snark_example");
      assert!(proof
        .verify(&comm, &inputs, &mut verifier_transcript, &gens)
        .is_ok());
      println!("proof verification successful!");
}

Versions

Rust Version

❯ rustc --version
rustc 1.76.0-nightly (ba7c7a301 2023-11-13)

Ubuntu Version

❯ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy
@srinathsetty
Copy link
Contributor

Hi! One option could be to run it with default-features turned off. If you see the default feature here, it turns on the simd-backend feature of curve25519-dalek:

default = ["std", "simd_backend"]

@xiaolin9595
Copy link

Althought I have done what you say, the problem still existed

@srinathsetty
Copy link
Contributor

Please check the latest master. I think the build issue should be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants