Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion barretenberg/cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
},
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"TARGET_ARCH": "skylake",
"ENABLE_PIC": "ON"
}
},
Expand Down
1 change: 0 additions & 1 deletion barretenberg/cpp/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ 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.
Expand Down
14 changes: 13 additions & 1 deletion barretenberg/cpp/cmake/arch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ if(WASM)
add_compile_options(-fno-exceptions -fno-slp-vectorize)
endif()

if(NOT WASM AND NOT ARM AND TARGET_ARCH)
# 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)
if(ARM)
set(TARGET_ARCH "generic")
else()
set(TARGET_ARCH "skylake")
endif()
endif()

if(NOT WASM AND TARGET_ARCH)
message(STATUS "Target architecture: ${TARGET_ARCH}")
add_compile_options(-march=${TARGET_ARCH})
endif()
2 changes: 2 additions & 0 deletions barretenberg/cpp/scripts/zig-c++.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
# Wrapper for zig c++ that pins glibc 2.35 on Linux (Ubuntu 22.04+ compat)
# and uses native target on macOS.
# Note: arch.cmake handles -march selection (skylake on x86, generic on ARM)
# which overrides zig's native CPU detection, preventing CPU-specific instructions.
if [[ "$(uname -s)" == "Linux" ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels hacky. There must be a more targeted solution for your fix

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no generic native target that is more conservative?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it. I'm ok with this. but can we add -mcpu=apple_m1 and just more concisely say this is to make sure arm64 builds work on the lowest common denominator apple_m1 arm64 subset?

exec zig c++ -target native-linux-gnu.2.35 "$@"
else
Expand Down
2 changes: 2 additions & 0 deletions barretenberg/cpp/scripts/zig-cc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
# Wrapper for zig cc that pins glibc 2.35 on Linux (Ubuntu 22.04+ compat)
# and uses native target on macOS.
# Note: arch.cmake handles -march selection (skylake on x86, generic on ARM)
# which overrides zig's native CPU detection, preventing CPU-specific instructions.
if [[ "$(uname -s)" == "Linux" ]]; then
exec zig cc -target native-linux-gnu.2.35 "$@"
else
Expand Down
16 changes: 12 additions & 4 deletions barretenberg/sol/scripts/init_honk.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
#!/usr/bin/env bash
set -eu
# the verification key is the same for ultra and ultra zk
SRS_PATH="$HOME/.bb-crs"
OUTPUT_PATH="./src/honk"
KEYGEN="../cpp/build/bin/honk_solidity_key_gen"

if [ ! -x "$KEYGEN" ]; then
echo "Error: honk_solidity_key_gen binary not found at $KEYGEN" >&2
echo "Run barretenberg/cpp bootstrap first." >&2
exit 1
fi

mkdir -p './src/honk/keys'

../cpp/build/bin/honk_solidity_key_gen add2 $OUTPUT_PATH $SRS_PATH
../cpp/build/bin/honk_solidity_key_gen blake $OUTPUT_PATH $SRS_PATH
../cpp/build/bin/honk_solidity_key_gen ecdsa $OUTPUT_PATH $SRS_PATH
../cpp/build/bin/honk_solidity_key_gen recursive $OUTPUT_PATH $SRS_PATH
$KEYGEN add2 $OUTPUT_PATH $SRS_PATH
$KEYGEN blake $OUTPUT_PATH $SRS_PATH
$KEYGEN ecdsa $OUTPUT_PATH $SRS_PATH
$KEYGEN recursive $OUTPUT_PATH $SRS_PATH

echo ""
echo "✓ VK generation complete"
Expand Down
7 changes: 6 additions & 1 deletion noir/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ function build_native {
set -euo pipefail

if ! cache_download noir-$hash.tar.gz; then
(cd noir-repo && cargo build --locked --release --target-dir target)
# Serialize cargo operations to avoid race conditions with avm-transpiler
# which may run in parallel and share the same CARGO_HOME.
(
flock -x 200
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be nicer if if it was of the form 'flock cmd' but would need some care to set up. looks ok

cd noir-repo && cargo build --locked --release --target-dir target
) 200>/tmp/rustup.lock
cache_upload noir-$hash.tar.gz noir-repo/target/release/{nargo,acvm,noir-profiler}
fi
}
Expand Down
Loading