-
-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Problem
When using remote execution (--config=remote) from macOS to build Linux Docker images, bazel run //docker/images:push_all fails with:
OSError: [Errno 8] Exec format error: '.../rules_python++python+python_3_11_x86_64-unknown-linux-gnu/bin/python3'
The same issue affects individual oci_push targets (they embed Linux jq binary).
Root Cause
rules_multirun is implemented in Python. When using remote execution:
- Bazel builds targets for the execution platform (Linux x86_64)
- Host-transitioned targets (like
rules_multirun) embed Linux Python in runfiles bazel runexecutes locally on macOS- Linux binaries cannot execute on macOS → "Exec format error"
This is a known limitation of Bazel's platform model when host ≠ execution platform.
Upstream References
- Issue: Consider dropping Python dependency keith/rules_multirun#43 (open since 2023)
- Go Port PR: Go port and windows support keith/rules_multirun#57 (stalled since June 2024)
- Aspect blog on prebuilt binaries: https://blog.aspect.build/releasing-bazel-rulesets-rust
The maintainer is "generally supportive" of switching to Go but PR #57 has been waiting for review. The PR also has a bug where go_sdk extension isn't properly guarded as dev_dependency.
Current Workarounds
- Push from CI only - GitHub Actions runs on Linux where host = execution platform
scripts/push_all_images.sh- Wrapper script that explains the limitation- Build works fine -
make build/bazel build //...works with remote execution
What Still Works
| Action | Works on macOS? | Notes |
|---|---|---|
make build |
✅ | Builds all images via RBE |
bazel build //docker/images:... |
✅ | All images built correctly |
bazel run //docker/images:push_all |
❌ | Python exec format error |
bazel run from Linux CI |
✅ | Host matches execution platform |
Potential Solutions
- Wait for upstream - Monitor PR improve getChecker() method #57 for progress
- Fork and fix PR improve getChecker() method #57 - Fix the dev_dependency bug, maintain our own fork
- Replace rules_multirun - Simple shell script that calls each push target
- Contribute upstream - Help get PR improve getChecker() method #57 merged
Files with Documentation
MODULE.bazel- Comment explaining the issue.bazelrc- Note aboutbazel runlimitation with remote executionscripts/push_all_images.sh- Workaround script for CIMakefile- Updatedpush_alltarget
Labels
bazeltoolchainwontfix(for now)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels