Skip to content

Build fails on ARM/aarch64 (Raspberry Pi): fasthash-sys enables x86 SIMD flags #38

@tech-enjoyer

Description

@tech-enjoyer

Hello,

I'm trying to build Lidi on ARM (Raspberry Pi 5, aarch64 Linux) and am confused about whether ARM/aarch64 is officially supported or not.

  • If ARM IS intended to work: the build fails because an x86-only dependency path is enabled on aarch64. I'll happily provide full logs if you need them.
  • If ARM is NOT supported: I recommend to clearly document supported architectures, because the current docs read as architecture-agnostic.

I've used AI to parse the logs and provide a possible fix.
This is what it came up with.

Docs I've followed:
https://anssi-fr.github.io/lidi/gstarted.html

Version / source

Environment

  • Hardware: Raspberry Pi 5
  • OS: Raspberry Pi OS / Debian-based, 64-bit (aarch64)
  • uname -m: aarch64
  • rustc host: aarch64-unknown-linux-gnu
  • Compiler: system gcc/cc from build-essential

Steps to reproduce (fresh machine, from zero)

  1. Flash a fresh Raspberry Pi OS 64-bit (aarch64) on a Raspberry Pi 5, boot, open a terminal.

  2. Install system prerequisites:
    sudo apt update
    sudo apt full-upgrade
    sudo apt install -y git build-essential pkg-config ca-certificates curl

  3. Install Rust tooling (as available via apt on this system):
    sudo apt install -y rustup cargo

  4. Initialize rustup + ensure stable toolchain:
    rustup default stable
    rustup update

  5. Sanity-check arch/toolchain:
    uname -m
    rustc -Vv
    cargo -Vv

  6. Clone and checkout v2.1.0:
    cd ~
    git clone https://github.com/ANSSI-FR/lidi.git
    cd lidi
    git fetch --tags
    git checkout v2.1.0
    git describe --tags --always

  7. Build (verbose logging):
    cargo clean
    CARGO_TERM_COLOR=never cargo build --release --locked -vv 2>&1 | tee build.log

Expected behavior

cargo build --release succeeds on aarch64 and produces ARM ELF binaries.

Actual behavior

Build fails while compiling fasthash-sys v0.3.2 because its build script invokes the C/C++ compiler with x86-only flags on aarch64.

From the verbose output (build.log):

  • TARGET = Some("aarch64-unknown-linux-gnu")
  • HOST = Some("aarch64-unknown-linux-gnu")
  • build script features include:
    CARGO_CFG_FEATURE=aes,avx,avx2,default,sse42

Then the build script runs a compile that includes:
cc ... -msse4.2 -maes -mavx -mavx2 ... -c src/fasthash.cpp

And gcc errors on ARM:
cc: error: unrecognized command-line option '-msse4.2'
cc: error: unrecognized command-line option '-maes'
cc: error: unrecognized command-line option '-mavx'
cc: error: unrecognized command-line option '-mavx2'

Cargo ends with:
error: failed to run custom build command for 'fasthash-sys v0.3.2'

What I think is happening

Somewhere in Lidi's dependency configuration, fasthash/fasthash-sys is being built with x86 acceleration features enabled (sse42/aes/avx/avx2) even when target_arch=aarch64. That causes the build script to pass x86-only flags to the compiler, which necessarily fails on ARM.

This does not look like a cross-compile issue because both HOST and TARGET are aarch64 in the log.

Suggested fix (if ARM is supported)

Gate x86-only features so they are enabled only on x86/x86_64, and use a portable configuration on other arches.

Example pattern in Cargo.toml (one possible approach):

[target.'cfg(any(target_arch="x86", target_arch="x86_64"))'.dependencies]
fasthash = { version = "0", default-features = false, features = ["sse42","aes","avx","avx2"] }

[target.'cfg(not(any(target_arch="x86", target_arch="x86_64")))'.dependencies]
fasthash = { version = "0", default-features = false }

(or any equivalent solution that prevents fasthash-sys from selecting x86-only compilation flags on non-x86 targets)

Request

Please confirm whether aarch64/ARM is intended to be supported.
If yes, I'd appreciate guidance on how to build it.

Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions