Skip to content

Commit f55ecf5

Browse files
radekdoulikkjlubicksbc100jfirebaughwalkingeyerobot
authored
Bump emscripten to 3.1.30 (#282)
* [bazel] Set CLOSURE_COMPILER to workaround RBE+symlinks issue (#1037) * [bazel] Set CLOSURE_COMPILER to workaround RBE+symlinks issue * space * specify node_js * 3.1.10 (#1046) * Optimize sandbox performance (#1045) * Optimize sandbox performance Link just the files needed to compile, link, or archive, rather than the entire directory tree. This drastically improves build times on macOS, where the sandbox is known to be slow (bazelbuild/bazel#8230). * Linux wants clang to link * all_files not needed? * Linux wants llc * And llvm-ar * Templated build_file_content * include node modules glob with linker files. also some minor formatting fixes. (#1052) * Using bazelisk on macOS CI (#1049) * Explicit outputs for wasm_cc_binary (#1047) * Explicit outputs for wasm_cc_binary * Backwards compatibility * data_runfiles restore * restore test_bazel.sh * Using wrong path on accident * two separate rules for legacy support * Added name attribute to wasm_cc_binary rule * 3.1.11 (#1053) * 3.1.12 (#1054) * 3.1.13 (#1055) * [bazel] Add additional files necessary for building with closure and on RBE (#1057) * 3.1.14 (#1061) * 3.1.15 (#1066) * Pin `latest` to a specific version for arm64-linux (#1065) Fixes: #1040 * 3.1.16 (#1071) * 3.1.17 (#1076) * Exclude msys from path fix function. (#1078) Fixes: #911 * 3.1.18 (#1081) * 3.1.18 * Update LLVM include path in Bazel files * Version 3.1.18-2 (#1083) 3.1.18 had a bad release binary on ARM64 Mac so push an updated version of the release. * 3.1.19 (#1090) * Add EMSDK_QUIET to make emsdk_env less chatting (#1091) Without this the recommended way to silence emsdk_env was to pipe its stderr to /dev/null.. but then you also loose potentially useful error message. Fixes: #946 * 3.1.20 (#1095) * Add double-quotes to allow spaces in path (#1097) * 3.1.21 (#1101) * Update latest-arm64-linux to 3.1.21 (#1102) * Update XCode version on CircleCI (#1103) 12.2 is being deprecated * 3.1.22 (#1107) * 3.1.23 (#1111) * Avoid exporting EM_CONFIG for modern SDK versions (#1110) Newer versions of emscipten, starting all the way back in 1.39.13, can automatically locate the `.emscripten` config file that emsdk creates so there is no need for the explicit EM_CONFIG environment variable. Its redundant and adds unnessary noisce/complexity. Really, adding emcc to the PATH is all the is needed these days. One nice thing about this change is that it allows folks to run whichever emcc they want to and have it just work, even if they have configured emsdk. Without this change, if I activate emsdk and I run `some/other/emcc` then emsdk's `EM_CONFIG` will still be present and override the configuration embedded in `some/other/emcc`. e.g. in the same shell, with emsdk activated, I can run both these commands and have them both just work as expected. ``` $ emcc --version $ /path/to/my/emcc --version ``` * Use x64 version for Windows on Arm (#1115) * 3.1.24 (#1122) * 3.1.25 (#1130) * [bazel] Switch to platforms-based toolchain resolution (#1036) * remove "name" attribute from bazel rules (#1131) * 3.1.26 (#1134) * Update remote_docker version in CircleCI config (#1117) 20.10.17 is the current default. * docker image: Change base to Ubuntu 22.04 LTS (jammy) (#1135) Done to upgrade from CMake 3.16.3 to 3.22.1. CMake 3.21 or newer is needed to build the Qt 6.4.1 sources with emscripten. Also update to libidn12 to resolve an "Unable to locate package libidn11" error. * 3.1.27 (#1139) * Use constants for fixed paths. NFC (#1140) * Add standalone_wasm feature to bazel emscripten_toolchain (#1145) * 3.1.28 (#1149) * Upgrade to rules_nodejs 5.8.0 (#1150) Fixes emscripten-core#1020 * 3.1.29 (#1160) * Pin Windows CI to Bazel 5.4.0 (#1163) * Remove reference to fastcomp-latest. NFC (#1164) fastcomp can only be install using explicit versions names so this name doesn't work. * Remove fastcomp SDK and fastcomp build rules. NFC (#1165) Folks that want to work with fastcomp will now need to use an older checkout of emsdk. * 3.1.30 (#1167) * Bump emscripten to 3.1.30 * Bump clang version * Do not include test directory * Update eng/emsdk.proj Co-authored-by: Alexander Köplinger <[email protected]> --------- Co-authored-by: Kevin Lubick <[email protected]> Co-authored-by: Sam Clegg <[email protected]> Co-authored-by: John Firebaugh <[email protected]> Co-authored-by: walkingeyerobot <[email protected]> Co-authored-by: Ezekiel Warren <[email protected]> Co-authored-by: Heejin Ahn <[email protected]> Co-authored-by: Tim Ebbeke <[email protected]> Co-authored-by: Derek Schuff <[email protected]> Co-authored-by: Joel Van Eenwyk <[email protected]> Co-authored-by: Pierrick Bouvier <[email protected]> Co-authored-by: Trevor Hickey <[email protected]> Co-authored-by: Fredrik Orderud <[email protected]> Co-authored-by: Robbert van Ginkel <[email protected]> Co-authored-by: Alexander Köplinger <[email protected]>
1 parent 3ae16c4 commit f55ecf5

26 files changed

+399
-534
lines changed

.circleci/config.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
test/test.py
5050
test-mac:
5151
macos:
52-
xcode: "12.2.0"
52+
xcode: "12.5.1"
5353
environment:
5454
EMSDK_NOTTY: "1"
5555
# Without this, any `brew installl` command will result in self-update of
@@ -140,8 +140,7 @@ jobs:
140140
- run:
141141
name: install docker
142142
command: apt-get update -q && apt-get install -q -y docker.io
143-
- setup_remote_docker:
144-
version: 19.03.13
143+
- setup_remote_docker
145144
# Build and test the tip-of-tree build of EMSDK
146145
- run:
147146
name: build
@@ -157,8 +156,7 @@ jobs:
157156
- run:
158157
name: install docker
159158
command: apt-get update -q && apt-get install -q -y docker.io
160-
- setup_remote_docker:
161-
version: 19.03.13
159+
- setup_remote_docker
162160
- run:
163161
name: build
164162
command: make -C ./docker version=${CIRCLE_TAG} build
@@ -193,7 +191,7 @@ jobs:
193191

194192
test-bazel-mac:
195193
macos:
196-
xcode: "12.2.0"
194+
xcode: "12.5.1"
197195
environment:
198196
EMSDK_NOTTY: "1"
199197
HOMEBREW_NO_AUTO_UPDATE: "1"
@@ -213,6 +211,7 @@ jobs:
213211
environment:
214212
PYTHONUNBUFFERED: "1"
215213
EMSDK_NOTTY: "1"
214+
USE_BAZEL_VERSION: "5.4.0"
216215
steps:
217216
- checkout
218217
- run:

bazel/.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build --incompatible_enable_cc_toolchain_resolution

bazel/BUILD

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,10 @@ alias(
6666
"//conditions:default": ":empty",
6767
}),
6868
)
69+
70+
platform(
71+
name = "platform_wasm",
72+
constraint_values = [
73+
"@platforms//cpu:wasm32",
74+
],
75+
)

bazel/README.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ emsdk_deps()
1717
1818
load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")
1919
emsdk_emscripten_deps(emscripten_version = "2.0.31")
20+
21+
load("@emsdk//:toolchains.bzl", "register_emscripten_toolchains")
22+
register_emscripten_toolchains()
2023
```
2124
The SHA1 hash in the above `strip_prefix` and `url` parameters correspond to the git revision of
2225
[emsdk 2.0.31](https://github.com/emscripten-core/emsdk/releases/tag/2.0.31). To get access to
@@ -26,8 +29,13 @@ parameter of `emsdk_emscripten_deps()`. Supported versions are listed in `revisi
2629

2730
## Building
2831

29-
### Using wasm_cc_binary (preferred)
30-
First, write a new rule wrapping your `cc_binary`.
32+
Put the following line into your `.bazelrc`:
33+
34+
```
35+
build --incompatible_enable_cc_toolchain_resolution
36+
```
37+
38+
Then write a new rule wrapping your `cc_binary`.
3139

3240
```
3341
load("@rules_cc//cc:defs.bzl", "cc_binary")
@@ -54,17 +62,3 @@ and all of its dependencies, and does not require amending `.bazelrc`. This
5462
is the preferred way, since it also unpacks the resulting tarball.
5563

5664
See `test_external/` for an example using [embind](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html).
57-
58-
### Using --config=wasm
59-
60-
Put the following lines into your `.bazelrc`:
61-
```
62-
build:wasm --crosstool_top=@emsdk//emscripten_toolchain:everything
63-
build:wasm --cpu=wasm
64-
build:wasm --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
65-
```
66-
67-
Simply pass `--config=wasm` when building a normal `cc_binary`. The result of
68-
this build will be a tar archive containing any files produced by emscripten.
69-
See the [Bazel documentation](https://docs.bazel.build/versions/main/tutorial/cc-toolchain-config.html)
70-
for more details

bazel/WORKSPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ deps()
77
load(":emscripten_deps.bzl", "emscripten_deps")
88

99
emscripten_deps()
10+
11+
load(":toolchains.bzl", "register_emscripten_toolchains")
12+
13+
register_emscripten_toolchains()

bazel/bazelrc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
build:wasm --crosstool_top=//emscripten_toolchain:everything
2-
3-
build:wasm --cpu=wasm
4-
5-
build:wasm --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
1+
build:wasm --incompatible_enable_cc_toolchain_resolution
2+
build:wasm --platforms=@emsdk//:platform_wasm

bazel/deps.bzl

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
23

34
def deps():
4-
excludes = native.existing_rules().keys()
5-
6-
if "build_bazel_rules_nodejs" not in excludes:
7-
http_archive(
8-
name = "build_bazel_rules_nodejs",
9-
sha256 = "4501158976b9da216295ac65d872b1be51e3eeb805273e68c516d2eb36ae1fbb",
10-
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.4.1/rules_nodejs-4.4.1.tar.gz"],
11-
)
5+
maybe(
6+
http_archive,
7+
name = "bazel_skylib",
8+
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
9+
urls = [
10+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
11+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
12+
],
13+
)
14+
maybe(
15+
http_archive,
16+
name = "rules_nodejs",
17+
sha256 = "08337d4fffc78f7fe648a93be12ea2fc4e8eb9795a4e6aa48595b66b34555626",
18+
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.0/rules_nodejs-core-5.8.0.tar.gz"],
19+
)
20+
maybe(
21+
http_archive,
22+
name = "build_bazel_rules_nodejs",
23+
sha256 = "dcc55f810142b6cf46a44d0180a5a7fb923c04a5061e2e8d8eb05ccccc60864b",
24+
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.0/rules_nodejs-5.8.0.tar.gz"],
25+
)

bazel/emscripten_deps.bzl

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,77 @@ filegroup(
1414
"emscripten/cache/sysroot/include/c++/v1/**",
1515
"emscripten/cache/sysroot/include/compat/**",
1616
"emscripten/cache/sysroot/include/**",
17-
"lib/clang/15.0.0/include/**",
17+
"lib/clang/16/include/**",
1818
]),
1919
)
2020
2121
filegroup(
22-
name = "compiler_files",
22+
name = "emcc_common",
2323
srcs = [
2424
"emscripten/emcc.py",
25+
"emscripten/emscripten.py",
26+
"emscripten/emscripten-version.txt",
27+
"emscripten/cache/sysroot_install.stamp",
28+
"emscripten/src/settings.js",
29+
"emscripten/src/settings_internal.js",
30+
] + glob(
31+
include = [
32+
"emscripten/third_party/**",
33+
"emscripten/tools/**",
34+
],
35+
exclude = [
36+
"**/__pycache__/**",
37+
],
38+
),
39+
)
40+
41+
filegroup(
42+
name = "compiler_files",
43+
srcs = [
2544
"bin/clang{bin_extension}",
2645
"bin/clang++{bin_extension}",
46+
":emcc_common",
2747
":includes",
2848
],
2949
)
3050
3151
filegroup(
3252
name = "linker_files",
3353
srcs = [
34-
"emscripten/emcc.py",
3554
"bin/clang{bin_extension}",
36-
"bin/llc{bin_extension}",
3755
"bin/llvm-ar{bin_extension}",
3856
"bin/llvm-nm{bin_extension}",
3957
"bin/llvm-objcopy{bin_extension}",
4058
"bin/wasm-emscripten-finalize{bin_extension}",
4159
"bin/wasm-ld{bin_extension}",
4260
"bin/wasm-opt{bin_extension}",
43-
] + glob(["emscripten/node_modules/**"]),
61+
"bin/wasm-metadce{bin_extension}",
62+
":emcc_common",
63+
] + glob(
64+
include = [
65+
"emscripten/cache/sysroot/lib/**",
66+
"emscripten/node_modules/**",
67+
"emscripten/src/**",
68+
],
69+
),
4470
)
4571
4672
filegroup(
4773
name = "ar_files",
4874
srcs = [
49-
"emscripten/emar.py",
5075
"bin/llvm-ar{bin_extension}",
51-
],
76+
"emscripten/emar.py",
77+
"emscripten/emscripten-version.txt",
78+
"emscripten/src/settings.js",
79+
"emscripten/src/settings_internal.js",
80+
] + glob(
81+
include = [
82+
"emscripten/tools/**",
83+
],
84+
exclude = [
85+
"**/__pycache__/**",
86+
],
87+
),
5288
)
5389
"""
5490

bazel/emscripten_toolchain/BUILD.bazel

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
load(":crosstool.bzl", "emscripten_cc_toolchain_config_rule")
1+
load(":toolchain.bzl", "emscripten_cc_toolchain_config_rule")
22

33
package(default_visibility = ["//visibility:public"])
44

5-
# Name depends on rules_nodejs version being used.
6-
# https://github.com/emscripten-core/emsdk/issues/1020
7-
# https://github.com/bazelbuild/rules_nodejs/issues/3375
8-
node_files = "@nodejs_host//:node_files" if existing_rule("@nodejs_host//:node_files") else "@nodejs//:node_files"
9-
105
filegroup(
116
name = "common_files",
127
srcs = [
138
"emscripten_config",
149
"env.sh",
1510
"env.bat",
16-
node_files,
11+
"@nodejs//:node_files",
1712
],
1813
)
1914

@@ -86,6 +81,13 @@ cc_toolchain_suite(
8681
},
8782
)
8883

84+
toolchain(
85+
name = "cc-toolchain-wasm",
86+
target_compatible_with = ["@platforms//cpu:wasm32"],
87+
toolchain = ":cc-compiler-wasm",
88+
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
89+
)
90+
8991
py_binary(
9092
name = "wasm_binary",
9193
srcs = ["wasm_binary.py"],

bazel/emscripten_toolchain/crosstool.bzl renamed to bazel/emscripten_toolchain/toolchain.bzl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@ def _impl(ctx):
441441
name = "output_format_js",
442442
enabled = True,
443443
),
444+
feature(
445+
name = "wasm_standalone",
446+
),
444447
]
445448

446449
crosstool_default_flag_sets = [
@@ -911,7 +914,7 @@ def _impl(ctx):
911914
"-iwithsysroot" + "/include/compat",
912915
"-iwithsysroot" + "/include",
913916
"-isystem",
914-
emscripten_dir + "/lib/clang/15.0.0/include",
917+
emscripten_dir + "/lib/clang/16/include",
915918
],
916919
),
917920
# Inputs and outputs
@@ -1015,6 +1018,11 @@ def _impl(ctx):
10151018
flags = ["-Werror"],
10161019
features = ["wasm_warnings_as_errors"],
10171020
),
1021+
flag_set(
1022+
actions = all_link_actions,
1023+
flags = ["-sSTANDALONE_WASM"],
1024+
features = ["wasm_standalone"],
1025+
),
10181026
]
10191027

10201028
crosstool_default_env_sets = [
@@ -1073,7 +1081,7 @@ def _impl(ctx):
10731081
emscripten_dir + "/emscripten/cache/sysroot/include/c++/v1",
10741082
emscripten_dir + "/emscripten/cache/sysroot/include/compat",
10751083
emscripten_dir + "/emscripten/cache/sysroot/include",
1076-
emscripten_dir + "/lib/clang/15.0.0/include",
1084+
emscripten_dir + "/lib/clang/16/include",
10771085
]
10781086

10791087
artifact_name_patterns = []
@@ -1105,7 +1113,7 @@ emscripten_cc_toolchain_config_rule = rule(
11051113
attrs = {
11061114
"cpu": attr.string(mandatory = True, values = ["asmjs", "wasm"]),
11071115
"em_config": attr.label(mandatory = True, allow_single_file = True),
1108-
"emscripten_binaries": attr.label(mandatory = True),
1116+
"emscripten_binaries": attr.label(mandatory = True, cfg = "exec"),
11091117
"script_extension": attr.string(mandatory = True, values = ["sh", "bat"]),
11101118
},
11111119
provides = [CcToolchainConfigInfo],

bazel/emscripten_toolchain/wasm_cc_binary.bzl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@ def _wasm_transition_impl(settings, attr):
2525
if attr.simd:
2626
features.append("wasm_simd")
2727

28+
if attr.standalone:
29+
features.append("wasm_standalone")
30+
2831
return {
2932
"//command_line_option:compiler": "emscripten",
3033
"//command_line_option:crosstool_top": "@emsdk//emscripten_toolchain:everything",
3134
"//command_line_option:cpu": "wasm",
3235
"//command_line_option:features": features,
3336
"//command_line_option:dynamic_mode": "off",
3437
"//command_line_option:linkopt": linkopts,
35-
"//command_line_option:platforms": [],
38+
"//command_line_option:platforms": ["@emsdk//:platform_wasm"],
3639
"//command_line_option:custom_malloc": "@emsdk//emscripten_toolchain:malloc",
3740
}
3841

@@ -86,6 +89,9 @@ _WASM_BINARY_COMMON_ATTRS = {
8689
"simd": attr.bool(
8790
default = False,
8891
),
92+
"standalone": attr.bool(
93+
default = False,
94+
),
8995
"_allowlist_function_transition": attr.label(
9096
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
9197
),
@@ -163,7 +169,10 @@ def _wasm_cc_binary_legacy_impl(ctx):
163169
)
164170

165171
_wasm_cc_binary = rule(
172+
<<<<<<< HEAD
166173
name = "wasm_cc_binary",
174+
=======
175+
>>>>>>> 3.1.30
167176
implementation = _wasm_cc_binary_impl,
168177
attrs = dict(
169178
_WASM_BINARY_COMMON_ATTRS,
@@ -193,7 +202,10 @@ def _wasm_binary_legacy_outputs(name, cc_target):
193202
return outputs
194203

195204
_wasm_cc_binary_legacy = rule(
205+
<<<<<<< HEAD
196206
name = "wasm_cc_binary",
207+
=======
208+
>>>>>>> 3.1.30
197209
implementation = _wasm_cc_binary_legacy_impl,
198210
attrs = _WASM_BINARY_COMMON_ATTRS,
199211
outputs = _wasm_binary_legacy_outputs,

0 commit comments

Comments
 (0)