From 8a9b7f5ef272996c78ec15694678833cf85ddce4 Mon Sep 17 00:00:00 2001 From: Alfonso Subiotto Marques Date: Mon, 7 Jun 2021 10:19:37 +0200 Subject: [PATCH] Disable reed-solomon-erasure/simd-accel feature on aarch64 (Apple M1) This feature requires clang to support -march=native on M1. Before this change, cargo build would output a build error when building for aarch64. --- Cargo.toml | 5 +++++ ledger/Cargo.toml | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 675493dea2..29fa7da9e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,5 +78,10 @@ exclude = [ "programs/bpf", ] +# TODO: Remove once the "simd-accel" feature from the reed-solomon-erasure +# dependency is supported on Apple M1. v2 of the feature resolver is needed to +# specify arch-specific features. +resolver = "2" + [profile.dev] split-debuginfo = "unpacked" diff --git a/ledger/Cargo.toml b/ledger/Cargo.toml index 5d07d50b29..270a937c97 100644 --- a/ledger/Cargo.toml +++ b/ledger/Cargo.toml @@ -30,7 +30,6 @@ prost = "0.7.0" rand = "0.7.0" rand_chacha = "0.2.2" rayon = "1.5.0" -reed-solomon-erasure = { version = "4.0.2", features = ["simd-accel"] } serde = "1.0.126" serde_bytes = "0.11.5" sha2 = "0.9.5" @@ -56,6 +55,14 @@ tokio = { version = "1", features = ["full"] } tokio-stream = "0.1" trees = "0.2.1" +# Disable reed-solomon-erasure/simd-accel feature on aarch64 only since it +# requires clang to support -march=native. +[target.'cfg(any(target_arch = "aarch64", target_arch = "aarch64_apple_darwin"))'.dependencies] +reed-solomon-erasure = { version = "4.0.2" } + +[target.'cfg(not(any(target_arch = "aarch64", target_arch = "aarch64_apple_darwin")))'.dependencies] +reed-solomon-erasure = { version = "4.0.2", features = ["simd-accel"] } + [dependencies.rocksdb] # Avoid the vendored bzip2 within rocksdb-sys that can cause linker conflicts # when also using the bzip2 crate