fix: resolve macOS/Apple Silicon Docker build failures#1131
fix: resolve macOS/Apple Silicon Docker build failures#1131pastudan wants to merge 1 commit intothemactep:masterfrom
Conversation
Two issues prevent building on macOS with Docker Desktop:
1. **Dockerfile** (`groupadd` GID collision): macOS GID 20 ("staff") is
passed into the container via `--userns` and already exists in the
Debian image. `groupadd` exits with code 4, aborting the build.
Fix: append `2>/dev/null || true` so the existing group is reused.
2. **Makefile.docker** (APFS hard-link limitation): Buildroot's
per-package isolation uses `rsync --hard-links` to snapshot the
staging tree. Hard links across a bind-mounted APFS volume (the macOS
host filesystem) are not supported and cause `rsync: failed to
hard-link … Operation not permitted` errors.
Fix: mount the build output directory as a named Docker volume
(`thingino-build-output`) that lives entirely inside the Linux VM,
where hard links work. Also adds a `docker-extract-images` target to
copy the finished `.bin` files back to the host `./images/` directory.
Made-with: Cursor
|
I'm also experiencing the same issue as you. There where also the following issues on my macbook pro m1: I do however have an issue with the Podman Volume, on first run it creates the files as expected, however on the second run the system fails due to permissions being unable to remove the files in the volume. |
Problem
Building on macOS with Docker Desktop fails in two ways:
1.
groupadd: GID '20' already exists(Dockerfile)macOS passes the host GID (20 = "staff") into the container. That GID already exists in the Debian base image, so
groupaddexits with code 4 and the entire build layer fails.Fix: append
2>/dev/null || truetogroupaddso the existing group is silently reused.2.
rsync: failed to hard-link … Operation not permitted(Makefile.docker)Buildroot's per-package isolation uses
rsync --hard-linksto snapshot the staging tree between packages. Hard links across a Docker bind-mount backed by an APFS volume (macOS host) are not supported by the macOS filesystem layer, causing every package build to fail.Fix: mount the build output directory as a named Docker volume (
thingino-build-output) that lives entirely inside the Docker Linux VM, where hard links work normally. The host filesystem is no longer in the rsync path.A
docker-extract-imagestarget is also added to copy the finishedthingino-*.binfiles back to./images/on the host after a successful build.Testing
Tested on macOS 26.3 (Apple Silicon, M4) with Docker Desktop. Both issues are resolved and a full firmware build completes successfully.
Usage (after this fix)
Made with Cursor