Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm: migrate to V8's native Bazel rules. #19275

Merged
merged 60 commits into from
Feb 9, 2022

Conversation

PiotrSikora
Copy link
Contributor

@PiotrSikora PiotrSikora commented Dec 13, 2021

Fixes #15145.

Signed-off-by: Piotr Sikora piotrsikora@google.com

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #19275 was opened by PiotrSikora.

see: more, trace.

@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Dec 13, 2021
@repokitteh-read-only
Copy link

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).
envoyproxy/dependency-shepherds assignee is @phlax

🐱

Caused by: #19275 was opened by PiotrSikora.

see: more, trace.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@PiotrSikora
Copy link
Contributor Author

WIP as a few things are still failing (and were working fine using the existing gn / genrule_cmd build):

  • Coverage fails either due to relocation R_X86_64_PC32 out of range (when V8 is linked statically with linkstatic=1) or due to an undefined symbol: v8_Default_embedded_blob_code_ (when V8 is linked dynamically with linkstatic=0). The former works for me locally, so it might be an issue with the CI (although, I'm using the same version of LLVM). The latter sounds like an issue with V8's Bazel integration.

  • MSan tests (not covered by the CI) are reporting reading uninitialized values. Note that the existing gn build is using v8_target_cpu=arm64 when building on x86_64, so I'm not sure why the resulting binary works at all, since we're not running it under a simulator. When I change the existing gn build to target host CPU, then MSan tests also fail, so I'm willing to let this one go.

Please note that this migration involves a dozen or so patches to V8's Bazel integration, but I think merging this is acceptable once the individual patches are merged into V8.

cc @victorgomes @thhous-msft

@PiotrSikora
Copy link
Contributor Author

Also, Docker multiarch is failing due to running out of the disk space. @phlax any ideas how to fix that?

@phlax
Copy link
Member

phlax commented Dec 15, 2021

Docker multiarch is failing due to running out of the disk space. @phlax any ideas how to fix that?

We download ~1GB of artefacts before running the docker build. Im guessing we can delete those files once they have been loaded. Not sure if that will be enough, but worth a try. I can raise a PR to do it and you can pick the commit to see if it helps

https://dev.azure.com/cncf/envoy/_build/results?buildId=96709&view=logs&j=2229703b-209a-5c70-43aa-3eacf674f12a&t=5618bc45-8382-5c2b-9d5d-3e45721ec0f0&l=18

@phlax
Copy link
Member

phlax commented Dec 15, 2021

docker PR is here #19294

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@PiotrSikora
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Check envoy-presubmit isn't fully completed, but will still attempt retrying.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #19275 (comment) was created by @PiotrSikora.

see: more, trace.

@phlax
Copy link
Member

phlax commented Dec 16, 2021

@PiotrSikora checking CI further it seems the size of the binaries and dwp files increase significantly with this PR

$ tar zvtf ~/Downloads/thispr/envoy-contrib_binary.tar.gz 
drwxr-xr-x envoybuild/envoygroup 0 2021-12-16 04:47 build_envoy-contrib_release/
-r-xr-xr-x envoybuild/envoygroup 2644450792 2021-12-16 04:47 build_envoy-contrib_release/envoy.dwp
-r-xr-xr-x envoybuild/envoygroup  525520416 2021-12-16 04:47 build_envoy-contrib_release/envoy
-r-xr-xr-x envoybuild/envoygroup       8936 2021-12-16 04:47 build_envoy-contrib_release/su-exec
drwxr-xr-x envoybuild/envoygroup          0 2021-12-16 04:47 build_envoy-contrib_release_stripped/
-rwxr-xr-x envoybuild/envoygroup   65236544 2021-12-16 04:47 build_envoy-contrib_release_stripped/envoy
$ tar zvtf ~/Downloads/envoymain/envoy-contrib_binary.tar.gz 
drwxr-xr-x envoybuild/envoygroup 0 2021-12-16 05:30 build_envoy-contrib_release/
-r-xr-xr-x envoybuild/envoygroup 1552118064 2021-12-16 05:30 build_envoy-contrib_release/envoy.dwp
-r-xr-xr-x envoybuild/envoygroup  463377288 2021-12-16 05:30 build_envoy-contrib_release/envoy
-r-xr-xr-x envoybuild/envoygroup       8936 2021-12-16 05:30 build_envoy-contrib_release/su-exec
drwxr-xr-x envoybuild/envoygroup          0 2021-12-16 05:30 build_envoy-contrib_release_stripped/
-rwxr-xr-x envoybuild/envoygroup   63976896 2021-12-16 05:30 build_envoy-contrib_release_stripped/envoy

the PR i raised should help in terms of CI, but wondering about the size change

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@PiotrSikora
Copy link
Contributor Author

PiotrSikora commented Dec 16, 2021

@phlax yeah, both builds are quite different (including the default options and flags), so I'm trying to figure out what's the issue, but it's getting a bit tricky since the coverage works for me locally using the same rules and RBE toolchain.

Thanks for looking! The size difference gave me an idea... Let's see if the snapshot compression helps.

@lizan lizan self-assigned this Jan 3, 2022
This reverts commit 10a263a.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
…ith-bazel

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@PiotrSikora
Copy link
Contributor Author

removing alpine is still an option, but im not sure it would make that big a difference. We can also try pruning intermediate build images between builds i think

Could you create a draft PR, so that I could cherry-pick either of those changes to see if it helps?

@phlax
Copy link
Member

phlax commented Feb 7, 2022

there is a PR to remove the alpine build queued to land on main here #19837

…ith-bazel

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@phlax
Copy link
Member

phlax commented Feb 7, 2022

@PiotrSikora doesnt seem to have helped - ill fork your Pr and see if i can debug and figure out a way to prune between builds

@phlax
Copy link
Member

phlax commented Feb 7, 2022

added #19845

@phlax
Copy link
Member

phlax commented Feb 7, 2022

from initial debugging it doesnt seem like there is too much worth pruning between builds for a couple of reasons - one is that there is hardly any space in the first place, also the builds are building the same images, just with different envoy artefacts, so there is nothing really prunable there

i have added a commit to remove the images that (i think) come preinstalled in azp, lets see if that works/helps

@phlax
Copy link
Member

phlax commented Feb 7, 2022

i think #19848 should resolve the disk space issue

…ith-bazel

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@PiotrSikora
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #19275 (comment) was created by @PiotrSikora.

see: more, trace.

@PiotrSikora
Copy link
Contributor Author

Finally! #19848 (with temurin-*-jdk purged per @lizan's comment) allows for the succesful Docker multiarch build.

We're good to go once it's merged! Thanks a lot for helping to make a room for this, @phlax @lizan.

…ith-bazel

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Comment on lines +822 to +836
com_googlesource_chromium_zlib = dict(
project_name = "Chromium's zlib",
project_desc = "Chromium’s fork of zlib with compression utils",
project_url = "https://chromium.googlesource.com/chromium/src/third_party/zlib/",
# NOTE: Update together with v8 and com_googlesource_chromium_base_trace_event_common.
# Use version and sha256 from https://storage.googleapis.com/envoyproxy-wee8/v8-<v8_version>-deps.sha256.
version = "fc5cfd78a357d5bb7735a58f383634faaafe706a",
# Static snapshot created using https://storage.googleapis.com/envoyproxy-wee8/wee8-fetch-deps.sh.
sha256 = "695c73750cf6472fc6c926e43952262206f1475157377364142bdbb84a1a5a83",
urls = ["https://storage.googleapis.com/envoyproxy-wee8/chromium-zlib-{version}.tar.gz"],
use_category = ["dataplane_ext"],
extensions = ["envoy.wasm.runtime.v8"],
release_date = "2022-01-12",
cpe = "N/A",
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any concerns with this being the 3rd zlib dependency we bring into Envoy /cc @envoyproxy/dependency-shepherds

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we're not using this as a zlib library, we're linking against whatever //external:zlib points at.

Unfortuantely, V8 uses tiny C++ shim library that's included in their fork (the "zlib compression utils"), which we have to use, but similarly, that's linked against //external:zlib in this build.

Lastly, this is still an improvement over the existing genrule_repository() that we use for V8, which links against Chromium's zlib fork.

@PiotrSikora
Copy link
Contributor Author

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #19275 (comment) was created by @PiotrSikora.

see: more, trace.

@moderation
Copy link
Contributor

/lgtm deps

@repokitteh-read-only repokitteh-read-only bot removed the deps Approval required for changes to Envoy's external dependencies label Feb 9, 2022
@lizan lizan merged commit 3be5738 into envoyproxy:main Feb 9, 2022
joshperry pushed a commit to joshperry/envoy that referenced this pull request Feb 13, 2022
Fixes envoyproxy#15145.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Josh Perry <josh.perry@mx.com>
phlax pushed a commit to phlax/envoy that referenced this pull request Nov 15, 2022
Fixes envoyproxy#15145.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Ryan Northey <ryan@synca.io>
phlax pushed a commit that referenced this pull request Nov 18, 2022
Fixes #15145.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: Ryan Northey <ryan@synca.io>
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.

feature request: better build @com_googlesource_chromium_v8:build
4 participants