Skip to content

bazel/gcc: Enable prebuilt wee8 - #48632

Merged
phlax merged 1 commit into
envoyproxy:mainfrom
phlax:gcc-wee8
Oct 25, 2026
Merged

phlax merged 1 commit into
envoyproxy:mainfrom
phlax:gcc-wee8

Conversation

@phlax

@phlax phlax commented Oct 23, 2026

Copy link
Copy Markdown
Member

No description provided.

@phlax
phlax force-pushed the gcc-wee8 branch 3 times, most recently from 161b8ee to 20cdc03 Compare October 24, 2026 21:27
@phlax
phlax enabled auto-merge (squash) October 24, 2026 21:54
@phlax
phlax disabled auto-merge October 24, 2026 21:54
@phlax
phlax merged commit 66e8caf into envoyproxy:main Oct 25, 2026
27 checks passed
phlax added a commit to phlax/envoy that referenced this pull request Nov 11, 2026
phlax added a commit to phlax/envoy that referenced this pull request Nov 11, 2026
phlax added a commit to phlax/envoy that referenced this pull request Nov 11, 2026
phlax added a commit to phlax/envoy that referenced this pull request Nov 12, 2026
phlax added a commit that referenced this pull request Nov 12, 2026
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…oyproxy#47108)

**Commit Message:** wasm/v8: Source wee8 from envoy_toolshed prebuilt
via label_flag

**Additional Description:**

This wires Envoy's proxy-wasm V8 engine to consume the **prebuilt `wee8`
static
library** published by `envoy_toolshed`, instead of building V8 from
source
(~30–120 min → seconds), while keeping the change working in **both
WORKSPACE
and bzlmod** modes.

### Mechanism — a `label_flag`, not a hardcoded rewrite

proxy-wasm-cpp-host's `v8_lib` depends on
`//bazel:wee8_no_pointer_compression`,
which wraps `@v8//:wee8` and therefore builds V8 from source. To use the
prebuilt
that dep must be redirected to `@envoy_toolshed//v8:wee8`.

The previous WORKSPACE-only approach hardcoded that redirect inside
proxy-wasm's
`BUILD` — which only works because WORKSPACE has a flat, global repo
namespace.
Under bzlmod's strict per-module repo visibility, a label inside
proxy-wasm
resolves against proxy-wasm's *own* repo mapping, which does not declare
`@envoy_toolshed` (fails with `No repository visible as
'@envoy_toolshed'`).
`override_repo`/overrides are root-module-only, so the redirect can't
live in the
`envoy_toolshed` dep either.

The portable fix: proxy-wasm's v8 engine dep becomes a
`label_flag //bazel:v8_engine` (default `:wee8_no_pointer_compression`,
preserving
upstream from-source behaviour). The **root** module (Envoy) sets the
flag value to
`@envoy_toolshed//v8:wee8`. A root-set `label_flag` *value* resolves in
the root's
repo mapping — where `@envoy_toolshed` is a `bazel_dep` — so the same
seam works in
WORKSPACE and bzlmod. The patch bakes in no Envoy-specific repo, making
it a
candidate to upstream into proxy-wasm-cpp-host.

This is complementary to the existing `//bazel:engine` `string_flag`
(which selects
*which* wasm engine): the new `//bazel:v8_engine` `label_flag` selects
*which V8
source* (prebuilt vs from-source).

`@envoy_toolshed//v8:wee8` is a platform-agnostic alias that selects the
right
prebuilt per platform (linux x86_64/aarch64, libcxx/libstdc++) and
**falls back to
`@v8//:wee8` from-source on unsupported platforms** — so no platform
loses support.

### Changes
- `bazel/proxy_wasm_cpp_host.patch`: add `label_flag(name = "v8_engine",
build_setting_default = ":wee8_no_pointer_compression")`; point `v8_lib`
deps at
`//bazel:v8_engine`. (Regenerated from pristine proxy-wasm; round-trip
verified.)
- `.bazelrc`: `build
--@proxy-wasm-cpp-host//bazel:v8_engine=@envoy_toolshed//v8:wee8`.
- `bazel/repositories_extra.bzl`: `setup_wee8_prebuilt()` to define the
`@wee8_prebuilt_*` repos. Requires `envoy_toolshed >= 0.4.9` (already
pinned on main).

### Status / follow-ups (draft PR — showcasing the milestone)
- ✅ Works end-to-end in the real Envoy tree today (WORKSPACE mode). See
Testing.
- ⬜ Full Envoy-in-bzlmod wiring is staged follow-up gated on the broader
bzlmod
migration: `envoy_toolshed` as a `bazel_dep`, swapping
`setup_wee8_prebuilt()`
  for the `wee8_prebuilt_extension` `use_repo`, and proxy-wasm gaining a
  `MODULE.bazel`. The `label_flag` seam is ready for all of that today.
- ⬜ Optionally upstream the generic `label_flag` to proxy-wasm-cpp-host.

**Risk Level:** Low — default flag value preserves upstream from-source
behaviour;
prebuilt path falls back to source on unsupported platforms; no
BUILD/source edits
outside the patch and dependency wiring.

**Testing:** Full `./ci/do_ci.sh dev` (docker, WORKSPACE, published
`envoy_toolshed`
0.4.9 prebuilt): `envoy-static` and all test binaries link against the
prebuilt
`libwee8.a` with no undefined symbols. **1695/1702 tests pass**; the 7
failures are
unrelated env/flaky integration tests (IPv6-less docker on
DNS/forward-proxy cases,
a mount-permissions shell test, redis fake-upstream segfaults, one flaky
geoip) — no
wasm/v8 targets among them. `cquery` on `@proxy-wasm-cpp-host//:v8_lib`
shows
`@wee8_prebuilt_x86_64//:wee8` + `lib/libwee8.a` and zero `@v8//`
references.

**Docs Changes:** N/A

**Release Notes:** N/A (build/dependency wiring; no user-facing
behaviour change)

**Platform Specific Features:** Prebuilt wee8 available for linux x86_64
(libcxx +
libstdc++) and aarch64 (libcxx); other platforms transparently fall back
to building
V8 from source.

---------

Backport note: the proxy-wasm repository keeps this branch's name
(`proxy_wasm_cpp_host`), and the `label_flag` is added to this branch's
own proxy-wasm patch. The `wee8_engine` alias is public, as envoyproxy#48505 made
it on `main`, since proxy-wasm's flag refers to it from another
repository. gcc builds keep building V8 from source: envoyproxy#48632 does not
apply here, as toolshed picks its libstdc++ prebuilt by its own gcc
toolchain flag, which this branch's gcc config does not set.

Signed-off-by: Dario Cillerai <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
(cherry picked from commit 5a1a379)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…oyproxy#47108)

**Commit Message:** wasm/v8: Source wee8 from envoy_toolshed prebuilt
via label_flag

**Additional Description:**

This wires Envoy's proxy-wasm V8 engine to consume the **prebuilt `wee8`
static
library** published by `envoy_toolshed`, instead of building V8 from
source
(~30–120 min → seconds), while keeping the change working in **both
WORKSPACE
and bzlmod** modes.

### Mechanism — a `label_flag`, not a hardcoded rewrite

proxy-wasm-cpp-host's `v8_lib` depends on
`//bazel:wee8_no_pointer_compression`,
which wraps `@v8//:wee8` and therefore builds V8 from source. To use the
prebuilt
that dep must be redirected to `@envoy_toolshed//v8:wee8`.

The previous WORKSPACE-only approach hardcoded that redirect inside
proxy-wasm's
`BUILD` — which only works because WORKSPACE has a flat, global repo
namespace.
Under bzlmod's strict per-module repo visibility, a label inside
proxy-wasm
resolves against proxy-wasm's *own* repo mapping, which does not declare
`@envoy_toolshed` (fails with `No repository visible as
'@envoy_toolshed'`).
`override_repo`/overrides are root-module-only, so the redirect can't
live in the
`envoy_toolshed` dep either.

The portable fix: proxy-wasm's v8 engine dep becomes a
`label_flag //bazel:v8_engine` (default `:wee8_no_pointer_compression`,
preserving
upstream from-source behaviour). The **root** module (Envoy) sets the
flag value to
`@envoy_toolshed//v8:wee8`. A root-set `label_flag` *value* resolves in
the root's
repo mapping — where `@envoy_toolshed` is a `bazel_dep` — so the same
seam works in
WORKSPACE and bzlmod. The patch bakes in no Envoy-specific repo, making
it a
candidate to upstream into proxy-wasm-cpp-host.

This is complementary to the existing `//bazel:engine` `string_flag`
(which selects
*which* wasm engine): the new `//bazel:v8_engine` `label_flag` selects
*which V8
source* (prebuilt vs from-source).

`@envoy_toolshed//v8:wee8` is a platform-agnostic alias that selects the
right
prebuilt per platform (linux x86_64/aarch64, libcxx/libstdc++) and
**falls back to
`@v8//:wee8` from-source on unsupported platforms** — so no platform
loses support.

### Changes
- `bazel/proxy_wasm_cpp_host.patch`: add `label_flag(name = "v8_engine",
build_setting_default = ":wee8_no_pointer_compression")`; point `v8_lib`
deps at
`//bazel:v8_engine`. (Regenerated from pristine proxy-wasm; round-trip
verified.)
- `.bazelrc`: `build
--@proxy-wasm-cpp-host//bazel:v8_engine=@envoy_toolshed//v8:wee8`.
- `bazel/repositories_extra.bzl`: `setup_wee8_prebuilt()` to define the
`@wee8_prebuilt_*` repos. Requires `envoy_toolshed >= 0.4.9` (already
pinned on main).

### Status / follow-ups (draft PR — showcasing the milestone)
- ✅ Works end-to-end in the real Envoy tree today (WORKSPACE mode). See
Testing.
- ⬜ Full Envoy-in-bzlmod wiring is staged follow-up gated on the broader
bzlmod
migration: `envoy_toolshed` as a `bazel_dep`, swapping
`setup_wee8_prebuilt()`
  for the `wee8_prebuilt_extension` `use_repo`, and proxy-wasm gaining a
  `MODULE.bazel`. The `label_flag` seam is ready for all of that today.
- ⬜ Optionally upstream the generic `label_flag` to proxy-wasm-cpp-host.

**Risk Level:** Low — default flag value preserves upstream from-source
behaviour;
prebuilt path falls back to source on unsupported platforms; no
BUILD/source edits
outside the patch and dependency wiring.

**Testing:** Full `./ci/do_ci.sh dev` (docker, WORKSPACE, published
`envoy_toolshed`
0.4.9 prebuilt): `envoy-static` and all test binaries link against the
prebuilt
`libwee8.a` with no undefined symbols. **1695/1702 tests pass**; the 7
failures are
unrelated env/flaky integration tests (IPv6-less docker on
DNS/forward-proxy cases,
a mount-permissions shell test, redis fake-upstream segfaults, one flaky
geoip) — no
wasm/v8 targets among them. `cquery` on `@proxy-wasm-cpp-host//:v8_lib`
shows
`@wee8_prebuilt_x86_64//:wee8` + `lib/libwee8.a` and zero `@v8//`
references.

**Docs Changes:** N/A

**Release Notes:** N/A (build/dependency wiring; no user-facing
behaviour change)

**Platform Specific Features:** Prebuilt wee8 available for linux x86_64
(libcxx +
libstdc++) and aarch64 (libcxx); other platforms transparently fall back
to building
V8 from source.

---------

Backport note: the proxy-wasm repository keeps this branch's name
(`proxy_wasm_cpp_host`), and the `label_flag` is added to this branch's
own proxy-wasm patch. The `wee8_engine` alias is public, as envoyproxy#48505 made
it on `main`, since proxy-wasm's flag refers to it from another
repository. gcc builds keep building V8 from source: envoyproxy#48632 does not
apply here, as toolshed picks its libstdc++ prebuilt by its own gcc
toolchain flag, which this branch's gcc config does not set.

Signed-off-by: Dario Cillerai <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
(cherry picked from commit 5a1a379)
Signed-off-by: Ryan Northey <[email protected]>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 13, 2026
…oyproxy#47108)

**Commit Message:** wasm/v8: Source wee8 from envoy_toolshed prebuilt
via label_flag

**Additional Description:**

This wires Envoy's proxy-wasm V8 engine to consume the **prebuilt `wee8`
static
library** published by `envoy_toolshed`, instead of building V8 from
source
(~30–120 min → seconds), while keeping the change working in **both
WORKSPACE
and bzlmod** modes.

### Mechanism — a `label_flag`, not a hardcoded rewrite

proxy-wasm-cpp-host's `v8_lib` depends on
`//bazel:wee8_no_pointer_compression`,
which wraps `@v8//:wee8` and therefore builds V8 from source. To use the
prebuilt
that dep must be redirected to `@envoy_toolshed//v8:wee8`.

The previous WORKSPACE-only approach hardcoded that redirect inside
proxy-wasm's
`BUILD` — which only works because WORKSPACE has a flat, global repo
namespace.
Under bzlmod's strict per-module repo visibility, a label inside
proxy-wasm
resolves against proxy-wasm's *own* repo mapping, which does not declare
`@envoy_toolshed` (fails with `No repository visible as
'@envoy_toolshed'`).
`override_repo`/overrides are root-module-only, so the redirect can't
live in the
`envoy_toolshed` dep either.

The portable fix: proxy-wasm's v8 engine dep becomes a
`label_flag //bazel:v8_engine` (default `:wee8_no_pointer_compression`,
preserving
upstream from-source behaviour). The **root** module (Envoy) sets the
flag value to
`@envoy_toolshed//v8:wee8`. A root-set `label_flag` *value* resolves in
the root's
repo mapping — where `@envoy_toolshed` is a `bazel_dep` — so the same
seam works in
WORKSPACE and bzlmod. The patch bakes in no Envoy-specific repo, making
it a
candidate to upstream into proxy-wasm-cpp-host.

This is complementary to the existing `//bazel:engine` `string_flag`
(which selects
*which* wasm engine): the new `//bazel:v8_engine` `label_flag` selects
*which V8
source* (prebuilt vs from-source).

`@envoy_toolshed//v8:wee8` is a platform-agnostic alias that selects the
right
prebuilt per platform (linux x86_64/aarch64, libcxx/libstdc++) and
**falls back to
`@v8//:wee8` from-source on unsupported platforms** — so no platform
loses support.

### Changes
- `bazel/proxy_wasm_cpp_host.patch`: add `label_flag(name = "v8_engine",
build_setting_default = ":wee8_no_pointer_compression")`; point `v8_lib`
deps at
`//bazel:v8_engine`. (Regenerated from pristine proxy-wasm; round-trip
verified.)
- `.bazelrc`: `build
--@proxy-wasm-cpp-host//bazel:v8_engine=@envoy_toolshed//v8:wee8`.
- `bazel/repositories_extra.bzl`: `setup_wee8_prebuilt()` to define the
`@wee8_prebuilt_*` repos. Requires `envoy_toolshed >= 0.4.9` (already
pinned on main).

### Status / follow-ups (draft PR — showcasing the milestone)
- ✅ Works end-to-end in the real Envoy tree today (WORKSPACE mode). See
Testing.
- ⬜ Full Envoy-in-bzlmod wiring is staged follow-up gated on the broader
bzlmod
migration: `envoy_toolshed` as a `bazel_dep`, swapping
`setup_wee8_prebuilt()`
  for the `wee8_prebuilt_extension` `use_repo`, and proxy-wasm gaining a
  `MODULE.bazel`. The `label_flag` seam is ready for all of that today.
- ⬜ Optionally upstream the generic `label_flag` to proxy-wasm-cpp-host.

**Risk Level:** Low — default flag value preserves upstream from-source
behaviour;
prebuilt path falls back to source on unsupported platforms; no
BUILD/source edits
outside the patch and dependency wiring.

**Testing:** Full `./ci/do_ci.sh dev` (docker, WORKSPACE, published
`envoy_toolshed`
0.4.9 prebuilt): `envoy-static` and all test binaries link against the
prebuilt
`libwee8.a` with no undefined symbols. **1695/1702 tests pass**; the 7
failures are
unrelated env/flaky integration tests (IPv6-less docker on
DNS/forward-proxy cases,
a mount-permissions shell test, redis fake-upstream segfaults, one flaky
geoip) — no
wasm/v8 targets among them. `cquery` on `@proxy-wasm-cpp-host//:v8_lib`
shows
`@wee8_prebuilt_x86_64//:wee8` + `lib/libwee8.a` and zero `@v8//`
references.

**Docs Changes:** N/A

**Release Notes:** N/A (build/dependency wiring; no user-facing
behaviour change)

**Platform Specific Features:** Prebuilt wee8 available for linux x86_64
(libcxx +
libstdc++) and aarch64 (libcxx); other platforms transparently fall back
to building
V8 from source.

---------

Backport note: the proxy-wasm repository keeps this branch's name
(`proxy_wasm_cpp_host`), and the `label_flag` is added to this branch's
own proxy-wasm patch. The `wee8_engine` alias is public, as envoyproxy#48505 made
it on `main`, since proxy-wasm's flag refers to it from another
repository. gcc builds keep building V8 from source: envoyproxy#48632 does not
apply here, as toolshed picks its libstdc++ prebuilt by its own gcc
toolchain flag, which this branch's gcc config does not set.

Signed-off-by: Dario Cillerai <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
(cherry picked from commit 5a1a379)
Signed-off-by: Ryan Northey <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants