diff --git a/barretenberg/cpp/bootstrap.sh b/barretenberg/cpp/bootstrap.sh index 7a38e0bd4f80..3c533971fed9 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 $native_preset) # 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..ed185b1fa970 100644 --- a/barretenberg/cpp/cmake/arch.cmake +++ b/barretenberg/cpp/cmake/arch.cmake @@ -5,11 +5,13 @@ if(WASM) add_compile_options(-fno-exceptions -fno-slp-vectorize) endif() -# Auto-detect TARGET_ARCH if not explicitly set. +# Auto-detect TARGET_ARCH if not explicitly set (native builds only). # 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 — the toolchain (e.g. Zig -mcpu) handles +# architecture targeting, and injecting -march here conflicts with it. +if(NOT WASM AND NOT TARGET_ARCH AND NOT CMAKE_CROSSCOMPILING) if(ARM) set(TARGET_ARCH "generic") else()