envoyproxy / envoyproxy/toolshed

emsdk: use Python 3.12 and resolve interpreter without hardcoding (fix x86 build, stop patching bazel/MODULE.bazel)

Open
#4,960 0 comments 1 reaction 2 assignees Claimed by @phlax View on GitHub
Dominant language
Python
Stars
12
Forks
24
Avg merge
6h 37m
Merged PRs (30d)
92

Description

## Problem

`bazel-registry/modules/emsdk/4.0.23.envoy/patches/emsdk_bzlmod.patch` hardcodes a specific hermetic Python (`python_3_13`) and a fragile interpreter path. This currently **fails the build on x86_64** (and would likely fail on arm too — but the observed failure is x86):

1. The emscripten toolchain shell scripts hardcode `external/rules_python~~python~python_3_13_x86_64-unknown-linux-gnu/bin/python3`. This uses the **stale `~~` canonical-repo separator** — current Bazel uses `++`/`+` (e.g. `rules_python++python+python_3_13`), so this path does not resolve.
2. Root `MODULE.bazel` / envoy standardize on **Python 3.12**. The patch forcing `python_3_13` drags in a `python_3_13` toolchain repo that is not visible / does not resolve from `@@emsdk+`:

```
ERROR: no such package '@@[unknown repo 'python_3_13' requested from @@emsdk+ ...]//':
No repository visible as '@python_3_13' from repository '@@emsdk+'
... referenced by '@@emsdk+//emscripten_toolchain:common_files_emscripten_linux'
```

These are arch-independent failures (stale repo syntax + non-resolving `python_3_13` repo), not arm-specific.

### Hardcoded spots in the current patch
- `bazel/MODULE.bazel`: adds `use_repo(python, "python_3_13")` — should not be in the patch at all (see below).
- `bazel/remote_emscripten_repository.bzl`: adds `"@python_3_13//:files"` to toolchain srcs.
- `bazel/emscripten_toolchain/emar.sh`, `emcc.sh`, `emcc_link.sh`: replace `python3` with the hardcoded `external/rules_python~~python~python_3_13_x86_64-.../bin/python3` path.

## Required changes (confined to `bazel-registry/modules/emsdk/`)

1. **Switch to Python 3.12** (match root/envoy default); remove all `python_3_13` references.
2. **No hardcoding:** resolve the interpreter from the resolved rules_python toolchain / runfiles rather than a literal `external/...` path with a baked-in repo-name/separator/arch — so it is robust to Bazel canonical-repo syntax (`~~` vs `++`), python minor version, and architecture. Preserve the original hermetic intent (bazel-provided python, not system `python3`), just make it resolve correctly and tie it to 3.12.
3. **Patch must not touch `bazel/MODULE.bazel`.** Python config (`python.toolchain` / `use_repo`) belongs in the registry `MODULE.bazel` (`bazel-registry/modules/emsdk/4.0.23.envoy/MODULE.bazel`), not injected into upstream `bazel/MODULE.bazel`. Rem

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.