dalek-cryptography / bulletproofs

A pure-Rust implementation of Bulletproofs using Ristretto.
MIT License
1.03k stars 217 forks source link

error: could not compile `packed_simd_2` due to 3 previous errors #359

Open bo-hub opened 1 year ago

bo-hub commented 1 year ago

Error report

I git clone this repo and then run cargo test. And the error information came out.

$ cargo test
    Updating crates.io index
  Downloaded serde_derive v1.0.147
  Downloaded serde v1.0.147
  Downloaded serde_json v1.0.87
  Downloaded syn v1.0.103
  Downloaded libc v0.2.137
  Downloaded 5 crates (1.1 MB) in 10.09s
warning: invalid feature `yoloproofs` in required-features of target `r1cs`: `yoloproofs` is not present in [features] section
   Compiling proc-macro2 v1.0.47
   Compiling quote v1.0.21
   Compiling unicode-ident v1.0.5
   Compiling syn v1.0.103
   Compiling autocfg v1.1.0
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.137
   Compiling serde_derive v1.0.147
   Compiling serde v1.0.147
   Compiling typenum v1.15.0
   Compiling crossbeam-utils v0.8.12
   Compiling getrandom v0.1.16
   Compiling memchr v2.5.0
   Compiling unicode-xid v0.2.4
   Compiling libm v0.1.4
   Compiling rayon-core v1.9.3
   Compiling byteorder v1.4.3
   Compiling scopeguard v1.1.0
   Compiling packed_simd_2 v0.3.8
   Compiling serde_json v1.0.87
   Compiling either v1.8.0
   Compiling byte-tools v0.3.1
   Compiling ryu v1.0.11
   Compiling cc v1.0.73
   Compiling unicode-width v0.1.10
   Compiling itoa v1.0.4
   Compiling ppv-lite86 v0.2.16
   Compiling keccak v0.1.2
   Compiling regex-automata v0.1.10
   Compiling plotters-backend v0.3.4
   Compiling thiserror v1.0.37
   Compiling lazy_static v1.4.0
   Compiling same-file v1.0.6
   Compiling subtle v2.4.1
   Compiling bitflags v1.3.2
   Compiling opaque-debug v0.2.3
   Compiling cast v0.3.0
   Compiling itoa v0.4.8
   Compiling half v1.8.2
   Compiling regex-syntax v0.6.27
   Compiling oorandom v11.1.3
   Compiling hex v0.3.2
   Compiling memoffset v0.6.5
   Compiling crossbeam-epoch v0.9.11
   Compiling num-traits v0.2.15
   Compiling rayon v1.5.3
   Compiling block-padding v0.1.5
   Compiling itertools v0.10.5
   Compiling textwrap v0.11.0
   Compiling walkdir v2.3.2
   Compiling plotters-svg v0.3.3
   Compiling clap v2.34.0
   Compiling crossbeam-channel v0.5.6
   Compiling num_cpus v1.13.1
   Compiling atty v0.2.14
   Compiling regex v1.6.0
   Compiling clear_on_drop v0.2.5
   Compiling csv-core v0.1.10
   Compiling generic-array v0.12.4
   Compiling rand_core v0.5.1
   Compiling criterion-plot v0.4.5
   Compiling plotters v0.3.4
   Compiling crossbeam-deque v0.8.2
   Compiling rand_chacha v0.2.2
   Compiling digest v0.8.1
   Compiling block-buffer v0.7.3
error[E0554]: `#![feature]` may not be used on the stable release channel
 --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/clear_on_drop-0.2.5/src/lib.rs:2:34
  |
2 | #![cfg_attr(feature = "nightly", feature(min_specialization))]
  |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `clear_on_drop` due to previous error
warning: build failed, waiting for other jobs to finish...
error[E0554]: `#![feature]` may not be used on the stable release channel
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/packed_simd_2-0.3.8/src/lib.rs:214:1
    |
214 | / #![feature(
215 | |     adt_const_params,
216 | |     repr_simd,
217 | |     rustc_attrs,
...   |
224 | |     custom_inner_attributes,
225 | | )]
    | |__^

error[E0554]: `#![feature]` may not be used on the stable release channel
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/packed_simd_2-0.3.8/src/lib.rs:219:5
    |
219 |     stdsimd,
    |     ^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/packed_simd_2-0.3.8/src/lib.rs:222:5
    |
222 |     core_intrinsics,
    |     ^^^^^^^^^^^^^^^

error: could not compile `packed_simd_2` due to 3 previous errors

Is there anything I should noticed?

rubdos commented 1 year ago

error[E0554]: #![feature] may not be used on the stable release channel

Did you try running it on a nightly compiler? cargo +nighty test ?

bo-hub commented 1 year ago

@rubdos Thanks for this, I missed the build instruction. I used apt command in Ubuntu to install rust.
Now I removed the rust and reinstall it by

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Then I run the command rustup default nightly to have nightly Rust installed. But the cargo test command get another error info.

$ cargo test
    Updating crates.io index
   Compiling proc-macro2 v1.0.47
   Compiling unicode-ident v1.0.5
   Compiling quote v1.0.21
   Compiling autocfg v1.1.0
   Compiling syn v1.0.103
   Compiling libc v0.2.137
   Compiling crossbeam-utils v0.8.12
   Compiling serde_derive v1.0.147
   Compiling typenum v1.15.0
   Compiling getrandom v0.1.16
   Compiling cfg-if v1.0.0
   Compiling memchr v2.5.0
   Compiling unicode-xid v0.2.4
   Compiling libm v0.1.4
   Compiling scopeguard v1.1.0
   Compiling serde v1.0.147
   Compiling byte-tools v0.3.1
   Compiling serde_json v1.0.87
   Compiling packed_simd_2 v0.3.8
   Compiling rayon-core v1.9.3
   Compiling cc v1.0.73
   Compiling regex-automata v0.1.10
   Compiling plotters-backend v0.3.4
error: attributes are not yet allowed on `if` expressions
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/plotters-backend-0.3.4/src/lib.rs:177:21
    |
177 |                     #[allow(clippy::question_mark)]
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: Could not compile `plotters-backend`.
warning: build failed, waiting for other jobs to finish...
error: build failed
wuliuqii commented 1 year ago

@rubdos Thanks for this, I missed the build instruction. I used apt command in Ubuntu to install rust. Now I removed the rust and reinstall it by

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Then I run the command rustup default nightly to have nightly Rust installed. But the cargo test command get another error info.

$ cargo test
    Updating crates.io index
   Compiling proc-macro2 v1.0.47
   Compiling unicode-ident v1.0.5
   Compiling quote v1.0.21
   Compiling autocfg v1.1.0
   Compiling syn v1.0.103
   Compiling libc v0.2.137
   Compiling crossbeam-utils v0.8.12
   Compiling serde_derive v1.0.147
   Compiling typenum v1.15.0
   Compiling getrandom v0.1.16
   Compiling cfg-if v1.0.0
   Compiling memchr v2.5.0
   Compiling unicode-xid v0.2.4
   Compiling libm v0.1.4
   Compiling scopeguard v1.1.0
   Compiling serde v1.0.147
   Compiling byte-tools v0.3.1
   Compiling serde_json v1.0.87
   Compiling packed_simd_2 v0.3.8
   Compiling rayon-core v1.9.3
   Compiling cc v1.0.73
   Compiling regex-automata v0.1.10
   Compiling plotters-backend v0.3.4
error: attributes are not yet allowed on `if` expressions
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/plotters-backend-0.3.4/src/lib.rs:177:21
    |
177 |                     #[allow(clippy::question_mark)]
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: Could not compile `plotters-backend`.
warning: build failed, waiting for other jobs to finish...
error: build failed

@bo-hub I have the same problem, have you solved it?

bo-hub commented 1 year ago

@wuliuqii Not yet

rubdos commented 1 year ago

Sounds like you'll need to figure out which exact version of nightly you need. Did you try with nightly-2019-07-31, as suggested by the rust-toolchain file?

bo-hub commented 1 year ago

@rubdos I followed the version change advice by rustup default nightly-2019-07-31.

$ rustup default nightly-2019-07-31
info: using existing install for 'nightly-2019-07-31-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-2019-07-31-x86_64-unknown-linux-gnu'

  nightly-2019-07-31-x86_64-unknown-linux-gnu unchanged - rustc 1.38.0-nightly (dddb7fca0 2019-07-30)

info: note that the toolchain 'nightly-2019-07-31-x86_64-unknown-linux-gnu' is currently in use (overridden by '/home/tours/code/crypto/zkproof/dalek-bulletproof/bulletproofs/rust-toolchain')

Then the cargo test get another error...

$ cargo test
   Compiling plotters-backend v0.3.4
   Compiling half v1.8.2
   Compiling subtle v2.4.1
   Compiling syn v1.0.103
   Compiling crossbeam-utils v0.8.12
   Compiling typenum v1.15.0
   Compiling serde_derive v1.0.147
   Compiling getrandom v0.1.16
   Compiling libm v0.1.4
   Compiling memchr v2.5.0
   Compiling serde v1.0.147
   Compiling clear_on_drop v0.2.5
   Compiling packed_simd_2 v0.3.8
error: attributes are not yet allowed on `if` expressions
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/plotters-backend-0.3.4/src/lib.rs:177:21
    |
177 |                     #[allow(clippy::question_mark)]
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

   Compiling rayon-core v1.9.3
error: Could not compile `plotters-backend`.
warning: build failed, waiting for other jobs to finish...
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/subtle-2.4.1/src/lib.rs:575:1
    |
575 | impl<T> From<CtOption<T>> for Option<T> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
    |
    = note: only traits defined in the current crate can be implemented for a type parameter

error: aborting due to previous error

For more information about this error, try `rustc --explain E0210`.
error: Could not compile `subtle`.
warning: build failed, waiting for other jobs to finish...
error: `core::num::<impl u16>::to_le_bytes` is not yet stable as a const fn
  --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/bfloat.rs:86:9
   |
86 |         self.0.to_le_bytes()
   |         ^^^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error: `core::num::<impl u16>::to_be_bytes` is not yet stable as a const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/bfloat.rs:101:9
    |
101 |         self.0.to_be_bytes()
    |         ^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error: `core::num::<impl u16>::to_ne_bytes` is not yet stable as a const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/bfloat.rs:124:9
    |
124 |         self.0.to_ne_bytes()
    |         ^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error: `core::num::<impl u16>::from_le_bytes` is not yet stable as a const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/bfloat.rs:138:25
    |
138 |         bf16::from_bits(u16::from_le_bytes(bytes))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error: `core::num::<impl u16>::from_be_bytes` is not yet stable as a const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/bfloat.rs:152:25
    |
152 |         bf16::from_bits(u16::from_be_bytes(bytes))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error: `core::num::<impl u16>::from_ne_bytes` is not yet stable as a const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/bfloat.rs:174:25
    |
174 |         bf16::from_bits(u16::from_ne_bytes(bytes))
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error[E0723]: loops and conditional expressions are not stable in const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/bfloat.rs:281:9
    |
281 |         exp != 0x7F80u16 && exp != 0
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add `#![feature(const_fn)]` to the crate attributes to enable

error[E0723]: loops and conditional expressions are not stable in const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/bfloat.rs:305:14
    |
305 |             (0, 0) => FpCategory::Zero,
    |              ^
    |
    = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add `#![feature(const_fn)]` to the crate attributes to enable

error[E0723]: loops and conditional expressions are not stable in const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/bfloat.rs:332:9
    |
332 | /         if self.is_nan() {
333 | |             self
334 | |         } else if self.0 & 0x8000u16 != 0 {
335 | |             Self::NEG_ONE
336 | |         } else {
337 | |             Self::ONE
338 | |         }
    | |_________^
    |
    = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add `#![feature(const_fn)]` to the crate attributes to enable

error: `core::num::<impl u16>::to_le_bytes` is not yet stable as a const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/binary16.rs:170:9
    |
170 |         self.0.to_le_bytes()
    |         ^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error: `core::num::<impl u16>::to_be_bytes` is not yet stable as a const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/binary16.rs:185:9
    |
185 |         self.0.to_be_bytes()
    |         ^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error: `core::num::<impl u16>::to_ne_bytes` is not yet stable as a const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/binary16.rs:208:9
    |
208 |         self.0.to_ne_bytes()
    |         ^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error: `core::num::<impl u16>::from_le_bytes` is not yet stable as a const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/binary16.rs:222:24
    |
222 |         f16::from_bits(u16::from_le_bytes(bytes))
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error: `core::num::<impl u16>::from_be_bytes` is not yet stable as a const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/binary16.rs:236:24
    |
236 |         f16::from_bits(u16::from_be_bytes(bytes))
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error: `core::num::<impl u16>::from_ne_bytes` is not yet stable as a const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/binary16.rs:258:24
    |
258 |         f16::from_bits(u16::from_ne_bytes(bytes))
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(const_int_conversion)]` to the crate attributes to enable

error[E0723]: loops and conditional expressions are not stable in const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/binary16.rs:375:9
    |
375 |         exp != 0x7C00u16 && exp != 0
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add `#![feature(const_fn)]` to the crate attributes to enable

error[E0723]: loops and conditional expressions are not stable in const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/binary16.rs:399:14
    |
399 |             (0, 0) => FpCategory::Zero,
    |              ^
    |
    = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add `#![feature(const_fn)]` to the crate attributes to enable

error[E0723]: loops and conditional expressions are not stable in const fn
   --> /home/tours/.cargo/registry/src/github.com-1ecc6299db9ec823/half-1.8.2/src/binary16.rs:426:9
    |
426 | /         if self.is_nan() {
427 | |             self
428 | |         } else if self.0 & 0x8000u16 != 0 {
429 | |             Self::NEG_ONE
430 | |         } else {
431 | |             Self::ONE
432 | |         }
    | |_________^
    |
    = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
    = help: add `#![feature(const_fn)]` to the crate attributes to enable

error: aborting due to 18 previous errors

For more information about this error, try `rustc --explain E0723`.
error: Could not compile `half`.
warning: build failed, waiting for other jobs to finish...
error: build failed
g-maspero commented 1 year ago

Any updates on this? I'm having the same issue. @bo-hub were you able to find a work around?