tkaitchuck / aHash

aHash is a non-cryptographic hashing algorithm that uses the AES hardware instruction
https://crates.io/crates/ahash
Apache License 2.0
986 stars 94 forks source link

compile error: use of unstable library feature 'stdsimd' #195

Closed Anton-4 closed 5 months ago

Anton-4 commented 6 months ago

Since the latest ahash 0.8.7 release I'm hitting a use of unstable library feature 'stdsimd' on compilation. We test on several architectures and operating systems and this only occurred on our macos m1 mac mini.

Full error:

 error[E0658]: use of unstable library feature 'stdsimd'
   --> /Users/m1ci/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ahash-0.8.7/src/operations.rs:124:24
    |
124 |     let res = unsafe { vaesmcq_u8(vaeseq_u8(transmute!(value), transmute!(0u128))) };
    |                        ^^^^^^^^^^
    |
    = note: see issue #48556 <https://github.com/rust-lang/rust/issues/48556> for more information

error[E0658]: use of unstable library feature 'stdsimd'
   --> /Users/m1ci/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ahash-0.8.7/src/operations.rs:124:35
    |
124 |     let res = unsafe { vaesmcq_u8(vaeseq_u8(transmute!(value), transmute!(0u128))) };
    |                                   ^^^^^^^^^
    |
    = note: see issue #48556 <https://github.com/rust-lang/rust/issues/48556> for more information

error[E0658]: use of unstable library feature 'stdsimd'
   --> /Users/m1ci/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ahash-0.8.7/src/operations.rs:154:24
    |
154 |     let res = unsafe { vaesimcq_u8(vaesdq_u8(transmute!(value), transmute!(0u128))) };
    |                        ^^^^^^^^^^^
    |
    = note: see issue #48556 <https://github.com/rust-lang/rust/issues/48556> for more information

error[E0658]: use of unstable library feature 'stdsimd'
   --> /Users/m1ci/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ahash-0.8.7/src/operations.rs:154:36
    |
154 |     let res = unsafe { vaesimcq_u8(vaesdq_u8(transmute!(value), transmute!(0u128))) };
    |                                    ^^^^^^^^^
    |
    = note: see issue #48556 <https://github.com/rust-lang/rust/issues/48556> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `ahash` (lib) due to 4 previous errors
tkaitchuck commented 6 months ago

@Amanieu It looks like this is caused by https://github.com/tkaitchuck/aHash/pull/183 Should I revert it or is there a better way?

Amanieu commented 6 months ago

These functions are stable, are you using an older version of rustc?

Anton-4 commented 6 months ago

Oh right, I didn't think to check that. I'm on 1.71.1. Would it be possible to set the required minimum version with the rust-version field in the Cargo.toml? That should provide a nice error message in this case.

Amanieu commented 6 months ago

This was stabilized in 1.72.

alamb commented 6 months ago

Proposed fix https://github.com/tkaitchuck/aHash/pull/196

tkaitchuck commented 6 months ago

I am attempting to expand the presubmit checks to cover this https://github.com/tkaitchuck/aHash/pull/197 but so far it is still passing. What combination am I missing?

alamb commented 6 months ago

What combination am I missing?

I left a suggestion: https://github.com/tkaitchuck/aHash/pull/197#issuecomment-1881497240

tkaitchuck commented 6 months ago

@Anton-4 Can you clearify, you saw this when targeting aarch64-apple-darwin ? What args / rust flags were passed?

Jefffrey commented 6 months ago

For datafusion, the issue came from https://github.com/apache/arrow-datafusion/issues/8743

Tagging @ted-jiang who reproduced the issue

An example of the dependency datafusion has:

https://github.com/apache/arrow-datafusion/blob/e7cc04db68a05ce9d002de7d0c1be2644bf69c0c/datafusion/common/Cargo.toml#L41-L43

Anton-4 commented 6 months ago

Can you clearify, you saw this when targeting aarch64-apple-darwin ?

Yes indeed, I'll set up a minimal github repo with a full reproduction.

Anton-4 commented 6 months ago

Files for minimal repro:

// rust-toolchain.toml 
[toolchain]
channel = "1.71.1"

// Cargo.toml 
[package]
name = "temp2"
version = "0.1.0"
edition = "2021"

[dependencies]
ahash="=0.8.7"

// src/main.rs 
fn main() {
    println!("Hello, world!");
}

run with cargo build --target=aarch64-apple-darwin. That produces the error for me on NixOS (x86_64 device) and also on macos 14 (m2 device).

djc commented 6 months ago

FWIW, I'm running into this too (when trying to upgrade ahash in hickory-dns on my M1 with Rust 1.67).

bk2204 commented 5 months ago

I'd greatly appreciate it if we could solve this problem without bumping the MSRV. I try to provide support for older versions of Rust, and Debian stable offers 1.63, which I'd like to continue to target.

matthiasg commented 5 months ago

This still happens on M1 with rust 1.78.0 nightly. Is there something I am missing ?

alexeykhan commented 5 months ago

Same for me here (M1):

For more information about this error, try rustc --explain E0635. error: could not compile ahash (lib) due to 1 previous error warning: build failed, waiting for other jobs to finish...

iesahin commented 5 months ago

I have the same issue in https://github.com/iesahin/xvc/actions/runs/7798376079/job/21266895940#step:9:1

Amanieu commented 5 months ago

To anyone hitting this error on nightly: you need to update your nightly compiler.

undenuicap commented 5 months ago

1.78.0-nightly is latest and not working with it :-(

Amanieu commented 5 months ago

Are you using the latest version of ahash? Try cargo update.

ozgrakkurt commented 5 months ago

still doesn't compile on m1 with stable toolchain with this error