From ab4f752d3d3ffa96499fe4edb97bcab4c9ecfb7a Mon Sep 17 00:00:00 2001 From: AztecBot Date: Mon, 16 Mar 2026 21:00:38 +0000 Subject: [PATCH] fix: skip -march auto-detection for cross-compile targets --- barretenberg/cpp/cmake/arch.cmake | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/barretenberg/cpp/cmake/arch.cmake b/barretenberg/cpp/cmake/arch.cmake index fe6488cbce3f..b745f88255da 100644 --- a/barretenberg/cpp/cmake/arch.cmake +++ b/barretenberg/cpp/cmake/arch.cmake @@ -5,11 +5,10 @@ if(WASM) add_compile_options(-fno-exceptions -fno-slp-vectorize) endif() -# Auto-detect TARGET_ARCH if not explicitly set. -# Use 'skylake' on x86_64 (matches our cross-compile presets) and 'generic' on ARM -# to avoid emitting CPU-specific instructions (e.g. SVE on Graviton) that break on -# other ARM machines like Apple Silicon. -if(NOT WASM AND NOT TARGET_ARCH) +# Auto-detect TARGET_ARCH for native builds only. +# Cross-compile presets handle arch via zig -target/-mcpu flags; set TARGET_ARCH +# explicitly in the preset if -march is also needed (e.g. arm64-linux uses "generic"). +if(NOT WASM AND NOT TARGET_ARCH AND NOT CMAKE_CROSSCOMPILING) if(ARM) set(TARGET_ARCH "generic") else()