diff --git a/barretenberg/cpp/bootstrap.sh b/barretenberg/cpp/bootstrap.sh index 7a38e0bd4f80..a4c70bba834c 100755 --- a/barretenberg/cpp/bootstrap.sh +++ b/barretenberg/cpp/bootstrap.sh @@ -7,6 +7,7 @@ else export native_preset=${NATIVE_PRESET:-clang20-no-avm} fi export hash=$(hash_str $(../../avm-transpiler/bootstrap.sh hash) $(cache_content_hash .rebuild_patterns)) +export native_build_dir=$(scripts/preset-build-dir) # Injects version number into a given bb binary. # Means we don't actually need to rebuild bb to release a new version if code hasn't changed. diff --git a/barretenberg/cpp/cmake/arch.cmake b/barretenberg/cpp/cmake/arch.cmake index fe6488cbce3f..cf44d66be334 100644 --- a/barretenberg/cpp/cmake/arch.cmake +++ b/barretenberg/cpp/cmake/arch.cmake @@ -9,7 +9,12 @@ endif() # 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) +# +# Skip auto-detection when cross-compiling: Zig cross-compile presets already +# control the target CPU via -target and -mcpu flags. Adding -march here would +# either pick the wrong arch (e.g. skylake on an x86 host targeting ARM) or +# conflict with the preset's -mcpu (e.g. -march=generic overriding -mcpu=apple_a14). +if(NOT WASM AND NOT TARGET_ARCH AND NOT CMAKE_CROSSCOMPILING) if(ARM) set(TARGET_ARCH "generic") else()