Add macOS Apple Silicon (M1/M2/M3) Support
Expected Behavior
Hyperledger Cello should build and run correctly on macOS with Apple Silicon (M1/M2/M3) processors using the standard setup instructions.
Current Behavior
The build process fails on Apple Silicon Macs with architecture-related errors. Services fail to start properly due to platform compatibility issues between ARM64 architecture and the default amd64/x86_64 Docker images.
Possible Solution
Implement architecture-specific configurations and build options to properly support ARM64-based systems. This includes modifying Docker configurations to specify platform requirements and creating ARM64-specific Dockerfiles where needed.-
Steps to Reproduce
- Clone the Hyperledger Cello repository on a Mac with Apple Silicon
- Follow standard setup instructions in the documentation
- Run
make dockerto build images - Execute
make startto start the services - Observe platform/architecture-related errors in the logs
Context (Environment)
- OS: macOS Ventura/Sonoma (13.x/14.x)
- Architecture: arm64 (Apple Silicon)
- Docker version: 24.0.6
- Docker compose version: v2.23.0-desktop.1
- Kubernetes version: N/A (using Docker Compose)
Detailed Description and log
When attempting to set up Hyperledger Cello on Apple Silicon Macs, multiple architecture compatibility issues arise:
- Image Build Failures:
failed to solve: process "/bin/sh -c apt-get update && apt-get install -y ..." did not complete successfully: exit code: 1 - Runtime Platform Errors:
standard_init_linux.go:228: exec user process caused: exec format error - Application Crashes:
Illegal instruction: 4These errors occur because the current Docker images are built for amd64/x86_64 architecture and run through Rosetta 2 emulation on Apple Silicon, causing compatibility issues.
Possible Implementation
Our implementation adds ARM64 support through separate configuration files that won't affect existing AMD64 users:
- Architecture-specific Docker Files:
- Create
docker-compose.arm64.ymlwith platform specifications - Add
Dockerfile.arm64variants for services requiring ARM64-specific builds
- Dedicated Build Process:
- Implement
build_arm64.shscript for Apple Silicon users - Add architecture detection to suggest correct commands based on CPU
- Documentation:
- Add a dedicated "Apple Silicon Setup" section to the documentation
- Create clear guides for macOS users without changing instructions for other platforms
This approach ensures:
- No disruption to existing AMD64/x86_64 users
- Clean path for Apple Silicon users
- Easy maintenance as each architecture has isolated configuration files
With the growing adoption of Apple Silicon in the developer community, this addition will remove a significant barrier to entry for macOS users wanting to contribute to Hyperledger Cello.
Thanks for reporting this issue. I’m using an M2 Pro Mac and was able to successfully build and run Cello following the standard instructions. Could you please share the full error log you’re seeing during the build process? @sangwaboi
Thank you for your response @YoungHypo
I believe I've identified the source of our confusion. I was using make docker to build images locally rather than make local which uses pre-built images.
The specific error I encountered was with locally-built images failing with 'exec format error' on my M3 Pro. I resolved this by adding platform specifications (platform: linux/arm64/v8 ) to my docker-compose.yml.
##Could we:
- Document this distinction for Apple Silicon users in the README
- Add ARM64 platform specifications to the Dockerfiles for local builds
- Potentially create an M1/M2/M3-specific build script that automatically configures the correct platform flags
I'd be excited to implement these changes, would you prefer I start with just the documentation improvements, or would a comprehensive PR addressing both documentation and the build system modifications be more valuable to the project?
Both make docker and make local work fine on my macOS. The underlying build process is the same in both cases. @sangwaboi
@YoungHypo Thank you for your feedback. I've documented my specific error :
- Error encountered:
exec format errorwhen running locally built images on M3 Pro - Root cause: Platform mismatch between container (amd64) and host (arm64)
- Solution: adding
platform: linux/arm64/v8to docker-compose.yml resolved the issue
I understand both commands work on your M2 Pro(make docker/local) however, specifying the platform was required to get things working on my M3 Pro, which may indicate subtle architecture differences or compatibility issues across Apple Silicon generations.
please submit pr to resolve it.