briansmith / ring

Safe, fast, small crypto using Rust
Other
3.65k stars 684 forks source link

evaluation of constant value failed -> assert!(cfg!(target_feature = "sse") && cfg!(target_feature = "sse2")) #1988

Closed rdbo closed 4 months ago

rdbo commented 4 months ago

OS: Alpine Linux Arch: x86_64 Target: nightly-x86_64-unknown-linux-musl rustc verison: rustc 1.77.0-nightly (190f4c961 2024-01-09)

I've been trying to compile axum and some other dependencies using exclusively rustls, and it seems that rustls-webpki depends on ring, and ring is failing to compile with the following error:

error[E0080]: evaluation of constant value failed
  --> /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.8/src/cpu/intel.rs:28:9
   |
28 |         assert!(cfg!(target_feature = "sse") && cfg!(target_feature = "sse2"));
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: cfg!(target_feature = "sse") && cfg!(target_feature = "sse2")', /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.8/src/cpu/intel.rs:28:9
   |
   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0080`.
The following warnings were emitted during compilation:

warning: ring@0.17.8: Compiler version doesn't include clang or GCC: "cc" "--version"
warning: ring@0.17.8: Compiler version doesn't include clang or GCC: "cc" "--version"

error: could not compile `ring` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: ring@0.17.8: Compiler version doesn't include clang or GCC: "cc" "--version"
warning: ring@0.17.8: Compiler version doesn't include clang or GCC: "cc" "--version"

error: could not compile `ring` (lib) due to 1 previous error

I'm not sure what this means exactly, but I tried adding -C target-cpu=native, but that didn't help.

rdbo commented 4 months ago

Seems like this was a problem with the Rust toolchain itself (even though I managed to compile it successfully with this same toolchain in another machine, so that's why I assumed it was a problem with the crate). I tried again with nightly 1.78.0 (2024-03-11) and it's building