diff --git a/barretenberg/README.md b/barretenberg/README.md index d04a2909d32b..fb1f4571c09b 100644 --- a/barretenberg/README.md +++ b/barretenberg/README.md @@ -10,7 +10,7 @@ Barretenberg (or `bb` for short) is an optimized elliptic curve library for the - [Barretenberg](#barretenberg) - [Development](#development) - - [Bootstrap](#bootstrap) + - [Quick Start](#quick-start) - [Build Options and Instructions](#build-options-and-instructions) - [WASM build](#wasm-build) - [Fuzzing build](#fuzzing-build) @@ -19,7 +19,6 @@ Barretenberg (or `bb` for short) is an optimized elliptic curve library for the - [Testing](#testing) - [Integration tests with Aztec in Monorepo](#integration-tests-with-aztec-in-monorepo) - [Integration tests with Aztec in Barretenberg Standalone Repo](#integration-tests-with-aztec-in-barretenberg-standalone-repo) - - [Testing locally in docker](#testing-locally-in-docker) - [Docs Build](#docs-build) - [Benchmarks](#benchmarks) - [x86\_64](#x86_64) @@ -92,15 +91,33 @@ git clone -b release/10.x --depth 1 https://github.com/llvm/llvm-project.git \ -### Bootstrap +### Quick Start -The bootstrap script will build both the native and wasm versions of barretenberg: +If you just want to use the `bb` binary and don't need to modify the source code, the easiest option is to install a pre-built binary using [bbup](bbup/README.md): ```bash -cd cpp -./bootstrap.sh +curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/refs/heads/master/barretenberg/bbup/install | bash +bbup +bb --version ``` +To build from source, use the bootstrap script. By default it uses a [Zig](https://ziglang.org/)-wrapped Clang for portable binaries (glibc 2.35+). This requires `zig` to be installed in addition to the dependencies listed above: + +```bash +cd barretenberg/cpp +./bootstrap.sh # Full build (native + WASM) +./bootstrap.sh build_native # Native only (faster) +``` + +If you don't have Zig installed, you can use the `default` preset which only requires a standard Clang toolchain: + +```bash +cd barretenberg/cpp +NATIVE_PRESET=default ./bootstrap.sh build_native +``` + +The resulting binary will be at `build/bin/bb`. + ### Build Options and Instructions CMake can be passed various build options on its command line: @@ -237,19 +254,6 @@ CI will automatically run integration tests against Aztec. It is located in the When working on a PR, you may want to point this file to a different Aztec branch or commit, but then it should probably be pointed back to master before merging. -##### Testing locally in docker - -A common issue that arises is that our CI system has a different compiler version e.g. namely for GCC. If you need to mimic the CI operating system locally you can use bootstrap_docker.sh or run dockerfiles directly. However, there is a more efficient workflow for iterative development: - -``` -cd barretenberg/cpp -./scripts/docker_interactive.sh -mv build build-native # your native build folders are mounted, but will not work! have to clear them -cmake --preset gcc ; cmake --build build -``` - -This will allow you to rebuild as efficiently as if you were running native code, and not have to see a full compile cycle. - ### Docs Build If doxygen is installed on the system, you can use the **build_docs** target to build documentation, which can be configured in vscode CMake extension or using diff --git a/barretenberg/cpp/scripts/docker_interactive.sh b/barretenberg/cpp/scripts/docker_interactive.sh deleted file mode 100755 index 65349d14b7b9..000000000000 --- a/barretenberg/cpp/scripts/docker_interactive.sh +++ /dev/null @@ -1,16 +0,0 @@ -# Script to enter a docker shell. -# This comes in two flavors, ubuntu and alpine. -# This mounts the current folder into the image, allowing for in-docker development. -# You then need to run cmake commands fresh to build. -# Ideally you can combine with a fresh clone of the repo to keep it persistently around, or move around build dirs as needed. -# This is useful for debugging issues like bb being slow on alpine or running into errors on a specific version of gcc. -# usage: ./docker_interactive.sh ubuntu or ./docker_interactive.sh alpine - -# Enter script directory. -set -eu -cd $(dirname $0) -# allows for 'alpine', 'ubuntu' or 'msan.ubuntu' -ENVIRONMENT_KIND="${1:-alpine}" -DOCKERFILE="../dockerfiles/interactive/Dockerfile.$ENVIRONMENT_KIND" -docker build -t "env-$ENVIRONMENT_KIND" -f "$DOCKERFILE" . -docker run -it --mount type=bind,source=$(pwd)/..,target=/usr/src/barretenberg/cpp "env-$ENVIRONMENT_KIND"