Android Builds using Mac Mini on M2, Gitlab Runner, and Docker
Description
Hi, we are running our gitlab build pipelines via gitlab runner which runs on in house mac mini, it was recently updated and we have moved from intel core to M2. I've been trying to get it to build for few weeks now and have no luck at all.
This is the error I get building the ./gradlew assembleDebug `AAPT2 aapt2-8.4.0-11315950-linux Daemon #0: Unexpected error output: rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2
Execution failed for AarResourcesCompilerTransform: /builds/apps/myapp/.gradle/caches/transforms-4/276d3b1fe51ce675cfc3ca2f4803435d/transformed/core-1.13.1. > AAPT2 aapt2-8.4.0-11315950-linux Daemon #5: Daemon startup failed This should not happen under normal circumstances, please file an issue if it does. `
I've heavily researched online and have tried the top 10 docker images from hub that did have android installed. I've tried forcing docker to use AMD64 images and not ARM ones but haven't seen that gradle to build successfully. Tried on gradle docker images, tried building via ubuntu:rolling or 24.04, java docker images as well I've tried on a few different versions of java, 21, 22 I've also tried using older versions of docker like 4.22-4.25-4.27
I did half of that before knowing there is a thing called roseta, so after installing it did all the same steps and haven't had any success, one of the posts was suggesting to use colima so I have tried that as well. None of the solutions seem to work and I don't know what else to try.
Reproduce
run gitlab runner and docker setup on M2 mac mini then build android application using gradle
Expected behavior
gradle build should not fail
docker version
Client:
Cloud integration: v1.0.35+desktop.13
Version: 26.1.1
API version: 1.45
Go version: go1.21.9
Git commit: 4cf5afa
Built: Tue Apr 30 11:44:56 2024
OS/Arch: darwin/arm64
Context: desktop-linux
Server: Docker Desktop 4.30.0 (149282)
Engine:
Version: 26.1.1
API version: 1.45 (minimum version 1.24)
Go version: go1.21.9
Git commit: ac2de55
Built: Tue Apr 30 11:48:04 2024
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.6.31
GitCommit: e377cd56a71523140ca6ae87e30244719194a521
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
Client:
Version: 26.1.1
Context: desktop-linux
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.14.0-desktop.1
Path: /Users/buildmac/.docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.27.0-desktop.2
Path: /Users/buildmac/.docker/cli-plugins/docker-compose
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.29
Path: /Users/buildmac/.docker/cli-plugins/docker-debug
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: /Users/buildmac/.docker/cli-plugins/docker-dev
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.23
Path: /Users/buildmac/.docker/cli-plugins/docker-extension
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.4
Path: /Users/buildmac/.docker/cli-plugins/docker-feedback
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.1.0
Path: /Users/buildmac/.docker/cli-plugins/docker-init
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /Users/buildmac/.docker/cli-plugins/docker-sbom
scout: Docker Scout (Docker Inc.)
Version: v1.8.0
Path: /Users/buildmac/.docker/cli-plugins/docker-scout
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 4
Server Version: 26.1.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e377cd56a71523140ca6ae87e30244719194a521
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
cgroupns
Kernel Version: 6.6.26-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
CPUs: 10
Total Memory: 7.657GiB
Name: docker-desktop
ID: 261954a1-5753-4548-a029-730b2b05dbcd
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=unix:///Users/buildmac/Library/Containers/com.docker.docker/Data/docker-cli.sock
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
127.0.0.0/8
Live Restore Enabled: false
Diagnostics ID
0766137F-BC60-427A-AB5C-FB03D98865E0/20240530212305
Additional Info
No response
I've been trying to build a project in Docker arm64 and I get the same issue even though Docker has rosetta support.