Skip to content

chore: Support for building aztec-packages on mac.#20581

Merged
charlielye merged 18 commits intomerge-train/cifrom
cl/mac_build
Mar 5, 2026
Merged

chore: Support for building aztec-packages on mac.#20581
charlielye merged 18 commits intomerge-train/cifrom
cl/mac_build

Conversation

@charlielye
Copy link
Contributor

@charlielye charlielye commented Feb 17, 2026

Tweaks and builds upon gregos #19379.
You can install dependencies prior to bootstrapping with.

./bootstrap.sh install_deps

You can then:

./bootstrap.sh gentle

To trigger a makefile build with 1 job at a time, and cmake will target nproc parallelism -2, and a MEMSUSPEND at 1g.

Tested on fresh macos 15/26 install + brew.

Didn't build on macos 14. Looks hairy, not important.

@AztecBot AztecBot added this pull request to the merge queue Feb 26, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 26, 2026
@benesjan
Copy link
Contributor

benesjan commented Feb 28, 2026

I am trying to get this to work and I've stumbled upon some issues.

First one is that when I didn't have docker installed this was the output:

jan@Jans-MacBook-Air-2 aztec-packages % ./bootstrap.sh gentle 
Starting local redis container...
jan@Jans-MacBook-Air-2 aztec-packages %

It didn't error out and instead it just silently didn't do nothing. After starting the docker the build progressed.

Second issue is that install_deps command didn't install solhint:

jan@Jans-MacBook-Air-2 aztec-packages % ./bootstrap.sh install_deps
Installing brew dependencies... done.
Installing wasi-sdk... done.
Installing foundry... done.
Installing rustup... done.
Installing zig... done.
Installing node... done.
Installing node utils... done.
jan@Jans-MacBook-Air-2 aztec-packages % ./bootstrap.sh gentle      
solhint not found.
ERROR: Toolchain incompatibility.
You can install requirements with: ./bootstrap.sh install_deps
jan@Jans-MacBook-Air-2 aztec-packages % 

After installing it with npm install -g solhint build progressed.

The install_deps also didn't install cargo:

...
[avm-transpiler-native] Command exited with status 127. Dumping output:
[avm-transpiler-native] bash: line 1: cargo: command not found
[avm-transpiler-native] . failed (0s) (http://localhost:4273/ad82f1e7188ec257)
...

Once again after installing it manually the build progressed.

Then I tried building merge-train/fairies with this so I created a copy of this branch and rebased it on it and it failed with:

Command: ./bootstrap.sh build_native_objects
Working Dir: /Users/jan/Coding/aztec-packages1/barretenberg/cpp
Date: Sat Feb 28 00:41:58 +07 2026
Status: 1
Took: 17s

-- The CXX compiler identification is Clang 19.1.7
-- The C compiler identification is Clang 19.1.7
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /Users/jan/.zvm/bin/zig
-- Check for working CXX compiler: /Users/jan/.zvm/bin/zig - broken
CMake Error at /opt/homebrew/share/cmake/Modules/CMakeTestCXXCompiler.cmake:73 (message):
  The C++ compiler

    "/Users/jan/.zvm/bin/zig"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/Users/jan/Coding/aztec-packages1/barretenberg/cpp/build/CMakeFiles/CMakeScratch/TryCompile-CQEFzO'
    
    Run Build Command(s): /opt/homebrew/bin/ninja -v cmTC_20381
    [1/2] /Users/jan/.zvm/bin/zig  c++ -target native-linux-gnu.2.35   -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -MD -MT CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o -c /Users/jan/Coding/aztec-packages1/barretenberg/cpp/build/CMakeFiles/CMakeScratch/TryCompile-CQEFzO/testCXXCompiler.cxx
    FAILED: [code=1] CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o 
    /Users/jan/.zvm/bin/zig  c++ -target native-linux-gnu.2.35   -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -MD -MT CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o -c /Users/jan/Coding/aztec-packages1/barretenberg/cpp/build/CMakeFiles/CMakeScratch/TryCompile-CQEFzO/testCXXCompiler.cxx
    zig: error: unsupported option '-arch' for target 'aarch64-unknown-linux4.19.0-gnu2.35.0'
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:6 (project)


-- Configuring incomplete, errors occurred!

AI figured this out and then it progressed.

My internet connection is not great now and I work only with Aztec.nr and yarn-project which should hopefully make this viable for my workflow even on my MacBook Air M1. This is why I am trying to get this to work.

@charlielye
Copy link
Contributor Author

charlielye commented Mar 2, 2026

First one is that when I didn't have docker installed this was the output:

jan@Jans-MacBook-Air-2 aztec-packages % ./bootstrap.sh gentle 
Starting local redis container...
jan@Jans-MacBook-Air-2 aztec-packages %

I assume you did have docker, but that you hadn't started docker?

  elif command -v docker &> /dev/null && [ "$CI" -eq 0 ]; then
    echo_stderr "Starting local redis container..."

I've extended this check to check docker is actually running rather than just the docker cmd existing.

It didn't error out and instead it just silently didn't do nothing. After starting the docker the build progressed.

I've tweaked so failure to start should warn, and continue with logs disabled.

Second issue is that install_deps command didn't install solhint:
After installing it with npm install -g solhint build progressed.

I think it did. You need to restart your shell after running install_deps.
I've put a message in to make this more clear when non-interactive, and start a fresh shell when interactive.

The install_deps also didn't install cargo:
Once again after installing it manually the build progressed.

Might be same thing (no new shell). If you already had rustup installed (did you?), it's basically a noop. But IIUC i thought running cargo would trigger downloads on demand. Hard to diagnose at this point.
I've made it do the rustup and version install regardless of what already exists.

Then I tried building merge-train/fairies with this so I created a copy of this branch and rebased it on it and it failed with:

Command: ./bootstrap.sh build_native_objects
Working Dir: /Users/jan/Coding/aztec-packages1/barretenberg/cpp
Date: Sat Feb 28 00:41:58 +07 2026
Status: 1
Took: 17s

-- The CXX compiler identification is Clang 19.1.7
-- The C compiler identification is Clang 19.1.7
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /Users/jan/.zvm/bin/zig
-- Check for working CXX compiler: /Users/jan/.zvm/bin/zig - broken
CMake Error at /opt/homebrew/share/cmake/Modules/CMakeTestCXXCompiler.cmake:73 (message):
  The C++ compiler

    "/Users/jan/.zvm/bin/zig"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/Users/jan/Coding/aztec-packages1/barretenberg/cpp/build/CMakeFiles/CMakeScratch/TryCompile-CQEFzO'
    
    Run Build Command(s): /opt/homebrew/bin/ninja -v cmTC_20381
    [1/2] /Users/jan/.zvm/bin/zig  c++ -target native-linux-gnu.2.35   -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -MD -MT CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o -c /Users/jan/Coding/aztec-packages1/barretenberg/cpp/build/CMakeFiles/CMakeScratch/TryCompile-CQEFzO/testCXXCompiler.cxx
    FAILED: [code=1] CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o 
    /Users/jan/.zvm/bin/zig  c++ -target native-linux-gnu.2.35   -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -MD -MT CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_20381.dir/testCXXCompiler.cxx.o -c /Users/jan/Coding/aztec-packages1/barretenberg/cpp/build/CMakeFiles/CMakeScratch/TryCompile-CQEFzO/testCXXCompiler.cxx
    zig: error: unsupported option '-arch' for target 'aarch64-unknown-linux4.19.0-gnu2.35.0'
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:6 (project)


-- Configuring incomplete, errors occurred!

AI figured this out and then it progressed.

Ok, it looks like @johnathan79717 changed it 3 days ago here: #20897 and somethings regressed.
All your AI seems to have done is hack in a macos exception to fallback onto brews llvm - which defeats the point of what that PR was trying to achieve.
@johnathan79717 can you take a look at this?

@johnathan79717
Copy link
Contributor

I have a fix in this branch jh/fix-zig-macos but I'm still running bootstrap_on_mac_vm to test it.

@benesjan
Copy link
Contributor

benesjan commented Mar 2, 2026

I assume you did have docker, but that you hadn't started docker?

Correct 👍

I think it did. You need to restart your shell after running install_deps.
I've put a message in to make this more clear when non-interactive, and start a fresh shell when interactive.

👍

Might be same thing (no new shell). If you already had rustup installed (did you?), it's basically a noop.

Sorry I don't exactly remember. I just remember that I already had rustc installed but cargo was for whatever reason not available and I think rustup was some archaic version so I reinstalled rustup and installed cargo manually.

charlielye and others added 9 commits March 5, 2026 15:19
Tweaks and builds upon gregos #19379.
You can install dependencies prior to bootstrapping with.
```
./bootstrap.sh install_deps
```
You can then:
```
./bootstrap.sh gentle
```
To trigger a makefile build with 1 job at a time, and cmake will target nproc parallelism -2, and a MEMSUSPEND at 1g.

Tested on fresh macos 15/26 install + brew.

Didn't build on macos 14. Looks hairy, not important.
On Linux, zig-cc.sh/zig-c++.sh pin glibc 2.35 (Ubuntu 22.04+).
On macOS, they use zig with native target (no glibc pinning).
@charlielye charlielye changed the base branch from next to merge-train/ci March 5, 2026 15:23
@charlielye charlielye merged commit 17aad2d into merge-train/ci Mar 5, 2026
19 of 20 checks passed
@charlielye charlielye deleted the cl/mac_build branch March 5, 2026 16:34
@AztecBot AztecBot mentioned this pull request Mar 5, 2026
github-merge-queue bot pushed a commit that referenced this pull request Mar 5, 2026
BEGIN_COMMIT_OVERRIDE
chore: Support for building aztec-packages on mac. (#20581)
END_COMMIT_OVERRIDE
@benesjan
Copy link
Contributor

benesjan commented Mar 6, 2026

Is bootstrap.sh gentle still the expected way to run this?

Just gave this a try today and this is the terminal output:

jan@Jans-MacBook-Air-2 aztec-packages1 % ./bootstrap.sh gentle          
Building local ci dashboard...
jan@Jans-MacBook-Air-2 aztec-packages1 %

It doesn't seem to do nothing.

It's on an updated MacBook Air M1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants