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

Bump emscripten to 3.1.30 #282

Merged
merged 51 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d8a1f6c
[bazel] Set CLOSURE_COMPILER to workaround RBE+symlinks issue (#1037)
kjlubick Apr 27, 2022
891b449
3.1.10 (#1046)
sbc100 May 4, 2022
93f21c9
Optimize sandbox performance (#1045)
jfirebaugh May 9, 2022
bba3aa9
include node modules glob with linker files. also some minor formatti…
walkingeyerobot May 19, 2022
b81dd81
Using bazelisk on macOS CI (#1049)
zaucy May 19, 2022
71f5fb0
Explicit outputs for wasm_cc_binary (#1047)
zaucy May 20, 2022
b3ca5a4
3.1.11 (#1053)
sbc100 May 22, 2022
62d817b
3.1.12 (#1054)
sbc100 May 27, 2022
3d86ccb
3.1.13 (#1055)
sbc100 Jun 3, 2022
311acff
[bazel] Add additional files necessary for building with closure and …
kjlubick Jun 7, 2022
517e02f
3.1.14 (#1061)
sbc100 Jun 20, 2022
8281708
3.1.15 (#1066)
sbc100 Jul 1, 2022
b0a51b3
Pin `latest` to a specific version for arm64-linux (#1065)
sbc100 Jul 1, 2022
961e66c
3.1.16 (#1071)
sbc100 Jul 15, 2022
71b737e
3.1.17 (#1076)
aheejin Jul 22, 2022
5ad3ff0
Exclude msys from path fix function. (#1078)
5cript Jul 24, 2022
26a0dea
3.1.18 (#1081)
dschuff Aug 1, 2022
4a48a75
Version 3.1.18-2 (#1083)
dschuff Aug 4, 2022
c220895
3.1.19 (#1090)
dschuff Aug 17, 2022
e456ebd
Add EMSDK_QUIET to make emsdk_env less chatting (#1091)
sbc100 Aug 19, 2022
21611d2
3.1.20 (#1095)
dschuff Aug 24, 2022
b1bb477
Add double-quotes to allow spaces in path (#1097)
joelvaneenwyk Aug 30, 2022
5430866
3.1.21 (#1101)
dschuff Sep 9, 2022
56fda13
Update latest-arm64-linux to 3.1.21 (#1102)
sbc100 Sep 13, 2022
b6574f3
Update XCode version on CircleCI (#1103)
sbc100 Sep 13, 2022
d0291b3
3.1.22 (#1107)
dschuff Sep 17, 2022
b4fd475
3.1.23 (#1111)
dschuff Sep 23, 2022
3d87d5e
Avoid exporting EM_CONFIG for modern SDK versions (#1110)
sbc100 Oct 6, 2022
3535865
Use x64 version for Windows on Arm (#1115)
pbo-linaro Oct 9, 2022
e41b8c6
3.1.24 (#1122)
dschuff Oct 11, 2022
92d9023
3.1.25 (#1130)
dschuff Nov 8, 2022
0050633
[bazel] Switch to platforms-based toolchain resolution (#1036)
jfirebaugh Nov 8, 2022
e8606a7
remove "name" attribute from bazel rules (#1131)
luxe Nov 14, 2022
01d3d78
3.1.26 (#1134)
sbc100 Nov 18, 2022
8a1268a
Update remote_docker version in CircleCI config (#1117)
dschuff Nov 21, 2022
edc4dc5
docker image: Change base to Ubuntu 22.04 LTS (jammy) (#1135)
forderud Nov 21, 2022
87e02fc
3.1.27 (#1139)
dschuff Nov 30, 2022
32fba7b
Use constants for fixed paths. NFC (#1140)
sbc100 Dec 1, 2022
bd7842e
Add standalone_wasm feature to bazel emscripten_toolchain (#1145)
robbertvanginkel Dec 6, 2022
63a63e1
3.1.28 (#1149)
sbc100 Dec 9, 2022
5b80c10
Upgrade to rules_nodejs 5.8.0 (#1150)
jfirebaugh Dec 20, 2022
0b2084f
3.1.29 (#1160)
sbc100 Jan 3, 2023
9b87e80
Pin Windows CI to Bazel 5.4.0 (#1163)
jfirebaugh Jan 4, 2023
58904e9
Remove reference to fastcomp-latest. NFC (#1164)
sbc100 Jan 5, 2023
f3bb209
Remove fastcomp SDK and fastcomp build rules. NFC (#1165)
sbc100 Jan 9, 2023
91f8563
3.1.30 (#1167)
dschuff Jan 12, 2023
5e129c8
Merge tag '3.1.30'
radekdoulik Jan 30, 2023
e309d9f
Bump emscripten to 3.1.30
radekdoulik Jan 30, 2023
29a3cb1
Bump clang version
radekdoulik Jan 30, 2023
356b1b8
Do not include test directory
radekdoulik Jan 30, 2023
09b27bc
Update eng/emsdk.proj
radekdoulik Jan 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
test/test.py
test-mac:
macos:
xcode: "12.2.0"
xcode: "12.5.1"
environment:
EMSDK_NOTTY: "1"
# Without this, any `brew installl` command will result in self-update of
Expand Down Expand Up @@ -140,8 +140,7 @@ jobs:
- run:
name: install docker
command: apt-get update -q && apt-get install -q -y docker.io
- setup_remote_docker:
version: 19.03.13
- setup_remote_docker
# Build and test the tip-of-tree build of EMSDK
- run:
name: build
Expand All @@ -157,8 +156,7 @@ jobs:
- run:
name: install docker
command: apt-get update -q && apt-get install -q -y docker.io
- setup_remote_docker:
version: 19.03.13
- setup_remote_docker
- run:
name: build
command: make -C ./docker version=${CIRCLE_TAG} build
Expand Down Expand Up @@ -193,7 +191,7 @@ jobs:

test-bazel-mac:
macos:
xcode: "12.2.0"
xcode: "12.5.1"
environment:
EMSDK_NOTTY: "1"
HOMEBREW_NO_AUTO_UPDATE: "1"
Expand All @@ -213,6 +211,7 @@ jobs:
environment:
PYTHONUNBUFFERED: "1"
EMSDK_NOTTY: "1"
USE_BAZEL_VERSION: "5.4.0"
steps:
- checkout
- run:
Expand Down
1 change: 1 addition & 0 deletions bazel/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --incompatible_enable_cc_toolchain_resolution
7 changes: 7 additions & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,10 @@ alias(
"//conditions:default": ":empty",
}),
)

platform(
name = "platform_wasm",
constraint_values = [
"@platforms//cpu:wasm32",
],
)
26 changes: 10 additions & 16 deletions bazel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ emsdk_deps()

load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")
emsdk_emscripten_deps(emscripten_version = "2.0.31")

load("@emsdk//:toolchains.bzl", "register_emscripten_toolchains")
register_emscripten_toolchains()
```
The SHA1 hash in the above `strip_prefix` and `url` parameters correspond to the git revision of
[emsdk 2.0.31](https://github.com/emscripten-core/emsdk/releases/tag/2.0.31). To get access to
Expand All @@ -26,8 +29,13 @@ parameter of `emsdk_emscripten_deps()`. Supported versions are listed in `revisi

## Building

### Using wasm_cc_binary (preferred)
First, write a new rule wrapping your `cc_binary`.
Put the following line into your `.bazelrc`:

```
build --incompatible_enable_cc_toolchain_resolution
```

Then write a new rule wrapping your `cc_binary`.

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

See `test_external/` for an example using [embind](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html).

### Using --config=wasm

Put the following lines into your `.bazelrc`:
```
build:wasm --crosstool_top=@emsdk//emscripten_toolchain:everything
build:wasm --cpu=wasm
build:wasm --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
```

Simply pass `--config=wasm` when building a normal `cc_binary`. The result of
this build will be a tar archive containing any files produced by emscripten.
See the [Bazel documentation](https://docs.bazel.build/versions/main/tutorial/cc-toolchain-config.html)
for more details
4 changes: 4 additions & 0 deletions bazel/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ deps()
load(":emscripten_deps.bzl", "emscripten_deps")

emscripten_deps()

load(":toolchains.bzl", "register_emscripten_toolchains")

register_emscripten_toolchains()
7 changes: 2 additions & 5 deletions bazel/bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
build:wasm --crosstool_top=//emscripten_toolchain:everything

build:wasm --cpu=wasm

build:wasm --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
build:wasm --incompatible_enable_cc_toolchain_resolution
build:wasm --platforms=@emsdk//:platform_wasm
30 changes: 22 additions & 8 deletions bazel/deps.bzl
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

def deps():
excludes = native.existing_rules().keys()

if "build_bazel_rules_nodejs" not in excludes:
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "4501158976b9da216295ac65d872b1be51e3eeb805273e68c516d2eb36ae1fbb",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.4.1/rules_nodejs-4.4.1.tar.gz"],
)
maybe(
http_archive,
name = "bazel_skylib",
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
urls = [
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
],
)
maybe(
http_archive,
name = "rules_nodejs",
sha256 = "08337d4fffc78f7fe648a93be12ea2fc4e8eb9795a4e6aa48595b66b34555626",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.0/rules_nodejs-core-5.8.0.tar.gz"],
)
maybe(
http_archive,
name = "build_bazel_rules_nodejs",
sha256 = "dcc55f810142b6cf46a44d0180a5a7fb923c04a5061e2e8d8eb05ccccc60864b",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.0/rules_nodejs-5.8.0.tar.gz"],
)
50 changes: 43 additions & 7 deletions bazel/emscripten_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,77 @@ filegroup(
"emscripten/cache/sysroot/include/c++/v1/**",
"emscripten/cache/sysroot/include/compat/**",
"emscripten/cache/sysroot/include/**",
"lib/clang/15.0.0/include/**",
"lib/clang/16/include/**",
]),
)

filegroup(
name = "compiler_files",
name = "emcc_common",
srcs = [
"emscripten/emcc.py",
"emscripten/emscripten.py",
"emscripten/emscripten-version.txt",
"emscripten/cache/sysroot_install.stamp",
"emscripten/src/settings.js",
"emscripten/src/settings_internal.js",
] + glob(
include = [
"emscripten/third_party/**",
"emscripten/tools/**",
],
exclude = [
"**/__pycache__/**",
],
),
)

filegroup(
name = "compiler_files",
srcs = [
"bin/clang{bin_extension}",
"bin/clang++{bin_extension}",
":emcc_common",
":includes",
],
)

filegroup(
name = "linker_files",
srcs = [
"emscripten/emcc.py",
"bin/clang{bin_extension}",
"bin/llc{bin_extension}",
"bin/llvm-ar{bin_extension}",
"bin/llvm-nm{bin_extension}",
"bin/llvm-objcopy{bin_extension}",
"bin/wasm-emscripten-finalize{bin_extension}",
"bin/wasm-ld{bin_extension}",
"bin/wasm-opt{bin_extension}",
] + glob(["emscripten/node_modules/**"]),
"bin/wasm-metadce{bin_extension}",
":emcc_common",
] + glob(
include = [
"emscripten/cache/sysroot/lib/**",
"emscripten/node_modules/**",
"emscripten/src/**",
],
),
)

filegroup(
name = "ar_files",
srcs = [
"emscripten/emar.py",
"bin/llvm-ar{bin_extension}",
],
"emscripten/emar.py",
"emscripten/emscripten-version.txt",
"emscripten/src/settings.js",
"emscripten/src/settings_internal.js",
] + glob(
include = [
"emscripten/tools/**",
],
exclude = [
"**/__pycache__/**",
],
),
)
"""

Expand Down
16 changes: 9 additions & 7 deletions bazel/emscripten_toolchain/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
load(":crosstool.bzl", "emscripten_cc_toolchain_config_rule")
load(":toolchain.bzl", "emscripten_cc_toolchain_config_rule")

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

# Name depends on rules_nodejs version being used.
# https://github.com/emscripten-core/emsdk/issues/1020
# https://github.com/bazelbuild/rules_nodejs/issues/3375
node_files = "@nodejs_host//:node_files" if existing_rule("@nodejs_host//:node_files") else "@nodejs//:node_files"

filegroup(
name = "common_files",
srcs = [
"emscripten_config",
"env.sh",
"env.bat",
node_files,
"@nodejs//:node_files",
],
)

Expand Down Expand Up @@ -86,6 +81,13 @@ cc_toolchain_suite(
},
)

toolchain(
name = "cc-toolchain-wasm",
target_compatible_with = ["@platforms//cpu:wasm32"],
toolchain = ":cc-compiler-wasm",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)

py_binary(
name = "wasm_binary",
srcs = ["wasm_binary.py"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ def _impl(ctx):
name = "output_format_js",
enabled = True,
),
feature(
name = "wasm_standalone",
),
]

crosstool_default_flag_sets = [
Expand Down Expand Up @@ -911,7 +914,7 @@ def _impl(ctx):
"-iwithsysroot" + "/include/compat",
"-iwithsysroot" + "/include",
"-isystem",
emscripten_dir + "/lib/clang/15.0.0/include",
emscripten_dir + "/lib/clang/16/include",
],
),
# Inputs and outputs
Expand Down Expand Up @@ -1015,6 +1018,11 @@ def _impl(ctx):
flags = ["-Werror"],
features = ["wasm_warnings_as_errors"],
),
flag_set(
actions = all_link_actions,
flags = ["-sSTANDALONE_WASM"],
features = ["wasm_standalone"],
),
]

crosstool_default_env_sets = [
Expand Down Expand Up @@ -1073,7 +1081,7 @@ def _impl(ctx):
emscripten_dir + "/emscripten/cache/sysroot/include/c++/v1",
emscripten_dir + "/emscripten/cache/sysroot/include/compat",
emscripten_dir + "/emscripten/cache/sysroot/include",
emscripten_dir + "/lib/clang/15.0.0/include",
emscripten_dir + "/lib/clang/16/include",
]

artifact_name_patterns = []
Expand Down Expand Up @@ -1105,7 +1113,7 @@ emscripten_cc_toolchain_config_rule = rule(
attrs = {
"cpu": attr.string(mandatory = True, values = ["asmjs", "wasm"]),
"em_config": attr.label(mandatory = True, allow_single_file = True),
"emscripten_binaries": attr.label(mandatory = True),
"emscripten_binaries": attr.label(mandatory = True, cfg = "exec"),
"script_extension": attr.string(mandatory = True, values = ["sh", "bat"]),
},
provides = [CcToolchainConfigInfo],
Expand Down
14 changes: 13 additions & 1 deletion bazel/emscripten_toolchain/wasm_cc_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ def _wasm_transition_impl(settings, attr):
if attr.simd:
features.append("wasm_simd")

if attr.standalone:
features.append("wasm_standalone")

return {
"//command_line_option:compiler": "emscripten",
"//command_line_option:crosstool_top": "@emsdk//emscripten_toolchain:everything",
"//command_line_option:cpu": "wasm",
"//command_line_option:features": features,
"//command_line_option:dynamic_mode": "off",
"//command_line_option:linkopt": linkopts,
"//command_line_option:platforms": [],
"//command_line_option:platforms": ["@emsdk//:platform_wasm"],
"//command_line_option:custom_malloc": "@emsdk//emscripten_toolchain:malloc",
}

Expand Down Expand Up @@ -86,6 +89,9 @@ _WASM_BINARY_COMMON_ATTRS = {
"simd": attr.bool(
default = False,
),
"standalone": attr.bool(
default = False,
),
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
Expand Down Expand Up @@ -163,7 +169,10 @@ def _wasm_cc_binary_legacy_impl(ctx):
)

_wasm_cc_binary = rule(
<<<<<<< HEAD
name = "wasm_cc_binary",
=======
>>>>>>> 3.1.30
implementation = _wasm_cc_binary_impl,
attrs = dict(
_WASM_BINARY_COMMON_ATTRS,
Expand Down Expand Up @@ -193,7 +202,10 @@ def _wasm_binary_legacy_outputs(name, cc_target):
return outputs

_wasm_cc_binary_legacy = rule(
<<<<<<< HEAD
name = "wasm_cc_binary",
=======
>>>>>>> 3.1.30
implementation = _wasm_cc_binary_legacy_impl,
attrs = _WASM_BINARY_COMMON_ATTRS,
outputs = _wasm_binary_legacy_outputs,
Expand Down
Loading