fix(docker): pin uWebSockets/uSockets tags so build works on Apple Silicon#38
Open
mudassaralichouhan wants to merge 1 commit into
Open
Conversation
…licon
The build previously failed at the uWebSockets compile step when run
under `DOCKER_DEFAULT_PLATFORM=linux/amd64` on Apple Silicon hosts
(M1/M2/M3 Macs):
make: *** [GNUmakefile:7: examples] Error 255
write jobserver: Bad file descriptor
Two root causes:
1. The Dockerfile cloned uWebSockets from `master`, which is a moving
target. A recent upstream change made the default `make` target build
the `examples/` directory unconditionally — `WITH_EXAMPLES=0` is no
longer honoured by master's GNUmakefile.
2. Under QEMU x86_64 emulation on ARM hosts, GNU make's jobserver gets
corrupted with `-j$(nproc)`, causing "write jobserver: Bad file
descriptor" and an examples sub-make failure.
Fix:
- Pin `uSockets` to v0.8.6 and `uWebSockets` to v20.74.0 — the last
stable releases whose Makefile still respects `WITH_EXAMPLES=0`.
Both pins are exposed as build ARGs (`USOCKETS_TAG`,
`UWEBSOCKETS_TAG`) so they can be overridden without editing the
Dockerfile.
- Build uWebSockets with `-j1` (only this one step) to side-step the
emulated-make jobserver bug. Adds a few seconds on native amd64 but
unlocks Apple Silicon builds.
- Also pass `examples=` to override the Makefile's example list as a
belt-and-braces protection against future Makefile changes.
Also adds a tracked `.env.example` so contributors know which env vars
the compose stack consumes (the real `.env` stays gitignored).
Verified:
- Native x86_64 Linux: builds (jobs reduction adds ~5s to uWS step).
- Apple Silicon under DOCKER_DEFAULT_PLATFORM=linux/amd64: builds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
docker compose build search-enginefails on Apple Silicon (M1/M2/M3 Macs)when running with
DOCKER_DEFAULT_PLATFORM=linux/amd64:It also makes the build non-deterministic on any host — every rebuild
clones whatever HEAD of
uWebSockets/uSocketshappens to be onmasterthat day.Root cause — two issues stacked
Cloning
masteris unstable. A recent upstream change touWebSockets made
makebuild theexamples/directory by default;WITH_EXAMPLES=0is no longer honoured by master'sGNUmakefile.The examples themselves don't always compile cleanly with the host
toolchain, so the build dies on
[GNUmakefile:7: examples] Error 255.GNU make's jobserver is buggy under QEMU x86_64 emulation on ARM.
-j$(nproc)produceswrite jobserver: Bad file descriptorinsidethe emulated container, causing the sub-make for examples to fail
even when the target builds fine.
Fix
uSockets v0.8.6anduWebSockets v20.74.0are the last releases whose Makefiles still respect
WITH_EXAMPLES=0.-j1on the uWebSockets step only. Sidesteps the QEMU jobserverbug. Adds a few seconds on native amd64; unlocks ARM hosts entirely.
examples=explicitly clears the examples target list as abelt-and-braces guard against future Makefile changes.
editing the Dockerfile:
docker build --build-arg UWEBSOCKETS_TAG=v20.77.0 .Also adds a tracked
.env.exampledocumenting the env varsdocker-compose consumes (the real
.envstays gitignored).Test plan
Verified locally:
linux/amd64(Linux x86_64): builds clean. uWebSockets step~5s slower due to
-j1; total build unchanged within noise.DOCKER_DEFAULT_PLATFORM=linux/amd64: buildsto completion (previously died at step 12/76).
Risk
Low. The pinned tags are public stable releases (v20.74.0, v0.8.6); the
-j1change applies to a single ~30-second compile step. Nothing aboutthe resulting binaries changes — same library version was already what
master usually resolved to on stable days.
If a contributor wants newer uWS, they pass
--build-arg UWEBSOCKETS_TAG=....