Skip to content

Conversation

@johnathan79717
Copy link
Contributor

@johnathan79717 johnathan79717 commented Feb 2, 2026

Summary

Adds iOS cross-compilation support for the barretenberg-rs FFI backend:

  • Add ios.toolchain.cmake from leetal/ios-cmake project for iOS cross-compilation
  • Add iOS CMake presets (ios-arm64 for device, ios-sim-arm64 for simulator)
  • Add build_ios function to bootstrap.sh for macOS runners
  • Add iOS static library packaging to build_release_dir
  • Update build.rs to support iOS targets (aarch64-apple-ios, aarch64-apple-ios-sim)
  • Update README with iOS supported targets
  • Update publish-bb-mac.yml workflow to build and release iOS static libraries on tag push

Supported iOS Targets

  • aarch64-apple-ios - iOS device (arm64)
  • aarch64-apple-ios-sim - iOS Simulator on Apple Silicon Macs

How it works

iOS builds cannot be cross-compiled from Linux (requires Xcode/iOS SDK). The publish-bb-mac.yml workflow:

  1. Triggers on v* tag push (including ci-release-pr test tags)
  2. Runs on macos-14 runner with Xcode
  3. Builds bb-external target for both iOS presets
  4. Packages and uploads barretenberg-static-arm64-ios.tar.gz and barretenberg-static-arm64-ios-sim.tar.gz to GitHub release

The main Linux release (ci3.yml) handles Linux and macOS (via zig cross-compile). iOS is handled separately by this workflow.

Notes

iOS builds are configured to:

  • Target iOS 14.0+
  • Disable ARC (Automatic Reference Counting)
  • Use the Ninja generator

Test plan

  • Add ci-release-pr label to trigger test release
  • Verify publish-bb-mac.yml workflow runs on macOS runner
  • Verify iOS presets configure and build successfully
  • Verify barretenberg-static-arm64-ios.tar.gz and barretenberg-static-arm64-ios-sim.tar.gz are uploaded to the test release

@ludamad
Copy link
Collaborator

ludamad commented Feb 2, 2026

we should make a workflow that runs with the mac runners to test this

@johnathan79717
Copy link
Contributor Author

we should make a workflow that runs with the mac runners to test this

I recycled publish-bb-mac.yml for this.

@johnathan79717 johnathan79717 force-pushed the jh/barretenberg-rs-ios-targets branch from d8e5c6e to d45f60d Compare February 3, 2026 10:48
@johnathan79717 johnathan79717 changed the base branch from jh/barretenberg-rs-download to merge-train/barretenberg February 3, 2026 10:48
@johnathan79717 johnathan79717 force-pushed the jh/barretenberg-rs-ios-targets branch 2 times, most recently from dd71360 to f0681b8 Compare February 3, 2026 11:06
johnathan79717 and others added 15 commits February 3, 2026 11:24
- Package barretenberg-static-amd64-darwin.tar.gz and barretenberg-static-arm64-darwin.tar.gz in release
- Update build.rs to support macOS targets (x86_64-apple-darwin, aarch64-apple-darwin)
- Use libc++ instead of libstdc++ on macOS
- Update README with new supported targets
- Add ios.toolchain.cmake from leetal/ios-cmake project
- Add iOS presets (ios-arm64, ios-sim-arm64) to CMakePresets.json
- Add build_ios function to bootstrap.sh for macOS runners
- Add iOS packaging to build_release_dir
- Update build.rs to support iOS targets (aarch64-apple-ios, aarch64-apple-ios-sim)
- Update README with iOS supported targets
- Re-enable tag trigger for v* releases
- Replace macOS bb builds with iOS static library builds
- Build ios-arm64 (device) and ios-sim-arm64 (simulator) presets
- Package and upload barretenberg-static-arm64-ios.tar.gz artifacts
LMDB's ExternalProject_Add doesn't inherit iOS toolchain flags,
causing build failures. Add MOBILE option to exclude LMDB,
world_state, vm2, ipc, and nodejs_module for mobile builds.
- Update iOS deployment target from 14.0 to 16.3 for std::format support
- Fix CMake 4.0 compatibility: replace deprecated PATH with DIRECTORY in ios.toolchain.cmake
- Add MOBILE flag check to exclude lmdb_repo dependencies on iOS builds
- Fix missing field initializers for strict compiler warnings (-Wmissing-field-initializers):
  - AcirProgram witness field in multiple files
  - ShpleminiVerifierOutput consistency_checked field
- Replace variable-length arrays with std::vector for C++ compliance:
  - keccak.cpp: input_buffer
  - polynomial_arithmetic.cpp: numerator_polynomial, roots_and_denominators, temp_src, temp_dest
- Fix iOS-specific includes: use unistd.h with extern getentropy declaration on iOS

These changes enable building the bb-external static library target for iOS arm64 devices
with CMake 4.0 and Xcode 26.2 on macOS.
The -Wdeprecated-literal-operator warning is only available in Clang 18+.
Apple Clang doesn't support it, so add -Wunknown-warning-option first.
Adds a build-bb-ios job that runs when ci-barretenberg or ci-barretenberg-full
labels are present. This cross-compiles bb-external for iOS devices (ios-arm64)
and simulators (ios-sim-arm64) to catch iOS build issues before release.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add download support for amd64-darwin, arm64-darwin, arm64-ios, arm64-ios-sim
- Fix C++ stdlib linking: use c++ for Apple targets, stdc++ for Linux

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@johnathan79717 johnathan79717 force-pushed the jh/barretenberg-rs-ios-targets branch from 02bfa80 to a7c903f Compare February 3, 2026 11:25
johnathan79717 and others added 2 commits February 3, 2026 11:32
The crate version is 0.1.0 which is a development version. The check
should skip download attempts for any 0.x.x version when BARRETENBERG_VERSION
is not explicitly set. Real releases will have BARRETENBERG_VERSION set
to the aztec-packages version (e.g., 4.0.0).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
The ffi feature is enabled by default in Cargo.toml, so the build
function needs BB_LIB_DIR to point to the local cpp library. Without
this, build.rs tries to download from GitHub releases which fails for
development versions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@johnathan79717 johnathan79717 added ci-barretenberg-full Run all barretenberg checks. and removed ci-barretenberg Run all barretenberg/cpp checks. labels Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-barretenberg-full Run all barretenberg checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants