Skip to content

Commit d85b29b

Browse files
committed
Document QEMU emulation issues and multi-platform build considerations
- Add Multi-Platform Builds section to dockerfile-standards.mdc - Document QEMU emulation failure symptoms and solutions - Add testing guidelines for multi-platform builds in adding-new-images.mdc - Add Platform Notes section to ESP-IDF README explaining amd64-only build - Explain Rosetta 2 support for Mac M1/M2 users - Document technical reasons for platform decision
1 parent d509a9f commit d85b29b

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

.cursor/rules/adding-new-images.mdc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,26 @@ Before committing:
6969
- Test all README examples
7070
- Check image size is reasonable
7171

72+
### Multi-Platform Build Testing
73+
74+
When building for `linux/amd64,linux/arm64`:
75+
76+
**Check for QEMU emulation issues:**
77+
1. Monitor build logs for both platforms
78+
2. Look for suspiciously fast completion times (~0.1s) on ARM64
79+
3. Verify that long-running commands (pip install) actually execute
80+
4. Test the published image on both platforms if possible
81+
82+
**Signs of QEMU failure:**
83+
- ARM64 build step completes in 0.1s while AMD64 takes minutes
84+
- No error messages but packages aren't installed
85+
- Shell initialization scripts (source, export.sh) exit silently
86+
87+
**Solutions if ARM64 fails:**
88+
1. Use direct venv paths instead of shell sourcing
89+
2. Use `python -m` for command verification
90+
3. Consider building AMD64 only (works via Rosetta 2 on Mac M1/M2)
91+
7292
### Testing Workflows with GitHub CLI
7393

7494
Use `gh` CLI for remote workflow testing:

.cursor/rules/dockerfile-standards.mdc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,32 @@ alwaysApply: true
3636
- Optimize for automated builds
3737
- Keep images small - don't pre-download large toolchains unless necessary
3838
- Let frameworks download on first build (toolchains cache in volumes)
39+
40+
### Multi-Platform Builds
41+
42+
**QEMU Emulation Issues:**
43+
- ARM64 builds under QEMU emulation can fail silently
44+
- Scripts that source shell files (e.g., `source export.sh`) may exit immediately under QEMU
45+
- Commands complete in ~0.1s indicate QEMU emulation failure
46+
47+
**Solutions:**
48+
1. **Use direct paths for installations:**
49+
- Instead of: `bash -c '. ${IDF_PATH}/export.sh && pip install'`
50+
- Use: `/path/to/venv/bin/pip install`
51+
- This bypasses shell initialization that fails under QEMU
52+
53+
2. **Use `python -m` for verification:**
54+
- Instead of: `/path/to/venv/bin/pytest --version`
55+
- Use: `python3 -m pytest --version`
56+
- More portable and works across platforms
57+
58+
3. **Consider amd64-only builds:**
59+
- If ARM64 emulation issues persist, build `linux/amd64` only
60+
- Docker Desktop on Mac M1/M2 runs amd64 via Rosetta 2 automatically
61+
- ARM64 Linux users can use Docker's built-in emulation
62+
63+
**Platform Configuration:**
64+
```dockerfile
65+
# In GitHub Actions workflow
66+
platforms: linux/amd64 # or linux/amd64,linux/arm64 if both work
67+
```

images/esp-idf/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,25 @@ Available build arguments:
337337
- `QEMU_RELEASE_TAG` - GitHub release tag (default: `esp-develop-9.0.0-20240606`)
338338
- `QEMU_VERSION` - QEMU binary version string (default: `esp_develop_9.0.0_20240606`)
339339

340+
### Platform Notes
341+
342+
This image is built for **linux/amd64** only due to QEMU emulation issues with ARM64 builds during GitHub Actions multi-platform builds.
343+
344+
**For Mac M1/M2 users:**
345+
- Docker Desktop automatically runs AMD64 images via Rosetta 2
346+
- Performance is excellent with transparent emulation
347+
- No action needed - just use the image normally
348+
349+
**For ARM64 Linux users:**
350+
- Docker automatically emulates AMD64 when needed
351+
- Alternatively, build locally on ARM64 hardware (works perfectly)
352+
353+
**Technical reason:**
354+
- ARM64 builds under QEMU emulation in GitHub Actions fail silently when executing shell initialization scripts
355+
- The `source ${IDF_PATH}/export.sh` command exits immediately under QEMU without error
356+
- Direct pip install paths work, but verification and testing require the activated environment
357+
- Building AMD64 only ensures consistent, reliable images for all users
358+
340359
## Version Information
341360

342361
| Component | Version | Notes |

0 commit comments

Comments
 (0)