Skip to content

Support stable Rust builds for 32-bit ARM targets by gating ARMv7 NEON code #4

Description

@Metater

This is a human:
Thank you so much for making this crate! I am using it in my Unity proximity voice chat library. This pairs super well with Opus and RNNoise to create a full voice chat system.

The following is written by AI:

I ran into build failures for 32-bit ARM targets on stable Rust:

  • armv7-unknown-linux-gnueabihf
  • armv7-linux-androideabi

The same project builds successfully for Windows, macOS, iOS, Linux x86_64/aarch64, and Android arm64/x86/x86_64. Only the 32-bit ARM jobs fail.

Environment

  • Crate: aec3 = "0.3.0"
  • Rust: stable
  • Build command examples:
cross build --release --target armv7-unknown-linux-gnueabihf --lib
cargo build --release --target armv7-linux-androideabi --lib

Failure

The build fails with E0658 around 32-bit ARM NEON intrinsics and #[target_feature(enable = "neon")].

Example errors:

error[E0658]: use of unstable library feature `stdarch_arm_neon_intrinsics`
   --> aec3-0.3.0/src/audio_processing/agc2/rnn_vad/vector_math.rs:180:46
    |
180 |         accumulator = vaddq_f32(accumulator, vmulq_f32(x_i, y_i));
    |                                              ^^^^^^^^^
    |
    = note: see issue #111800 <https://github.com/rust-lang/rust/issues/111800> for more information

error[E0658]: the target feature `neon` is currently unstable
   --> aec3-0.3.0/src/audio_processing/aec3/adaptive_fir_filter.rs:345:18
    |
345 | #[target_feature(enable = "neon")]
    |                  ^^^^^^^^^^^^^^^
    |
    = note: see issue #150246 <https://github.com/rust-lang/rust/issues/150246> for more information

Other reported sites include:

src/audio_processing/aec3/adaptive_fir_filter.rs
src/audio_processing/aec3/adaptive_fir_filter_erl.rs
src/audio_processing/aec3/matched_filter.rs
src/audio_processing/aec3/vector_math.rs
src/audio_processing/agc2/rnn_vad/vector_math.rs

Likely cause

It looks like the crate has scalar fallbacks, but the ARMv7 NEON implementations are still compiled for target_arch = "arm". On stable Rust, 32-bit ARM NEON intrinsics and #[target_feature(enable = "neon")] are still gated.

Relevant Rust tracking issues:

Requested support

Would you be open to supporting stable Rust builds for these 32-bit ARM targets?

Possible approaches:

  1. Gate NEON implementations to target_arch = "aarch64" only, since AArch64 NEON is stable/common.
  2. Add a crate feature such as disable-neon / portable-simd-off / scalar-armv7 that forces scalar code on ARMv7.
  3. Use conditional compilation so ARMv7 stable builds compile scalar paths while nightly users can opt into ARMv7 NEON.
  4. Add CI coverage for armv7-unknown-linux-gnueabihf and/or armv7-linux-androideabi.

For my Unity plugin packaging, I temporarily removed Linux ARMv7 and Android armeabi-v7a from CI, but I would like to restore them if aec3 can compile these targets on stable Rust.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions