BLAKE3-team / BLAKE3

the official Rust and C implementations of the BLAKE3 cryptographic hash function
Apache License 2.0
5.12k stars 351 forks source link

cross compile for aarch64_unknown_linux_gnu fails with `fatal error: arm_neon.h: No such file or directory` #395

Open eitsupi opened 5 months ago

eitsupi commented 5 months ago

I have tried to build a package with this crate as a dependency, but it seems to fail due to the following error.

https://github.com/eitsupi/r-glaredb/actions/runs/9234696974/job/25408692991?pr=17#step:10:1107

 error: failed to run custom build command for `blake3 v1.5.1`

Caused by:
  process didn't exit successfully: `/home/runner/work/r-glaredb/r-glaredb/src/rust/target/release/build/blake3-916b2415e9df773b/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=CARGO_FEATURE_PURE
  cargo:rerun-if-env-changed=CARGO_FEATURE_NO_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_NO_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_PURE
  cargo:rustc-cfg=blake3_neon
  TARGET = Some("aarch64-unknown-linux-gnu")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_aarch64-unknown-linux-gnu
  CC_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_aarch64_unknown_linux_gnu
  CC_aarch64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("gcc")
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-unknown-linux-gnu
  CFLAGS_aarch64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_unknown_linux_gnu
  CFLAGS_aarch64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=c/blake3_neon.c:3:10: fatal error: arm_neon.h: No such file or directory
  cargo:warning=    3 | #include <arm_neon.h>
  cargo:warning=      |          ^~~~~~~~~~~~
  cargo:warning=compilation terminated.

  --- stderr

  error occurred: Command "gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-std=c11" "-o" "/home/runner/work/r-glaredb/r-glaredb/src/rust/target/aarch64-unknown-linux-gnu/release/build/blake3-806824724e43ffed/out/db3b6bfb95261072-blake3_neon.o" "-c" "c/blake3_neon.c" with args gcc did not execute successfully (status code exit status: 1).

warning: build failed, waiting for other jobs to finish...

Perhaps I have a wrong setup, but I could not find a solution. I would appreciate any advice.

autquis commented 1 week ago

I get the same error for aarch64-unknown-none https://github.com/arkworks-rs/poly-commit/actions/runs/11506216740/job/32029649679?pr=130

cross build --workspace --no-default-features --target aarch64-unknown-none
.
.
.
warning: blake3@1.5.4: c/blake3_neon.c:3:10: fatal error: arm_neon.h: No such file or directory
Warning: warning: blake3@1.5.4:     3 | #include <arm_neon.h>
warning: blake3@1.5.4:       |          ^~~~~~~~~~~~
Warning: warning: blake3@1.5.4: compilation terminated.

error: failed to run custom build command for `blake3 v1.5.4`
Error: failed to run custom build command for `blake3 v1.5.4`
Caused by:
  process didn't exit successfully: `/home/runner/work/poly-commit/poly-commit/target/debug/build/blake3-914f3a26f96d3955/build-script-build` (exit status: 1)
  --- stdout
  cargo:rustc-check-cfg=cfg(blake3_sse2_ffi, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_sse2_rust, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_sse41_ffi, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_sse41_rust, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_avx2_ffi, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_avx2_rust, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_avx512_ffi, values(none()))
  cargo:rustc-check-cfg=cfg(blake3_neon, values(none()))
  cargo:rerun-if-env-changed=CARGO_FEATURE_PURE
  cargo:rerun-if-env-changed=CARGO_FEATURE_NO_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_NO_NEON
  cargo:rerun-if-env-changed=CARGO_FEATURE_PURE
  cargo:rustc-cfg=blake3_neon
  OUT_DIR = Some(/home/runner/work/poly-commit/poly-commit/target/aarch64-unknown-none/debug/build/blake3-1b97f7081faef415/out)
  TARGET = Some(aarch64-unknown-none)
  OPT_LEVEL = Some(0)
  HOST = Some(x86_64-unknown-linux-gnu)
  CC_aarch64-unknown-none = None
  CC_aarch64_unknown_none = None
  TARGET_CC = None
  CC = None
  CROSS_COMPILE = None
  RUSTC_LINKER = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  RUSTC_WRAPPER = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some(true)
  CARGO_CFG_TARGET_FEATURE = Some(neon)
  CFLAGS_aarch64-unknown-none = None
  CFLAGS_aarch64_unknown_none = None
  TARGET_CFLAGS = None
  CFLAGS = None
  cargo:warning=c/blake3_neon.c:3:10: fatal error: arm_neon.h: No such file or directory
  cargo:warning=    3 | #include <arm_neon.h>
  cargo:warning=      |          ^~~~~~~~~~~~
  cargo:warning=compilation terminated.

  --- stderr

  error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-Wall" "-Wextra" "-std=c11" "-o" "/home/runner/work/poly-commit/poly-commit/target/aarch64-unknown-none/debug/build/blake3-1b97f7081faef415/out/db3b6bfb95[261](https://github.com/arkworks-rs/poly-commit/actions/runs/11506216740/job/32029649679?pr=130#step:4:263)072-blake3_neon.o" "-c" "c/blake3_neon.c" with args cc did not execute successfully (status code exit status: 1).

warning: build failed, waiting for other jobs to finish...
Error: The process 'cross' failed with exit code 101