Skip to content

Commit 2906032

Browse files
committed
Upgrade emsdk to just past v3.1.44. Use wasm_cc_binary attributes.
In effect this: - standardizes handling of standalone option - picks up a platforms/OS fix in emsdk - allows RE2 and Abseil to compile and link Signed-off-by: Martijn Stevenson <[email protected]>
1 parent 6fab69c commit 2906032

File tree

3 files changed

+17
-26
lines changed

3 files changed

+17
-26
lines changed

bazel/defs.bzl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def _optimized_wasm_cc_binary_transition_impl(settings, attr):
2121
#
2222
# Define STANDALONE_WASM at compile time as well as link time (below).
2323
# This influences Abseil libraries using conditional dependencies.
24+
# TODO(martijneken): Remove after Abseil stops using this define.
2425
return {
2526
"//command_line_option:copt": ["-O3", "-DSTANDALONE_WASM"],
2627
"//command_line_option:cxxopt": [],
@@ -94,14 +95,7 @@ def proxy_wasm_cc_binary(
9495
linkopts = linkopts + [
9596
"--no-entry",
9697
"--js-library=$(location @proxy_wasm_cpp_sdk//:proxy_wasm_intrinsics_js)",
97-
"-sSTANDALONE_WASM",
9898
"-sEXPORTED_FUNCTIONS=_malloc",
99-
# Disable pthreads, because USE_PTHREADS implies SHARED_MEMORY and
100-
# "STANDALONE_WASM does not support shared memories yet"
101-
#
102-
# https://emscripten.org/docs/porting/pthreads.html
103-
# https://emscripten.org/docs/api_reference/wasm_workers.html
104-
"-sUSE_PTHREADS=0",
10599
],
106100
tags = tags + [
107101
"manual",
@@ -111,6 +105,8 @@ def proxy_wasm_cc_binary(
111105
)
112106

113107
wasm_cc_binary(
108+
standalone = True,
109+
threads = "off",
114110
name = "wasm_" + name,
115111
cc_target = ":proxy_wasm_" + name.rstrip(".wasm"),
116112
tags = tags + [

bazel/emsdk.patch

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
diff --git a/bazel/emscripten_deps.bzl b/bazel/emscripten_deps.bzl
2-
index 95801ba..95fdabd 100644
2+
index 219cd93..c127d49 100644
33
--- a/bazel/emscripten_deps.bzl
44
+++ b/bazel/emscripten_deps.bzl
5-
@@ -69,31 +69,3 @@ def emscripten_deps(emscripten_version = "latest"):
6-
build_file = "@emsdk//emscripten_toolchain:emscripten.BUILD",
5+
@@ -167,38 +167,3 @@ def emscripten_deps(emscripten_version = "latest"):
6+
build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension = ".exe"),
77
type = "zip",
88
)
99
-
@@ -14,6 +14,13 @@ index 95801ba..95fdabd 100644
1414
- package_lock_json = "@emscripten_bin_linux//:emscripten/package-lock.json",
1515
- )
1616
-
17+
- if "emscripten_npm_linux_arm64" not in excludes:
18+
- npm_install(
19+
- name = "emscripten_npm_linux_arm64",
20+
- package_json = "@emscripten_bin_linux_arm64//:emscripten/package.json",
21+
- package_lock_json = "@emscripten_bin_linux_arm64//:emscripten/package-lock.json",
22+
- )
23+
-
1724
- if "emscripten_npm_mac" not in excludes:
1825
- npm_install(
1926
- name = "emscripten_npm_mac",
@@ -34,15 +41,3 @@ index 95801ba..95fdabd 100644
3441
- package_json = "@emscripten_bin_win//:emscripten/package.json",
3542
- package_lock_json = "@emscripten_bin_win//:emscripten/package-lock.json",
3643
- )
37-
diff --git a/bazel/emscripten_toolchain/BUILD.bazel b/bazel/emscripten_toolchain/BUILD.bazel
38-
index eb36959..12dba37 100644
39-
--- a/bazel/emscripten_toolchain/BUILD.bazel
40-
+++ b/bazel/emscripten_toolchain/BUILD.bazel
41-
@@ -13,7 +13,6 @@ filegroup(
42-
"env.sh",
43-
"env.bat",
44-
"@emsdk//:binaries",
45-
- "@emsdk//:node_modules",
46-
"@nodejs//:node_files",
47-
],
48-
)

bazel/repositories.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ def proxy_wasm_cpp_sdk_repositories():
1919
maybe(
2020
http_archive,
2121
name = "emsdk",
22-
sha256 = "1ca0ff918d476c55707bb99bc0452be28ac5fb8f22a9260a8aae8a38d1bc0e27",
23-
# v3.1.7 with Bazel fixes
24-
strip_prefix = "emsdk-0ea8f8a8707070e9a7c83fbb4a3065683bcf1799/bazel",
25-
url = "https://github.com/emscripten-core/emsdk/archive/0ea8f8a8707070e9a7c83fbb4a3065683bcf1799.tar.gz",
22+
sha256 = "52763f556d08ba0c0cde1840102e1e5fcf828b98924c4e77f629ad1d7d400933",
23+
# v3.1.44 with one Bazel platforms fix
24+
strip_prefix = "emsdk-ef2a8e929d5337755e9b1d1e1d4ad859dc694eee/bazel",
25+
url = "https://github.com/emscripten-core/emsdk/archive/ef2a8e929d5337755e9b1d1e1d4ad859dc694eee.tar.gz",
2626
patches = ["@proxy_wasm_cpp_sdk//bazel:emsdk.patch"],
2727
patch_args = ["-p2"],
2828
)

0 commit comments

Comments
 (0)