From d8a1f6c637a9f5dfb215563bda1a7877cfcbe919 Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Wed, 27 Apr 2022 13:13:53 -0400 Subject: [PATCH 01/50] [bazel] Set CLOSURE_COMPILER to workaround RBE+symlinks issue (#1037) * [bazel] Set CLOSURE_COMPILER to workaround RBE+symlinks issue * space * specify node_js --- bazel/emscripten_toolchain/emscripten_config | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bazel/emscripten_toolchain/emscripten_config b/bazel/emscripten_toolchain/emscripten_config index 86a864b1ee..85a98e34b0 100644 --- a/bazel/emscripten_toolchain/emscripten_config +++ b/bazel/emscripten_toolchain/emscripten_config @@ -3,8 +3,8 @@ import platform ROOT_DIR = os.environ["ROOT_DIR"] EMSCRIPTEN_ROOT = os.environ["EMSCRIPTEN"] -BINARYEN_ROOT = ROOT_DIR + "/" + os.environ["EM_BIN_PATH"] -LLVM_ROOT = BINARYEN_ROOT + "/bin" +BINARYEN_ROOT = os.path.join(ROOT_DIR, os.environ["EM_BIN_PATH"]) +LLVM_ROOT = os.path.join(BINARYEN_ROOT, "bin") FROZEN_CACHE = True system = platform.system() @@ -12,3 +12,12 @@ system = platform.system() machine = "arm64" if platform.machine() == "arm64" else "amd64" nodejs_binary = "bin/nodejs/node.exe" if(system =="Windows") else "bin/node" NODE_JS = ROOT_DIR + "/external/nodejs_{}_{}/{}".format(system.lower(), machine, nodejs_binary) + + +# This works around an issue with Bazel RBE where the symlinks in node_modules/.bin +# are uploaded as the linked files, which means the cli.js cannot load its +# dependencies from the expected locations. +# See https://github.com/emscripten-core/emscripten/pull/16640 for more +if system != "Windows": + CLOSURE_COMPILER = [NODE_JS, os.path.join(EMSCRIPTEN_ROOT, "node_modules", + "google-closure-compiler", "cli.js")] From 891b4491419c42f9d2b9f97c47d1043b26dfd3e5 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 4 May 2022 08:06:46 -0700 Subject: [PATCH 02/50] 3.1.10 (#1046) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 1a4efda442..694fa34cd7 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.10": struct( + hash = "8bd05c7221b4ce34d4bedec40b672d94e681a765", + sha_linux = "f5a937383b5c9fa15071a31d679a2ddd5c03bc8952cbbd5bfbf7c0a86c2dae5a", + sha_mac = "e73491f2787cbda75e718c3947916b57259164eddd9b2db16b9c876d3deb16a9", + sha_mac_arm64 = "d7485ce3b13f183484af5163d7bec79ece9a1fdc5845f8152e36270e6f90cfd9", + sha_win = "dd75061405bc902ecd983bd3e4cfd6931a866e1c9de602c4458280cbeb271720", + ), "3.1.9": struct( hash = "edabe25af34554d19c046078f853999b074259ca", sha_linux = "89fa75c981e47ad19942b8236d2604b2666dfd516a08626aaa1bfb0d657c87bf", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index b9dc4122cc..60fcef5129 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.9", + "latest": "3.1.10", "latest-sdk": "latest", "latest-64bit": "latest", "sdk-latest-64bit": "latest", @@ -9,6 +9,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.10": "8bd05c7221b4ce34d4bedec40b672d94e681a765", + "3.1.10-asserts": "d9b20effb2d660936fb5be525744e941fd900bc6", "3.1.9": "edabe25af34554d19c046078f853999b074259ca", "3.1.9-asserts": "c751721b1dfa47c03ede0f0da89be453c79b34ef", "3.1.8": "8c9e0a76ebed2c5e88a718d43e8b62452def3771", From 93f21c9ef30bab52de24f9d4ea3f2f377cf6326a Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 9 May 2022 11:30:43 -0700 Subject: [PATCH 03/50] 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 (https://github.com/bazelbuild/bazel/issues/8230). * Linux wants clang to link * all_files not needed? * Linux wants llc * And llvm-ar * Templated build_file_content --- bazel/BUILD | 31 ++++++++---- bazel/emscripten_deps.bzl | 55 +++++++++++++++++++-- bazel/emscripten_toolchain/BUILD.bazel | 44 ++++++++--------- bazel/emscripten_toolchain/emscripten.BUILD | 6 --- 4 files changed, 93 insertions(+), 43 deletions(-) delete mode 100644 bazel/emscripten_toolchain/emscripten.BUILD diff --git a/bazel/BUILD b/bazel/BUILD index dfec803d24..87fe18133b 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -35,23 +35,34 @@ config_setting( filegroup(name = "empty") alias( - name = "binaries", + name = "compiler_files", actual = select({ - ":linux": "@emscripten_bin_linux//:all", - ":macos": "@emscripten_bin_mac//:all", - ":macos_arm64": "@emscripten_bin_mac_arm64//:all", - ":windows": "@emscripten_bin_win//:all", + ":linux": "@emscripten_bin_linux//:compiler_files", + ":macos": "@emscripten_bin_mac//:compiler_files", + ":macos_arm64": "@emscripten_bin_mac_arm64//:compiler_files", + ":windows": "@emscripten_bin_win//:compiler_files", "//conditions:default": ":empty", }), ) alias( - name = "node_modules", + name = "linker_files", actual = select({ - ":linux": "@emscripten_npm_linux//:node_modules", - ":macos": "@emscripten_npm_mac//:node_modules", - ":macos_arm64": "@emscripten_npm_mac//:node_modules", - ":windows": "@emscripten_npm_win//:node_modules", + ":linux": "@emscripten_bin_linux//:linker_files", + ":macos": "@emscripten_bin_mac//:linker_files", + ":macos_arm64": "@emscripten_bin_mac_arm64//:linker_files", + ":windows": "@emscripten_bin_win//:linker_files", + "//conditions:default": ":empty", + }), +) + +alias( + name = "ar_files", + actual = select({ + ":linux": "@emscripten_bin_linux//:ar_files", + ":macos": "@emscripten_bin_mac//:ar_files", + ":macos_arm64": "@emscripten_bin_mac_arm64//:ar_files", + ":windows": "@emscripten_bin_win//:ar_files", "//conditions:default": ":empty", }), ) diff --git a/bazel/emscripten_deps.bzl b/bazel/emscripten_deps.bzl index 95801ba758..7e8bc6888a 100644 --- a/bazel/emscripten_deps.bzl +++ b/bazel/emscripten_deps.bzl @@ -5,6 +5,53 @@ load(":revisions.bzl", "EMSCRIPTEN_TAGS") def _parse_version(v): return [int(u) for u in v.split(".")] +BUILD_FILE_CONTENT_TEMPLATE = """ +package(default_visibility = ['//visibility:public']) + +filegroup( + name = "includes", + srcs = glob([ + "emscripten/cache/sysroot/include/c++/v1/**", + "emscripten/cache/sysroot/include/compat/**", + "emscripten/cache/sysroot/include/**", + "lib/clang/15.0.0/include/**", + ]), +) + +filegroup( + name = "compiler_files", + srcs = [ + "emscripten/emcc.py", + "bin/clang{bin_extension}", + "bin/clang++{bin_extension}", + ":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}", + ], +) + +filegroup( + name = "ar_files", + srcs = [ + "emscripten/emar.py", + "bin/llvm-ar{bin_extension}", + ], +) +""" + def emscripten_deps(emscripten_version = "latest"): version = emscripten_version @@ -36,7 +83,7 @@ def emscripten_deps(emscripten_version = "latest"): strip_prefix = "install", url = emscripten_url.format("linux", revision.hash, "", "tbz2"), sha256 = revision.sha_linux, - build_file = "@emsdk//emscripten_toolchain:emscripten.BUILD", + build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension=""), type = "tar.bz2", ) @@ -46,7 +93,7 @@ def emscripten_deps(emscripten_version = "latest"): strip_prefix = "install", url = emscripten_url.format("mac", revision.hash, "", "tbz2"), sha256 = revision.sha_mac, - build_file = "@emsdk//emscripten_toolchain:emscripten.BUILD", + build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension=""), type = "tar.bz2", ) @@ -56,7 +103,7 @@ def emscripten_deps(emscripten_version = "latest"): strip_prefix = "install", url = emscripten_url.format("mac", revision.hash, "-arm64", "tbz2"), sha256 = revision.sha_mac_arm64, - build_file = "@emsdk//emscripten_toolchain:emscripten.BUILD", + build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension=""), type = "tar.bz2", ) @@ -66,7 +113,7 @@ def emscripten_deps(emscripten_version = "latest"): strip_prefix = "install", url = emscripten_url.format("win", revision.hash, "", "zip"), sha256 = revision.sha_win, - build_file = "@emsdk//emscripten_toolchain:emscripten.BUILD", + build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension=".exe"), type = "zip", ) diff --git a/bazel/emscripten_toolchain/BUILD.bazel b/bazel/emscripten_toolchain/BUILD.bazel index 4c85acfce2..d101c67061 100644 --- a/bazel/emscripten_toolchain/BUILD.bazel +++ b/bazel/emscripten_toolchain/BUILD.bazel @@ -8,45 +8,43 @@ package(default_visibility = ["//visibility:public"]) node_files = "@nodejs_host//:node_files" if existing_rule("@nodejs_host//:node_files") else "@nodejs//:node_files" filegroup( - name = "common-script-includes", + name = "common_files", srcs = [ - "emar.sh", - "emar.bat", - "emcc.sh", - "emcc.bat", "emscripten_config", "env.sh", "env.bat", - "@emsdk//:binaries", - "@emsdk//:node_modules", node_files, ], ) filegroup( - name = "compile-emscripten", - srcs = [":common-script-includes"], + name = "compiler_files", + srcs = [ + "emcc.sh", + "emcc.bat", + "@emsdk//:compiler_files", + ":common_files", + ], ) filegroup( - name = "link-emscripten", + name = "linker_files", srcs = [ "emcc_link.sh", "emcc_link.bat", "link_wrapper.py", - ":common-script-includes", - "@emsdk//:binaries", - node_files, + "@emsdk//:linker_files", + ":common_files", ], ) filegroup( - name = "every-file", + name = "ar_files", srcs = [ - ":compile-emscripten", - ":link-emscripten", - "@emsdk//:binaries", - node_files, + "emar.sh", + "emar.bat", + "@emsdk//:ar_files", + ":common_files", ], ) @@ -59,7 +57,7 @@ emscripten_cc_toolchain_config_rule( name = "wasm", cpu = "wasm", em_config = "emscripten_config", - emscripten_binaries = "@emsdk//:binaries", + emscripten_binaries = "@emsdk//:compiler_files", script_extension = select({ "@bazel_tools//src/conditions:host_windows": "bat", "//conditions:default": "sh", @@ -68,12 +66,12 @@ emscripten_cc_toolchain_config_rule( cc_toolchain( name = "cc-compiler-wasm", - all_files = ":every-file", - ar_files = ":common-script-includes", + all_files = ":empty", + ar_files = ":ar_files", as_files = ":empty", - compiler_files = ":compile-emscripten", + compiler_files = ":compiler_files", dwp_files = ":empty", - linker_files = ":link-emscripten", + linker_files = ":linker_files", objcopy_files = ":empty", strip_files = ":empty", toolchain_config = "wasm", diff --git a/bazel/emscripten_toolchain/emscripten.BUILD b/bazel/emscripten_toolchain/emscripten.BUILD deleted file mode 100644 index 6f11852874..0000000000 --- a/bazel/emscripten_toolchain/emscripten.BUILD +++ /dev/null @@ -1,6 +0,0 @@ -package(default_visibility = ['//visibility:public']) - -filegroup( - name = "all", - srcs = glob(["**"]), -) From bba3aa9c8fbe0a02cbbe38bff1d82825e6623502 Mon Sep 17 00:00:00 2001 From: walkingeyerobot Date: Thu, 19 May 2022 17:31:12 -0400 Subject: [PATCH 04/50] include node modules glob with linker files. also some minor formatting fixes. (#1052) --- bazel/emscripten_deps.bzl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bazel/emscripten_deps.bzl b/bazel/emscripten_deps.bzl index 7e8bc6888a..01baa01351 100644 --- a/bazel/emscripten_deps.bzl +++ b/bazel/emscripten_deps.bzl @@ -1,5 +1,5 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@build_bazel_rules_nodejs//:index.bzl", "npm_install", "node_repositories") +load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "npm_install") load(":revisions.bzl", "EMSCRIPTEN_TAGS") def _parse_version(v): @@ -40,7 +40,7 @@ filegroup( "bin/wasm-emscripten-finalize{bin_extension}", "bin/wasm-ld{bin_extension}", "bin/wasm-opt{bin_extension}", - ], + ] + glob(["emscripten/node_modules/**"]), ) filegroup( @@ -83,7 +83,7 @@ def emscripten_deps(emscripten_version = "latest"): strip_prefix = "install", url = emscripten_url.format("linux", revision.hash, "", "tbz2"), sha256 = revision.sha_linux, - build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension=""), + build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension = ""), type = "tar.bz2", ) @@ -93,7 +93,7 @@ def emscripten_deps(emscripten_version = "latest"): strip_prefix = "install", url = emscripten_url.format("mac", revision.hash, "", "tbz2"), sha256 = revision.sha_mac, - build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension=""), + build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension = ""), type = "tar.bz2", ) @@ -103,7 +103,7 @@ def emscripten_deps(emscripten_version = "latest"): strip_prefix = "install", url = emscripten_url.format("mac", revision.hash, "-arm64", "tbz2"), sha256 = revision.sha_mac_arm64, - build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension=""), + build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension = ""), type = "tar.bz2", ) @@ -113,7 +113,7 @@ def emscripten_deps(emscripten_version = "latest"): strip_prefix = "install", url = emscripten_url.format("win", revision.hash, "", "zip"), sha256 = revision.sha_win, - build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension=".exe"), + build_file_content = BUILD_FILE_CONTENT_TEMPLATE.format(bin_extension = ".exe"), type = "zip", ) From b81dd8177d2c3556d728db77f0f1b05353ceca98 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Thu, 19 May 2022 14:52:43 -0700 Subject: [PATCH 05/50] Using bazelisk on macOS CI (#1049) --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e21abe9f61..71292f78d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -201,9 +201,9 @@ jobs: - checkout - run: brew install grep - run: - name: install bazel + name: install bazelisk command: | - brew install bazel + brew install bazelisk - run: test/test_bazel_mac.sh test-bazel-windows: From 71f5fb024770a84030ccf9c10146cb6768bf416a Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Thu, 19 May 2022 22:09:46 -0700 Subject: [PATCH 06/50] 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 --- bazel/emscripten_toolchain/wasm_binary.py | 54 +++---- bazel/emscripten_toolchain/wasm_cc_binary.bzl | 140 +++++++++++++----- bazel/test_external/BUILD | 4 + 3 files changed, 129 insertions(+), 69 deletions(-) diff --git a/bazel/emscripten_toolchain/wasm_binary.py b/bazel/emscripten_toolchain/wasm_binary.py index 8c67c7cc8f..d7d6142376 100644 --- a/bazel/emscripten_toolchain/wasm_binary.py +++ b/bazel/emscripten_toolchain/wasm_binary.py @@ -3,16 +3,9 @@ This script will take a tar archive containing the output of the emscripten toolchain. This file contains any output files produced by a wasm_cc_binary or a cc_binary built with --config=wasm. The files are extracted into the given -output path. +output paths. -The name of archive is expected to be of the format `foo` or `foo.XXX` and -the contents are expected to be foo.js and foo.wasm. - -Several optional files may also be in the archive, including but not limited to -foo.js.mem, pthread-main.js, and foo.wasm.map. - -If the file is not a tar archive, the passed file will simply be copied to its -destination. +The contents of the archive are expected to match the given outputs extnames. This script and its accompanying Bazel rule should allow you to extract a WebAssembly binary into a larger web application. @@ -29,39 +22,34 @@ def ensure(f): pass -def check(f): - if not os.path.exists(f): - raise Exception('Expected file in archive: %s' % f) - - def main(): parser = argparse.ArgumentParser() parser.add_argument('--archive', help='The archive to extract from.') - parser.add_argument('--output_path', help='The path to extract into.') + parser.add_argument('--outputs', help='Comma separated list of files that should be extracted from the archive. Only the extname has to match a file in the archive.') + parser.add_argument('--allow_empty_outputs', help='If an output listed in --outputs does not exist, create it anyways.', action='store_true') args = parser.parse_args() args.archive = os.path.normpath(args.archive) + args.outputs = args.outputs.split(",") - basename = os.path.basename(args.archive) - stem = basename.split('.')[0] - - # Extract all files from the tarball. tar = tarfile.open(args.archive) - tar.extractall(args.output_path) - - # At least one of these two files should exist at this point. - ensure(os.path.join(args.output_path, stem + '.js')) - ensure(os.path.join(args.output_path, stem + '.wasm')) - # And can optionally contain these extra files. - ensure(os.path.join(args.output_path, stem + '.wasm.map')) - ensure(os.path.join(args.output_path, stem + '.worker.js')) - ensure(os.path.join(args.output_path, stem + '.js.mem')) - ensure(os.path.join(args.output_path, stem + '.data')) - ensure(os.path.join(args.output_path, stem + '.fetch.js')) - ensure(os.path.join(args.output_path, stem + '.js.symbols')) - ensure(os.path.join(args.output_path, stem + '.wasm.debug.wasm')) - ensure(os.path.join(args.output_path, stem + '.html')) + for member in tar.getmembers(): + extname = '.' + member.name.split('.', 1)[1] + for idx, output in enumerate(args.outputs): + if output.endswith(extname): + member_file = tar.extractfile(member) + with open(output, "wb") as output_file: + output_file.write(member_file.read()) + args.outputs.pop(idx) + break + + for output in args.outputs: + extname = '.' + output.split('.', 1)[1] + if args.allow_empty_outputs: + ensure(output) + else: + print("[ERROR] Archive does not contain file with extname: %s" % extname) if __name__ == '__main__': diff --git a/bazel/emscripten_toolchain/wasm_cc_binary.bzl b/bazel/emscripten_toolchain/wasm_cc_binary.bzl index dbdb2384ff..9cf6328aff 100644 --- a/bazel/emscripten_toolchain/wasm_cc_binary.bzl +++ b/bazel/emscripten_toolchain/wasm_cc_binary.bzl @@ -54,11 +54,81 @@ _wasm_transition = transition( ], ) -def _wasm_binary_impl(ctx): +_ALLOW_OUTPUT_EXTNAMES = [ + ".js", + ".wasm", + ".wasm.map", + ".worker.js", + ".js.mem", + ".data", + ".fetch.js", + ".js.symbols", + ".wasm.debug.wasm", + ".html", +] + +_WASM_BINARY_COMMON_ATTRS = { + "backend": attr.string( + default = "_default", + values = ["_default", "emscripten", "llvm"], + ), + "cc_target": attr.label( + cfg = _wasm_transition, + mandatory = True, + ), + "exit_runtime": attr.bool( + default = False, + ), + "threads": attr.string( + default = "_default", + values = ["_default", "emscripten", "off"], + ), + "simd": attr.bool( + default = False, + ), + "_allowlist_function_transition": attr.label( + default = "@bazel_tools//tools/allowlists/function_transition_allowlist", + ), + "_wasm_binary_extractor": attr.label( + executable = True, + allow_files = True, + cfg = "exec", + default = Label("@emsdk//emscripten_toolchain:wasm_binary"), + ), +} + +def _wasm_cc_binary_impl(ctx): args = ctx.actions.args() - args.add("--output_path", ctx.outputs.loader.dirname) + cc_target = ctx.attr.cc_target[0] + + for output in ctx.outputs.outputs: + valid_extname = False + for allowed_extname in _ALLOW_OUTPUT_EXTNAMES: + if output.path.endswith(allowed_extname): + valid_extname = True + break + if not valid_extname: + fail("Invalid output '{}'. Allowed extnames: {}".format(output.basename, ", ".join(_ALLOW_OUTPUT_EXTNAMES))) + args.add_all("--archive", ctx.files.cc_target) + args.add_joined("--outputs", ctx.outputs.outputs, join_with = ",") + ctx.actions.run( + inputs = ctx.files.cc_target, + outputs = ctx.outputs.outputs, + arguments = [args], + executable = ctx.executable._wasm_binary_extractor, + ) + + return DefaultInfo( + files = depset(ctx.outputs.outputs), + # This is needed since rules like web_test usually have a data + # dependency on this target. + data_runfiles = ctx.runfiles(transitive_files = depset(ctx.outputs.outputs)), + ) + +def _wasm_cc_binary_legacy_impl(ctx): + cc_target = ctx.attr.cc_target[0] outputs = [ ctx.outputs.loader, ctx.outputs.wasm, @@ -72,6 +142,11 @@ def _wasm_binary_impl(ctx): ctx.outputs.html, ] + args = ctx.actions.args() + args.add("--allow_empty_outputs") + args.add_all("--archive", ctx.files.cc_target) + args.add_joined("--outputs", outputs, join_with = ",") + ctx.actions.run( inputs = ctx.files.cc_target, outputs = outputs, @@ -87,7 +162,19 @@ def _wasm_binary_impl(ctx): data_runfiles = ctx.runfiles(transitive_files = depset(outputs)), ) -def _wasm_binary_outputs(name, cc_target): +_wasm_cc_binary = rule( + name = "wasm_cc_binary", + implementation = _wasm_cc_binary_impl, + attrs = dict( + _WASM_BINARY_COMMON_ATTRS, + outputs = attr.output_list( + allow_empty = False, + mandatory = True, + ), + ), +) + +def _wasm_binary_legacy_outputs(name, cc_target): basename = cc_target.name basename = basename.split(".")[0] outputs = { @@ -105,6 +192,13 @@ def _wasm_binary_outputs(name, cc_target): return outputs +_wasm_cc_binary_legacy = rule( + name = "wasm_cc_binary", + implementation = _wasm_cc_binary_legacy_impl, + attrs = _WASM_BINARY_COMMON_ATTRS, + outputs = _wasm_binary_legacy_outputs, +) + # Wraps a C++ Blaze target, extracting the appropriate files. # # This rule will transition to the emscripten toolchain in order @@ -113,36 +207,10 @@ def _wasm_binary_outputs(name, cc_target): # Args: # name: The name of the rule. # cc_target: The cc_binary or cc_library to extract files from. -wasm_cc_binary = rule( - implementation = _wasm_binary_impl, - attrs = { - "backend": attr.string( - default = "_default", - values = ["_default", "emscripten", "llvm"], - ), - "cc_target": attr.label( - cfg = _wasm_transition, - mandatory = True, - ), - "exit_runtime": attr.bool( - default = False, - ), - "threads": attr.string( - default = "_default", - values = ["_default", "emscripten", "off"], - ), - "simd": attr.bool( - default = False, - ), - "_allowlist_function_transition": attr.label( - default = "@bazel_tools//tools/allowlists/function_transition_allowlist", - ), - "_wasm_binary_extractor": attr.label( - executable = True, - allow_files = True, - cfg = "exec", - default = Label("@emsdk//emscripten_toolchain:wasm_binary"), - ), - }, - outputs = _wasm_binary_outputs, -) +def wasm_cc_binary(outputs = None, **kwargs): + # for backwards compatibility if no outputs are set the deprecated + # implementation is used. + if not outputs: + _wasm_cc_binary_legacy(**kwargs) + else: + _wasm_cc_binary(outputs = outputs, **kwargs) diff --git a/bazel/test_external/BUILD b/bazel/test_external/BUILD index 4e69238cf6..e3a8e9e645 100644 --- a/bazel/test_external/BUILD +++ b/bazel/test_external/BUILD @@ -8,6 +8,10 @@ cc_binary( wasm_cc_binary( name = "hello-world-wasm", cc_target = ":hello-world", + outputs = [ + "hello-world.js", + "hello-world.wasm", + ], ) BASE_LINKOPTS = [ From b3ca5a4900fc69ad6653261cc8c362691380df38 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Sun, 22 May 2022 11:24:36 -0700 Subject: [PATCH 07/50] 3.1.11 (#1053) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 694fa34cd7..c791c744b2 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.11": struct( + hash = "8c3a799341c01148692c52fda73bbba5e89c5727", + sha_linux = "ba52cfd784362530866c9d554ddc62cfa3f0690f44007c0b3b36e189bb579d5e", + sha_mac = "c46548425e0bf4acd3c4275aff6a463c90ff1faf283ae7f5237d8c17bf84d779", + sha_mac_arm64 = "c5ae40c468955ed02b86c54061278d2b4075b1230612bae5910f836aa9c200b3", + sha_win = "74481a1998236fd9d296f367584934d5ab8bbf174446ceb647f714031671de98", + ), "3.1.10": struct( hash = "8bd05c7221b4ce34d4bedec40b672d94e681a765", sha_linux = "f5a937383b5c9fa15071a31d679a2ddd5c03bc8952cbbd5bfbf7c0a86c2dae5a", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 60fcef5129..1d13c2079c 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.10", + "latest": "3.1.11", "latest-sdk": "latest", "latest-64bit": "latest", "sdk-latest-64bit": "latest", @@ -9,6 +9,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.11": "8c3a799341c01148692c52fda73bbba5e89c5727", + "3.1.11-asserts": "4d27b98351e021e9b7d2681a84cbab5a0ddc7a88", "3.1.10": "8bd05c7221b4ce34d4bedec40b672d94e681a765", "3.1.10-asserts": "d9b20effb2d660936fb5be525744e941fd900bc6", "3.1.9": "edabe25af34554d19c046078f853999b074259ca", From 62d817b66dad481b150fd49cdc1e803725d23813 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 26 May 2022 21:39:21 -0700 Subject: [PATCH 08/50] 3.1.12 (#1054) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index c791c744b2..f3505bbedd 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.12": struct( + hash = "a8c3b314d61e2bb98581d522f858132b2fc21488", + sha_linux = "ac8ae46b2fe2fbef07077cdeefc8288d2a73e3189958f32b36f2d17d868275d0", + sha_mac = "c33afddd7c8f7a5293cb427ef26eb65f51fa3121d0577568824174227aa37ef3", + sha_mac_arm64 = "253feff779385d2499764cd988175446e21db8cbb9952746e96969c2a763924c", + sha_win = "04015fb6a1b4ad4d7c16587a7eeaabf19c5b35097f3e28efa029c0c67547067c", + ), "3.1.11": struct( hash = "8c3a799341c01148692c52fda73bbba5e89c5727", sha_linux = "ba52cfd784362530866c9d554ddc62cfa3f0690f44007c0b3b36e189bb579d5e", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 1d13c2079c..e5f0140562 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.11", + "latest": "3.1.12", "latest-sdk": "latest", "latest-64bit": "latest", "sdk-latest-64bit": "latest", @@ -9,6 +9,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.12": "a8c3b314d61e2bb98581d522f858132b2fc21488", + "3.1.12-asserts": "0ec1936aa3cb809d96abfebcc5356cd0cb15f6b8", "3.1.11": "8c3a799341c01148692c52fda73bbba5e89c5727", "3.1.11-asserts": "4d27b98351e021e9b7d2681a84cbab5a0ddc7a88", "3.1.10": "8bd05c7221b4ce34d4bedec40b672d94e681a765", From 3d86ccb4257de7ad551a23dc8a33d28e7f1372ef Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 2 Jun 2022 18:14:57 -0700 Subject: [PATCH 09/50] 3.1.13 (#1055) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index f3505bbedd..5f76fe2e08 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.13": struct( + hash = "bc44364b561cfde15c243a54e3b96ea12d7ea284", + sha_linux = "290f04300465cbb7c8e920f9986128b3f287b14b93627b0c6d069d534860c1b4", + sha_mac = "72b209a3e5800be155cf5b29bdaceb18aefceeba68f35ac719a483bd27d85705", + sha_mac_arm64 = "2bf90ed73454f58b810e09a776a34ddf7395f9ee45580f3a8fea53f74ba7ede2", + sha_win = "07fd730289c26f72ae4037fd25f608f6b9d36f1950677229b6c7d392957db3d2", + ), "3.1.12": struct( hash = "a8c3b314d61e2bb98581d522f858132b2fc21488", sha_linux = "ac8ae46b2fe2fbef07077cdeefc8288d2a73e3189958f32b36f2d17d868275d0", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index e5f0140562..a13e4a6d14 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.12", + "latest": "3.1.13", "latest-sdk": "latest", "latest-64bit": "latest", "sdk-latest-64bit": "latest", @@ -9,6 +9,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.13": "bc44364b561cfde15c243a54e3b96ea12d7ea284", + "3.1.13-asserts": "6b8f75967b5d37fa898d217b560d571694eb5b13", "3.1.12": "a8c3b314d61e2bb98581d522f858132b2fc21488", "3.1.12-asserts": "0ec1936aa3cb809d96abfebcc5356cd0cb15f6b8", "3.1.11": "8c3a799341c01148692c52fda73bbba5e89c5727", From 311acff345fd71dcfe5f350653cec466ee7e3fbc Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Tue, 7 Jun 2022 13:48:37 -0400 Subject: [PATCH 10/50] [bazel] Add additional files necessary for building with closure and on RBE (#1057) --- bazel/emscripten_deps.bzl | 47 ++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/bazel/emscripten_deps.bzl b/bazel/emscripten_deps.bzl index 01baa01351..d8e5de8055 100644 --- a/bazel/emscripten_deps.bzl +++ b/bazel/emscripten_deps.bzl @@ -19,11 +19,31 @@ filegroup( ) 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", ], ) @@ -31,7 +51,6 @@ filegroup( filegroup( name = "linker_files", srcs = [ - "emscripten/emcc.py", "bin/clang{bin_extension}", "bin/llc{bin_extension}", "bin/llvm-ar{bin_extension}", @@ -40,15 +59,33 @@ filegroup( "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__/**", + ], + ), ) """ From 517e02fac88b48c74da14b1cf7c6d51e489a5793 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 20 Jun 2022 08:53:10 -0700 Subject: [PATCH 11/50] 3.1.14 (#1061) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 5f76fe2e08..01c84f2fda 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.14": struct( + hash = "ade9d780ff17c88d81aa13860361743e3c1e1396", + sha_linux = "e2c43068fb1985592db42183a13f85bbd9518b3747746e0003d70c7d770a0b2f", + sha_mac = "567e9548f3fa7c1aa717821af4aaa7849a0f7217cb55eb7f66a06c898808fd96", + sha_mac_arm64 = "df8319aba8bc0d0c40ebec3c8f45e507c2a51a57df24826d4cab6f6cd75017ac", + sha_win = "6bfec6bf6a01e483a57e91f7223340a425f6ff711cbd32a08ed78002810d7882", + ), "3.1.13": struct( hash = "bc44364b561cfde15c243a54e3b96ea12d7ea284", sha_linux = "290f04300465cbb7c8e920f9986128b3f287b14b93627b0c6d069d534860c1b4", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index a13e4a6d14..e522911b4f 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.13", + "latest": "3.1.14", "latest-sdk": "latest", "latest-64bit": "latest", "sdk-latest-64bit": "latest", @@ -9,6 +9,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.14": "ade9d780ff17c88d81aa13860361743e3c1e1396", + "3.1.14-asserts": "b55548282b553fc0b922b82d97b80f256bf01d20", "3.1.13": "bc44364b561cfde15c243a54e3b96ea12d7ea284", "3.1.13-asserts": "6b8f75967b5d37fa898d217b560d571694eb5b13", "3.1.12": "a8c3b314d61e2bb98581d522f858132b2fc21488", From 8281708351554b8d1eda9dafdca851b0b9be1eeb Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 1 Jul 2022 08:36:40 -0700 Subject: [PATCH 12/50] 3.1.15 (#1066) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 01c84f2fda..2b043d135e 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.15": struct( + hash = "568a46a9fb7e1f1686a6f7216b3dc976f28d2a79", + sha_linux = "737db513047d12e95a12f4fbe05314f3af79ac955d1ea43fc83626337e307edc", + sha_mac = "f8993371a1ff713203023f0283054a31df5342ca287debc4e16d04d97e069aee", + sha_mac_arm64 = "c61a8efa8543a6c44e394a0685e7d4facb4c7dbb210c4c32d311b0002c4dec99", + sha_win = "235592467a0be6a537e03fb587aaee230aa2c889f2785cb9754eb44bfbf747ed", + ), "3.1.14": struct( hash = "ade9d780ff17c88d81aa13860361743e3c1e1396", sha_linux = "e2c43068fb1985592db42183a13f85bbd9518b3747746e0003d70c7d770a0b2f", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index e522911b4f..7716b61fde 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.14", + "latest": "3.1.15", "latest-sdk": "latest", "latest-64bit": "latest", "sdk-latest-64bit": "latest", @@ -9,6 +9,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.15": "568a46a9fb7e1f1686a6f7216b3dc976f28d2a79", + "3.1.15-asserts": "a8a770a0a23d2279270bd28004c8c60b02d91fbb", "3.1.14": "ade9d780ff17c88d81aa13860361743e3c1e1396", "3.1.14-asserts": "b55548282b553fc0b922b82d97b80f256bf01d20", "3.1.13": "bc44364b561cfde15c243a54e3b96ea12d7ea284", From b0a51b36ee11cabbed7ab35335c1e9d7c6ae4eba Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 1 Jul 2022 15:26:24 -0700 Subject: [PATCH 13/50] Pin `latest` to a specific version for arm64-linux (#1065) Fixes: #1040 --- emscripten-releases-tags.json | 1 + emsdk.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 7716b61fde..17a1f88780 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -2,6 +2,7 @@ "aliases": { "latest": "3.1.15", "latest-sdk": "latest", + "latest-arm64-linux": "3.1.9", "latest-64bit": "latest", "sdk-latest-64bit": "latest", "latest-upstream": "latest", diff --git a/emsdk.py b/emsdk.py index 1b5fc79a54..39ff4c5f25 100644 --- a/emsdk.py +++ b/emsdk.py @@ -2186,6 +2186,9 @@ def find_latest_hash(): def resolve_sdk_aliases(name, verbose=False): releases_info = load_releases_info() + if name == 'latest' and LINUX and ARCH == 'aarch64': + print("warning: 'latest' on arm64-linux may be slightly behind other architectures") + name = 'latest-arm64-linux' while name in releases_info['aliases']: if verbose: print("Resolving SDK alias '%s' to '%s'" % (name, releases_info['aliases'][name])) From 961e66c5099e1119dda25f7a8945d155fc561c90 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 14 Jul 2022 17:06:43 -0700 Subject: [PATCH 14/50] 3.1.16 (#1071) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 2b043d135e..7240e12d97 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.16": struct( + hash = "fb1baf00423818052359cf9126e94bc71c39feb5", + sha_linux = "bdce7e58833069a98d7e0b4fd9d6fea7394770ec10339cc95ed9fe52ba39f3a7", + sha_mac = "d05f4e997324d7f7d8561436677687d296893d6414f53930184fab272e4c6158", + sha_mac_arm64 = "36ab8da30698558a567c5c1c0e130b59f08cf4b29c9c5242f4ea60b449ecff17", + sha_win = "e1324c22c914ab7f62fe6d38a550de25b2232a723c80393fa8884a260c07766d", + ), "3.1.15": struct( hash = "568a46a9fb7e1f1686a6f7216b3dc976f28d2a79", sha_linux = "737db513047d12e95a12f4fbe05314f3af79ac955d1ea43fc83626337e307edc", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 17a1f88780..05fa50f5bb 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.15", + "latest": "3.1.16", "latest-sdk": "latest", "latest-arm64-linux": "3.1.9", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.16": "fb1baf00423818052359cf9126e94bc71c39feb5", + "3.1.16-asserts": "61848bee5b330db5ad5f827352d453b5557757fa", "3.1.15": "568a46a9fb7e1f1686a6f7216b3dc976f28d2a79", "3.1.15-asserts": "a8a770a0a23d2279270bd28004c8c60b02d91fbb", "3.1.14": "ade9d780ff17c88d81aa13860361743e3c1e1396", From 71b737e82f6611b894ba7cb57c4d9771017446b3 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 22 Jul 2022 15:54:03 -0700 Subject: [PATCH 15/50] 3.1.17 (#1076) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 7240e12d97..cfc58d3eff 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.17": struct( + hash = "d27fef2070c86a218965da8b8b5df8b4425aa3bb", + sha_linux = "562b3ba75ce77a917317bc697febb38194e85cfe07f4fec308c3b29c621f8f13", + sha_mac = "8a2bee8ea434049e40663a6d78d1c3584e5c32196fd85d6a10f3192d2e3aba4e", + sha_mac_arm64 = "5f60d3f351d06d862e853a294642d24243d6cb197e34c2f2602d80555c2eb014", + sha_win = "90b2ade825e07bb05831090dd64b5f5b01a4169a84a3ddec85fcd60be3b246a5", + ), "3.1.16": struct( hash = "fb1baf00423818052359cf9126e94bc71c39feb5", sha_linux = "bdce7e58833069a98d7e0b4fd9d6fea7394770ec10339cc95ed9fe52ba39f3a7", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 05fa50f5bb..486c82bbc2 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.16", + "latest": "3.1.17", "latest-sdk": "latest", "latest-arm64-linux": "3.1.9", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.17": "d27fef2070c86a218965da8b8b5df8b4425aa3bb", + "3.1.17-asserts": "19aab28a81be09863e86aba8ee4e20feaee31f6b", "3.1.16": "fb1baf00423818052359cf9126e94bc71c39feb5", "3.1.16-asserts": "61848bee5b330db5ad5f827352d453b5557757fa", "3.1.15": "568a46a9fb7e1f1686a6f7216b3dc976f28d2a79", From 5ad3ff05a79781256e88cde3829c5b0348be861f Mon Sep 17 00:00:00 2001 From: Tim Ebbeke Date: Sun, 24 Jul 2022 06:31:41 +0200 Subject: [PATCH 16/50] Exclude msys from path fix function. (#1078) Fixes: #911 --- emsdk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emsdk.py b/emsdk.py index 39ff4c5f25..83a0889d1c 100644 --- a/emsdk.py +++ b/emsdk.py @@ -527,7 +527,7 @@ def untargz(source_filename, dest_dir): # See https://msdn.microsoft.com/en-us/library/aa365247.aspx#maxpath and http://stackoverflow.com/questions/3555527/python-win32-filename-length-workaround # In that mode, forward slashes cannot be used as delimiters. def fix_potentially_long_windows_pathname(pathname): - if not WINDOWS: + if not WINDOWS or MSYS: return pathname # Test if emsdk calls fix_potentially_long_windows_pathname() with long # relative paths (which is problematic) From 26a0dea0d3bbf616fa7f0a908e5b08aab406f7c4 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Mon, 1 Aug 2022 12:52:09 -0700 Subject: [PATCH 17/50] 3.1.18 (#1081) * 3.1.18 * Update LLVM include path in Bazel files --- bazel/emscripten_deps.bzl | 2 +- bazel/emscripten_toolchain/crosstool.bzl | 4 ++-- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bazel/emscripten_deps.bzl b/bazel/emscripten_deps.bzl index d8e5de8055..cd592e9842 100644 --- a/bazel/emscripten_deps.bzl +++ b/bazel/emscripten_deps.bzl @@ -14,7 +14,7 @@ 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.0.0/include/**", ]), ) diff --git a/bazel/emscripten_toolchain/crosstool.bzl b/bazel/emscripten_toolchain/crosstool.bzl index a275cc0e8e..a15c200da9 100644 --- a/bazel/emscripten_toolchain/crosstool.bzl +++ b/bazel/emscripten_toolchain/crosstool.bzl @@ -911,7 +911,7 @@ def _impl(ctx): "-iwithsysroot" + "/include/compat", "-iwithsysroot" + "/include", "-isystem", - emscripten_dir + "/lib/clang/15.0.0/include", + emscripten_dir + "/lib/clang/16.0.0/include", ], ), # Inputs and outputs @@ -1073,7 +1073,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.0.0/include", ] artifact_name_patterns = [] diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index cfc58d3eff..8b31967b59 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.18": struct( + hash = "56271c44baca883fddb4a58d0ebc137f9ae43d1a", + sha_linux = "4554ce1c3c77c905737452ec377abd412a97ab66bdf8d7c411ab020a6ee2873e", + sha_mac = "d18e5e36c24638c15b302f41a3e76370a3ec0e6410f97556bd731d762a3ce07a", + sha_mac_arm64 = "9e39b53c4c1c8fcdfbe0fd7e86d2aafd4fba79251d7ca3e3307774cb2734f88b", + sha_win = "b78a30b5efb53076898457b501370ad79403bfa1273e0a7f28ee791362a707c5", + ), "3.1.17": struct( hash = "d27fef2070c86a218965da8b8b5df8b4425aa3bb", sha_linux = "562b3ba75ce77a917317bc697febb38194e85cfe07f4fec308c3b29c621f8f13", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 486c82bbc2..811b2f9659 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.17", + "latest": "3.1.18", "latest-sdk": "latest", "latest-arm64-linux": "3.1.9", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.18": "56271c44baca883fddb4a58d0ebc137f9ae43d1a", + "3.1.18-asserts": "1b72e32b38349f75cc42926a0b4875ff99632cf6", "3.1.17": "d27fef2070c86a218965da8b8b5df8b4425aa3bb", "3.1.17-asserts": "19aab28a81be09863e86aba8ee4e20feaee31f6b", "3.1.16": "fb1baf00423818052359cf9126e94bc71c39feb5", From 4a48a752e6a8bef6f222622f2b4926d5eb3bdeb3 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Thu, 4 Aug 2022 10:29:34 -0700 Subject: [PATCH 18/50] 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. --- bazel/revisions.bzl | 10 +++++----- emscripten-releases-tags.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 8b31967b59..cd15402840 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -3,11 +3,11 @@ EMSCRIPTEN_TAGS = { "3.1.18": struct( - hash = "56271c44baca883fddb4a58d0ebc137f9ae43d1a", - sha_linux = "4554ce1c3c77c905737452ec377abd412a97ab66bdf8d7c411ab020a6ee2873e", - sha_mac = "d18e5e36c24638c15b302f41a3e76370a3ec0e6410f97556bd731d762a3ce07a", - sha_mac_arm64 = "9e39b53c4c1c8fcdfbe0fd7e86d2aafd4fba79251d7ca3e3307774cb2734f88b", - sha_win = "b78a30b5efb53076898457b501370ad79403bfa1273e0a7f28ee791362a707c5", + hash = "49d45744895c7d7e28acd94a385d7ee361653b4a", + sha_linux = "6ef373c4ff3cdf33d7beecea47d4eaee7795693f8ca9469f33785cb9c54f40bb", + sha_mac = "ad0e645abdb6d3f0b6c6ad0ee70761010a712949c9b0b193aefc78ecbc3f1710", + sha_mac_arm64 = "68d0a1ec3e83e0415e24133c59e64206b83686712434c8c2e6792547cf654b1c", + sha_win = "96829a228f7c08fabd37833f7361614785aa39aa865beef06890ee8ede58dc66", ), "3.1.17": struct( hash = "d27fef2070c86a218965da8b8b5df8b4425aa3bb", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 811b2f9659..80caaf387e 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -10,8 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { - "3.1.18": "56271c44baca883fddb4a58d0ebc137f9ae43d1a", - "3.1.18-asserts": "1b72e32b38349f75cc42926a0b4875ff99632cf6", + "3.1.18": "49d45744895c7d7e28acd94a385d7ee361653b4a", + "3.1.18-asserts": "cb7fa1dce4b04e35b78ec43499a7759f24c1e64d", "3.1.17": "d27fef2070c86a218965da8b8b5df8b4425aa3bb", "3.1.17-asserts": "19aab28a81be09863e86aba8ee4e20feaee31f6b", "3.1.16": "fb1baf00423818052359cf9126e94bc71c39feb5", From c220895fd1163c01f0a8b44229fb9e4fe0ae0958 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 17 Aug 2022 11:47:52 -0700 Subject: [PATCH 19/50] 3.1.19 (#1090) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index cd15402840..75d8d1b35d 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.19": struct( + hash = "4c3772879a04140298c3abde90962d5567b5e2fc", + sha_linux = "18d4a5bb93371fe1d4586db9804f673fff0c510d98713ec25b6bda1a8457230d", + sha_mac = "6adb721340cb93b7a3efafbfd1d283842a39bb6f1390630b0806c8af26b66840", + sha_mac_arm64 = "429c9e3a79d32380f3dfee52b1001963edaa2e3035fce9f52ca87b08e1a2f26e", + sha_win = "0368eefb28f42799ce897020d0d10a4a27e1b69b650575d94deb268e402a3632", + ), "3.1.18": struct( hash = "49d45744895c7d7e28acd94a385d7ee361653b4a", sha_linux = "6ef373c4ff3cdf33d7beecea47d4eaee7795693f8ca9469f33785cb9c54f40bb", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 80caaf387e..0d2788f053 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.18", + "latest": "3.1.19", "latest-sdk": "latest", "latest-arm64-linux": "3.1.9", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.19": "4c3772879a04140298c3abde90962d5567b5e2fc", + "3.1.19-asserts": "83c2ba526ec47139d29e1417ac23d15b37ead98a", "3.1.18": "49d45744895c7d7e28acd94a385d7ee361653b4a", "3.1.18-asserts": "cb7fa1dce4b04e35b78ec43499a7759f24c1e64d", "3.1.17": "d27fef2070c86a218965da8b8b5df8b4425aa3bb", From e456ebdd52d30c83f1d81274c4a80d7a10123ecb Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 19 Aug 2022 12:13:03 -0700 Subject: [PATCH 20/50] 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 --- emsdk.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/emsdk.py b/emsdk.py index 83a0889d1c..499f14dbdd 100644 --- a/emsdk.py +++ b/emsdk.py @@ -56,9 +56,15 @@ # Enable this to do very verbose printing about the different steps that are # being run. Useful for debugging. VERBOSE = int(os.getenv('EMSDK_VERBOSE', '0')) +QUIET = int(os.getenv('EMSDK_QUIET', '0')) TTY_OUTPUT = not os.getenv('EMSDK_NOTTY', not sys.stdout.isatty()) +def info(msg): + if not QUIET: + print(msg, file=sys.stderr) + + def errlog(msg): print(msg, file=sys.stderr) @@ -2663,10 +2669,10 @@ def get_env_vars_to_add(tools_to_activate, system, user): env_vars_to_add += [('PATH', newpath)] if added_path: - errlog('Adding directories to PATH:') + info('Adding directories to PATH:') for item in added_path: - errlog('PATH += ' + item) - errlog('') + info('PATH += ' + item) + info('') # A core variable EMSDK points to the root of Emscripten SDK directory. env_vars_to_add += [('EMSDK', to_unix_path(emsdk_path()))] @@ -2705,6 +2711,7 @@ def get_env_vars_to_add(tools_to_activate, system, user): def construct_env(tools_to_activate, system, user): + info('Setting up EMSDK environment (suppress these messages with EMSDK_QUIET=1)') return construct_env_with_vars(get_env_vars_to_add(tools_to_activate, system, user)) @@ -2723,13 +2730,13 @@ def unset_env(key): def construct_env_with_vars(env_vars_to_add): env_string = '' if env_vars_to_add: - errlog('Setting environment variables:') + info('Setting environment variables:') for key, value in env_vars_to_add: # Don't set env vars which are already set to the correct value. if key in os.environ and to_unix_path(os.environ[key]) == to_unix_path(value): continue - errlog(key + ' = ' + value) + info(key + ' = ' + value) if POWERSHELL: env_string += '$env:' + key + '="' + value + '"\n' elif CMD: @@ -2757,9 +2764,9 @@ def construct_env_with_vars(env_vars_to_add): 'EMSDK_NUM_CORES', 'EMSDK_NOTTY', 'EMSDK_KEEP_DOWNLOADS']) env_keys_to_add = set(pair[0] for pair in env_vars_to_add) for key in os.environ: - if key.startswith('EMSDK_') or key.startswith('EM_'): + if key.startswith('EMSDK_') or key.startswith('EM_CACHE'): if key not in env_keys_to_add and key not in ignore_keys: - errlog('Clearing existing environment variable: %s' % key) + info('Clearing existing environment variable: %s' % key) env_string += unset_env(key) return env_string From 21611d2a507fad73385120d89e05a794666070ae Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 24 Aug 2022 09:57:40 -0700 Subject: [PATCH 21/50] 3.1.20 (#1095) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 75d8d1b35d..7b227c9311 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.20": struct( + hash = "d92c8639f406582d70a5dde27855f74ecf602f45", + sha_linux = "3b606d133489aac8cdfff4f99ff14a35563b1fafe658aa23f83694f77ed9467a", + sha_mac = "cc9ea1696bdb3f28778bac1cf4587a34e90830e1c64976cd205fd73e77566cd8", + sha_mac_arm64 = "b976410bf4fa1af9896be1c736634bfb56b2ef0f3386cd3cf39616ce47445cc0", + sha_win = "1e6806ee240ab838ae7eee618c57efc793195c62e4d167136507efcfa66d6c6d", + ), "3.1.19": struct( hash = "4c3772879a04140298c3abde90962d5567b5e2fc", sha_linux = "18d4a5bb93371fe1d4586db9804f673fff0c510d98713ec25b6bda1a8457230d", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 0d2788f053..94f9e436c3 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.19", + "latest": "3.1.20", "latest-sdk": "latest", "latest-arm64-linux": "3.1.9", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.20": "d92c8639f406582d70a5dde27855f74ecf602f45", + "3.1.20-asserts": "db0fd1cb7316675317d527b6ed4f4cc7005df9ec", "3.1.19": "4c3772879a04140298c3abde90962d5567b5e2fc", "3.1.19-asserts": "83c2ba526ec47139d29e1417ac23d15b37ead98a", "3.1.18": "49d45744895c7d7e28acd94a385d7ee361653b4a", From b1bb477e38539f81f6db7a3c24be9df476ff516b Mon Sep 17 00:00:00 2001 From: Joel Van Eenwyk Date: Tue, 30 Aug 2022 07:25:39 -0700 Subject: [PATCH 22/50] Add double-quotes to allow spaces in path (#1097) --- emsdk | 19 +++++++++---------- emsdk_env.sh | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/emsdk b/emsdk index 98b8d84ac2..5fae040051 100755 --- a/emsdk +++ b/emsdk @@ -8,14 +8,14 @@ # First look for python bundled in Emsdk if [ -z "$EMSDK_PYTHON" ]; then - PYTHON3=$(dirname $0)/python/3.9.2-1_64bit/bin/python3 - PYTHON3_CERT_FILE=$(dirname $0)/python/3.9.2-1_64bit/lib/python3.9/site-packages/certifi/cacert.pem - if [ ! -f $PYTHON3 ]; then - PYTHON3=$(dirname $0)/python/3.7.4-2_64bit/bin/python3 - PYTHON3_CERT_FILE=$(dirname $0)/python/3.7.4-2_64bit/lib/python3.7/site-packages/certifi/cacert.pem + PYTHON3="$(dirname "$0")/python/3.9.2-1_64bit/bin/python3" + PYTHON3_CERT_FILE="$(dirname "$0")/python/3.9.2-1_64bit/lib/python3.9/site-packages/certifi/cacert.pem" + if [ ! -f "$PYTHON3" ]; then + PYTHON3="$(dirname "$0")/python/3.7.4-2_64bit/bin/python3" + PYTHON3_CERT_FILE="$(dirname "$0")/python/3.7.4-2_64bit/lib/python3.7/site-packages/certifi/cacert.pem" fi - if [ -f $PYTHON3 ]; then - EMSDK_PYTHON=$PYTHON3 + if [ -f "$PYTHON3" ]; then + EMSDK_PYTHON="$PYTHON3" # When using our bundled python we never want the users # PYTHONHOME or PYTHONPATH @@ -26,15 +26,14 @@ if [ -z "$EMSDK_PYTHON" ]; then # This is needed for MacOS. Without this, the urlopen # code will try to use /usr/local/etc/openssl/cert.pem # which may or may not exist on the system. - export SSL_CERT_FILE=$PYTHON3_CERT_FILE + export SSL_CERT_FILE="$PYTHON3_CERT_FILE" fi fi # If bundled python is not found, look for `python3` in PATH. This is especially important on macOS (See: # https://github.com/emscripten-core/emsdk/pull/273) if [ -z "$EMSDK_PYTHON" ]; then - PYTHON3=$(which python3 2> /dev/null) - if [ $? = 0 ]; then + if PYTHON3="$(which python3 2>/dev/null)"; then EMSDK_PYTHON=$PYTHON3 fi fi diff --git a/emsdk_env.sh b/emsdk_env.sh index 8f76de7522..75229e28a6 100644 --- a/emsdk_env.sh +++ b/emsdk_env.sh @@ -69,5 +69,5 @@ if [ ! -f "$DIR/emsdk.py" ]; then fi # Force emsdk to use bash syntax so that this works in windows + bash too -eval `EMSDK_BASH=1 $DIR/emsdk construct_env` +eval `EMSDK_BASH=1 "$DIR/emsdk" construct_env` unset DIR From 54308666727717d0d3fbd60cded1a2fc43d98bc7 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 9 Sep 2022 13:30:33 -0700 Subject: [PATCH 23/50] 3.1.21 (#1101) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 7b227c9311..d72683c642 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.21": struct( + hash = "a16a8bca2466eb144f7c93fa899c0272c8815dc3", + sha_linux = "7045ddb3b37a2cc63cb1cf976019a6a3b7f8dbdc71254db0eee5b0452f94e9e7", + sha_mac = "2a8d3d3ad721fec81ca1a4a581e4183b6e732e9905beb874531851846a05a367", + sha_mac_arm64 = "cf788a7bdc38bb40d01f94b2d46acafb0e2f02d8ee3b3d69541c114e467ee37f", + sha_win = "81518bba13f41717ffe6990b6d4a5af635d0c9d0f71a8d3bc0980cd0bc8f5f66", + ), "3.1.20": struct( hash = "d92c8639f406582d70a5dde27855f74ecf602f45", sha_linux = "3b606d133489aac8cdfff4f99ff14a35563b1fafe658aa23f83694f77ed9467a", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 94f9e436c3..392c03f2c0 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.20", + "latest": "3.1.21", "latest-sdk": "latest", "latest-arm64-linux": "3.1.9", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.21": "a16a8bca2466eb144f7c93fa899c0272c8815dc3", + "3.1.21-asserts": "c7a387161b029621eb4d3dd57363b1393b4c50b2", "3.1.20": "d92c8639f406582d70a5dde27855f74ecf602f45", "3.1.20-asserts": "db0fd1cb7316675317d527b6ed4f4cc7005df9ec", "3.1.19": "4c3772879a04140298c3abde90962d5567b5e2fc", From 56fda13937fe8b47e149e84cbfd13034484b8596 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 13 Sep 2022 06:39:43 -0700 Subject: [PATCH 24/50] Update latest-arm64-linux to 3.1.21 (#1102) --- emscripten-releases-tags.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 392c03f2c0..1c691c7abf 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -2,7 +2,7 @@ "aliases": { "latest": "3.1.21", "latest-sdk": "latest", - "latest-arm64-linux": "3.1.9", + "latest-arm64-linux": "3.1.21", "latest-64bit": "latest", "sdk-latest-64bit": "latest", "latest-upstream": "latest", From b6574f3a89dbe25d007e3fdc7681faac5a5c0403 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 13 Sep 2022 07:20:25 -0700 Subject: [PATCH 25/50] Update XCode version on CircleCI (#1103) 12.2 is being deprecated --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 71292f78d2..6d6b89d30f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 @@ -193,7 +193,7 @@ jobs: test-bazel-mac: macos: - xcode: "12.2.0" + xcode: "12.5.1" environment: EMSDK_NOTTY: "1" HOMEBREW_NO_AUTO_UPDATE: "1" From d0291b3216fbc9765d9cfc1a2103316b32a555c6 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Sat, 17 Sep 2022 14:29:42 -0700 Subject: [PATCH 26/50] 3.1.22 (#1107) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index d72683c642..1ab30c8abd 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.22": struct( + hash = "990cee04a21caafc75955d736fb45791a7f2aeee", + sha_linux = "a310ed9f16c97a91c72564ca5f85c412cb99429d8001825663fda1b28c00346e", + sha_mac = "b19afaf414178781c4c91ee711ec4d9063b9736719e45ca2e8b45c2258df16be", + sha_mac_arm64 = "7c8212abf77f0307b6ff848bf9c6212f870506df6d074349f76401f30f9fcefe", + sha_win = "2c0cfe267d47f390d7e35a83545b1d5043e4a7fb77b838ee19b0fce65035f55d", + ), "3.1.21": struct( hash = "a16a8bca2466eb144f7c93fa899c0272c8815dc3", sha_linux = "7045ddb3b37a2cc63cb1cf976019a6a3b7f8dbdc71254db0eee5b0452f94e9e7", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 1c691c7abf..2136e9eb1a 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.21", + "latest": "3.1.22", "latest-sdk": "latest", "latest-arm64-linux": "3.1.21", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.22": "990cee04a21caafc75955d736fb45791a7f2aeee", + "3.1.22-asserts": "d94fe69a037e93562d0bbe9d0372ce23f4ab1089", "3.1.21": "a16a8bca2466eb144f7c93fa899c0272c8815dc3", "3.1.21-asserts": "c7a387161b029621eb4d3dd57363b1393b4c50b2", "3.1.20": "d92c8639f406582d70a5dde27855f74ecf602f45", From b4fd4751bae9f37f7a991e6733ba1af40a1c8739 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 23 Sep 2022 14:27:01 -0700 Subject: [PATCH 27/50] 3.1.23 (#1111) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 1ab30c8abd..4b0ba9ea2b 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.23": struct( + hash = "bfd5e63a44ba4c8568cd8ac87c27b35e40732bf4", + sha_linux = "3b8d9e163d6afc8569deca0ba1d4042f80da7a31e23cee006c3faa9cbf2fbc31", + sha_mac = "fd1c79475e47fd2f06ee9ba189e68309e443c2d3c56fd28163d1cd6f77047075", + sha_mac_arm64 = "66e57ee0962ec31056674b5681f91bd62f85b0bf1238a8d5b160660c0bf47292", + sha_win = "7c30b281abcc0ffb9e7575197f1ac0598a94c6cec36547b81554a97b792a9e75", + ), "3.1.22": struct( hash = "990cee04a21caafc75955d736fb45791a7f2aeee", sha_linux = "a310ed9f16c97a91c72564ca5f85c412cb99429d8001825663fda1b28c00346e", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 2136e9eb1a..879390ea2c 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.22", + "latest": "3.1.23", "latest-sdk": "latest", "latest-arm64-linux": "3.1.21", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.23": "bfd5e63a44ba4c8568cd8ac87c27b35e40732bf4", + "3.1.23-asserts": "77d2c744fe37fe0e22a51329fa23bab4b8ffa656", "3.1.22": "990cee04a21caafc75955d736fb45791a7f2aeee", "3.1.22-asserts": "d94fe69a037e93562d0bbe9d0372ce23f4ab1089", "3.1.21": "a16a8bca2466eb144f7c93fa899c0272c8815dc3", From 3d87d5ea8143b3636f872fb05b896eb4a19a070b Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 6 Oct 2022 14:13:13 -0700 Subject: [PATCH 28/50] 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 ``` --- docker/Dockerfile | 1 - emsdk.py | 8 ++++++-- test/test.py | 4 ++-- test/test_activation.ps1 | 7 ------- test/test_path_preservation.ps1 | 3 --- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index cf2cd4c0d7..bc201e1daa 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -64,7 +64,6 @@ COPY --from=stage_build /emsdk /emsdk # This will let use tools offered by this image inside other Docker images # (sub-stages) or with custom / no entrypoint ENV EMSDK=/emsdk \ - EM_CONFIG=/emsdk/.emscripten \ EMSDK_NODE=/emsdk/node/14.18.2_64bit/bin/node \ PATH="/emsdk:/emsdk/upstream/emscripten:/emsdk/upstream/bin:/emsdk/node/14.18.2_64bit/bin:${PATH}" diff --git a/emsdk.py b/emsdk.py index 499f14dbdd..c26426bfc3 100644 --- a/emsdk.py +++ b/emsdk.py @@ -2676,7 +2676,6 @@ def get_env_vars_to_add(tools_to_activate, system, user): # A core variable EMSDK points to the root of Emscripten SDK directory. env_vars_to_add += [('EMSDK', to_unix_path(emsdk_path()))] - env_vars_to_add += [('EM_CONFIG', os.path.normpath(dot_emscripten_path()))] for tool in tools_to_activate: config = tool.activated_config() @@ -2692,6 +2691,9 @@ def get_env_vars_to_add(tools_to_activate, system, user): # https://github.com/emscripten-core/emscripten/pull/11091 # - Default to embedded cache also started in 1.39.16 # https://github.com/emscripten-core/emscripten/pull/11126 + # - Emscripten supports automatically locating the embedded + # config in 1.39.13: + # https://github.com/emscripten-core/emscripten/pull/10935 # # Since setting EM_CACHE in the environment effects the entire machine # we want to avoid this except when installing these older emscripten @@ -2700,6 +2702,8 @@ def get_env_vars_to_add(tools_to_activate, system, user): if version < [1, 39, 16]: em_cache_dir = os.path.join(config['EMSCRIPTEN_ROOT'], 'cache') env_vars_to_add += [('EM_CACHE', em_cache_dir)] + if version < [1, 39, 13]: + env_vars_to_add += [('EM_CONFIG', os.path.normpath(dot_emscripten_path()))] envs = tool.activated_environment() for env in envs: @@ -2764,7 +2768,7 @@ def construct_env_with_vars(env_vars_to_add): 'EMSDK_NUM_CORES', 'EMSDK_NOTTY', 'EMSDK_KEEP_DOWNLOADS']) env_keys_to_add = set(pair[0] for pair in env_vars_to_add) for key in os.environ: - if key.startswith('EMSDK_') or key.startswith('EM_CACHE'): + if key.startswith('EMSDK_') or key in ('EM_CACHE', 'EM_CONFIG'): if key not in env_keys_to_add and key not in ignore_keys: info('Clearing existing environment variable: %s' % key) env_string += unset_env(key) diff --git a/test/test.py b/test/test.py index deb7240082..f9766d0c22 100755 --- a/test/test.py +++ b/test/test.py @@ -10,9 +10,9 @@ WINDOWS = sys.platform.startswith('win') MACOS = sys.platform == 'darwin' -assert 'EM_CONFIG' in os.environ, "emsdk should be activated before running this script" +emconfig = os.path.abspath('.emscripten') +assert os.path.exists(emconfig) -emconfig = os.environ['EM_CONFIG'] upstream_emcc = os.path.join('upstream', 'emscripten', 'emcc') fastcomp_emcc = os.path.join('fastcomp', 'emscripten', 'emcc') emsdk = './emsdk' diff --git a/test/test_activation.ps1 b/test/test_activation.ps1 index 1aa0a97c9b..6d38ffcbd8 100644 --- a/test/test_activation.ps1 +++ b/test/test_activation.ps1 @@ -28,7 +28,6 @@ try { } $EMSDK = [System.Environment]::GetEnvironmentVariable("EMSDK", $env_type) - $EM_CONFIG = [System.Environment]::GetEnvironmentVariable("EM_CONFIG", $env_type) $EMSDK_NODE = [System.Environment]::GetEnvironmentVariable("EMSDK_NODE", $env_type) $EMSDK_PYTHON = [System.Environment]::GetEnvironmentVariable("EMSDK_PYTHON", $env_type) $JAVA_HOME = [System.Environment]::GetEnvironmentVariable("JAVA_HOME", $env_type) @@ -37,9 +36,6 @@ try { if (!$EMSDK) { throw "EMSDK is not set for the user" } - if (!$EM_CONFIG) { - throw "EM_CONFIG is not set for the user" - } if (!$EMSDK_NODE) { throw "EMSDK_NODE is not set for the user" } @@ -83,14 +79,12 @@ finally { # Recover pre activation env variables [Environment]::SetEnvironmentVariable("EMSDK", $null, "User") - [Environment]::SetEnvironmentVariable("EM_CONFIG", $null, "User") [Environment]::SetEnvironmentVariable("EMSDK_NODE", $null, "User") [Environment]::SetEnvironmentVariable("EMSDK_PYTHON", $null, "User") [Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "User") try { [Environment]::SetEnvironmentVariable("EMSDK", $null, "Machine") - [Environment]::SetEnvironmentVariable("EM_CONFIG", $null, "Machine") [Environment]::SetEnvironmentVariable("EMSDK_NODE", $null, "Machine") [Environment]::SetEnvironmentVariable("EMSDK_PYTHON", $null, "Machine") [Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Machine") @@ -98,7 +92,6 @@ finally { [Environment]::SetEnvironmentVariable("EMSDK", $null, "Process") - [Environment]::SetEnvironmentVariable("EM_CONFIG", $null, "Process") [Environment]::SetEnvironmentVariable("EMSDK_NODE", $null, "Process") [Environment]::SetEnvironmentVariable("EMSDK_PYTHON", $null, "Process") [Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Process") diff --git a/test/test_path_preservation.ps1 b/test/test_path_preservation.ps1 index b894954564..1547949967 100644 --- a/test/test_path_preservation.ps1 +++ b/test/test_path_preservation.ps1 @@ -123,14 +123,12 @@ finally { # Recover pre activation env variables [Environment]::SetEnvironmentVariable("EMSDK", $null, "User") - [Environment]::SetEnvironmentVariable("EM_CONFIG", $null, "User") [Environment]::SetEnvironmentVariable("EMSDK_NODE", $null, "User") [Environment]::SetEnvironmentVariable("EMSDK_PYTHON", $null, "User") [Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "User") try { [Environment]::SetEnvironmentVariable("EMSDK", $null, "Machine") - [Environment]::SetEnvironmentVariable("EM_CONFIG", $null, "Machine") [Environment]::SetEnvironmentVariable("EMSDK_NODE", $null, "Machine") [Environment]::SetEnvironmentVariable("EMSDK_PYTHON", $null, "Machine") [Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Machine") @@ -138,7 +136,6 @@ finally { [Environment]::SetEnvironmentVariable("EMSDK", $null, "Process") - [Environment]::SetEnvironmentVariable("EM_CONFIG", $null, "Process") [Environment]::SetEnvironmentVariable("EMSDK_NODE", $null, "Process") [Environment]::SetEnvironmentVariable("EMSDK_PYTHON", $null, "Process") [Environment]::SetEnvironmentVariable("JAVA_HOME", $null, "Process") From 35358657b4763f18b6a49ddc326f8f7053ed7f49 Mon Sep 17 00:00:00 2001 From: Pierrick Bouvier <101587250+pbo-linaro@users.noreply.github.com> Date: Sun, 9 Oct 2022 02:17:19 +0200 Subject: [PATCH 29/50] Use x64 version for Windows on Arm (#1115) --- emsdk.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emsdk.py b/emsdk.py index c26426bfc3..85e10d701d 100644 --- a/emsdk.py +++ b/emsdk.py @@ -142,6 +142,9 @@ def exit_with_error(msg): ARCH = 'x86' elif machine.startswith('aarch64') or machine.lower().startswith('arm64'): ARCH = 'aarch64' + if WINDOWS: + errlog('No support for Windows on Arm, fallback to x64') + ARCH = 'x86_64' elif machine.startswith('arm'): ARCH = 'arm' else: From e41b8c68a248da5f18ebd03bd0420953945d52ff Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Tue, 11 Oct 2022 12:45:01 -0700 Subject: [PATCH 30/50] 3.1.24 (#1122) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 4b0ba9ea2b..bd9030097b 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.24": struct( + hash = "54217a0950bb1dafe8808cc6207d378e323f9d74", + sha_linux = "20e8e5bd745e3ad69c03bb877091d2fbb0c7db1eab309de8f185e9821aea40f4", + sha_mac = "cfb897a980dd51fceb02ff143ad0fd8e5d299db640c5646d1547d522194545f2", + sha_mac_arm64 = "e87b0727343051312f82a6653cad4682a518dd9cb6575844c0cd6505d520fab6", + sha_win = "a0ea07f9014a912f13176fdbbc1ee7ab08104d45e7ca7e1c237505579b63d530", + ), "3.1.23": struct( hash = "bfd5e63a44ba4c8568cd8ac87c27b35e40732bf4", sha_linux = "3b8d9e163d6afc8569deca0ba1d4042f80da7a31e23cee006c3faa9cbf2fbc31", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 879390ea2c..74cd1a9f58 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.23", + "latest": "3.1.24", "latest-sdk": "latest", "latest-arm64-linux": "3.1.21", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.24": "54217a0950bb1dafe8808cc6207d378e323f9d74", + "3.1.24-asserts": "4c20c7393ca208c740c16a97dbf305ba52fea2bb", "3.1.23": "bfd5e63a44ba4c8568cd8ac87c27b35e40732bf4", "3.1.23-asserts": "77d2c744fe37fe0e22a51329fa23bab4b8ffa656", "3.1.22": "990cee04a21caafc75955d736fb45791a7f2aeee", From 92d9023adc4dbc66424df9483cee302c68817d3c Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Tue, 8 Nov 2022 10:10:38 -0800 Subject: [PATCH 31/50] 3.1.25 (#1130) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index bd9030097b..c56944dc34 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.25": struct( + hash = "ff6babb041d0f31575cc16d15ef82c6222ca99b8", + sha_linux = "c5ae6b4525845ea36bde89cbf4e1d03de87a2658862d76c6a53bbf8de7c67ff5", + sha_mac = "d2581aaa7207f0d9dd9949247f0706bda8561e805d67aec166ed4f3b39c3a3fa", + sha_mac_arm64 = "dbcb76036a09248c2a839872c27b87b6d4ccc81e57add4e2a6f5e560a2c530fc", + sha_win = "3a86d98d934456a74ed06388c1487d95a0d5a3f31777636453f22e61d57d7fb1", + ), "3.1.24": struct( hash = "54217a0950bb1dafe8808cc6207d378e323f9d74", sha_linux = "20e8e5bd745e3ad69c03bb877091d2fbb0c7db1eab309de8f185e9821aea40f4", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 74cd1a9f58..e4f150de22 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.24", + "latest": "3.1.25", "latest-sdk": "latest", "latest-arm64-linux": "3.1.21", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.25": "ff6babb041d0f31575cc16d15ef82c6222ca99b8", + "3.1.25-asserts": "6b19d6a8c30d7b83ba2193625fc12cce9ae0206b", "3.1.24": "54217a0950bb1dafe8808cc6207d378e323f9d74", "3.1.24-asserts": "4c20c7393ca208c740c16a97dbf305ba52fea2bb", "3.1.23": "bfd5e63a44ba4c8568cd8ac87c27b35e40732bf4", From 005063304bb4e575f97b7c5f50368f937c06cb54 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 8 Nov 2022 14:21:06 -0800 Subject: [PATCH 32/50] [bazel] Switch to platforms-based toolchain resolution (#1036) --- bazel/.bazelrc | 1 + bazel/BUILD | 7 +++++ bazel/README.md | 26 +++++++------------ bazel/WORKSPACE | 4 +++ bazel/bazelrc | 7 ++--- bazel/emscripten_toolchain/BUILD.bazel | 9 ++++++- .../{crosstool.bzl => toolchain.bzl} | 2 +- bazel/emscripten_toolchain/wasm_cc_binary.bzl | 2 +- bazel/test_external/.bazelrc | 1 + bazel/test_external/WORKSPACE | 4 +++ bazel/toolchains.bzl | 2 ++ 11 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 bazel/.bazelrc rename bazel/emscripten_toolchain/{crosstool.bzl => toolchain.bzl} (99%) create mode 100644 bazel/test_external/.bazelrc create mode 100644 bazel/toolchains.bzl diff --git a/bazel/.bazelrc b/bazel/.bazelrc new file mode 100644 index 0000000000..fbd75a7ea7 --- /dev/null +++ b/bazel/.bazelrc @@ -0,0 +1 @@ +build --incompatible_enable_cc_toolchain_resolution diff --git a/bazel/BUILD b/bazel/BUILD index 87fe18133b..7a13c92db7 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -66,3 +66,10 @@ alias( "//conditions:default": ":empty", }), ) + +platform( + name = "platform_wasm", + constraint_values = [ + "@platforms//cpu:wasm32", + ], +) diff --git a/bazel/README.md b/bazel/README.md index 88654757e3..877f2e073d 100644 --- a/bazel/README.md +++ b/bazel/README.md @@ -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 @@ -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") @@ -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 diff --git a/bazel/WORKSPACE b/bazel/WORKSPACE index a33ee12abd..bd5cce5b0e 100644 --- a/bazel/WORKSPACE +++ b/bazel/WORKSPACE @@ -7,3 +7,7 @@ deps() load(":emscripten_deps.bzl", "emscripten_deps") emscripten_deps() + +load(":toolchains.bzl", "register_emscripten_toolchains") + +register_emscripten_toolchains() diff --git a/bazel/bazelrc b/bazel/bazelrc index 85801e8381..d1c8aef229 100644 --- a/bazel/bazelrc +++ b/bazel/bazelrc @@ -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 diff --git a/bazel/emscripten_toolchain/BUILD.bazel b/bazel/emscripten_toolchain/BUILD.bazel index d101c67061..4486220b56 100644 --- a/bazel/emscripten_toolchain/BUILD.bazel +++ b/bazel/emscripten_toolchain/BUILD.bazel @@ -1,4 +1,4 @@ -load(":crosstool.bzl", "emscripten_cc_toolchain_config_rule") +load(":toolchain.bzl", "emscripten_cc_toolchain_config_rule") package(default_visibility = ["//visibility:public"]) @@ -86,6 +86,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"], diff --git a/bazel/emscripten_toolchain/crosstool.bzl b/bazel/emscripten_toolchain/toolchain.bzl similarity index 99% rename from bazel/emscripten_toolchain/crosstool.bzl rename to bazel/emscripten_toolchain/toolchain.bzl index a15c200da9..130405bd52 100644 --- a/bazel/emscripten_toolchain/crosstool.bzl +++ b/bazel/emscripten_toolchain/toolchain.bzl @@ -1105,7 +1105,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], diff --git a/bazel/emscripten_toolchain/wasm_cc_binary.bzl b/bazel/emscripten_toolchain/wasm_cc_binary.bzl index 9cf6328aff..8e4b6fb6b9 100644 --- a/bazel/emscripten_toolchain/wasm_cc_binary.bzl +++ b/bazel/emscripten_toolchain/wasm_cc_binary.bzl @@ -32,7 +32,7 @@ def _wasm_transition_impl(settings, attr): "//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", } diff --git a/bazel/test_external/.bazelrc b/bazel/test_external/.bazelrc new file mode 100644 index 0000000000..fbd75a7ea7 --- /dev/null +++ b/bazel/test_external/.bazelrc @@ -0,0 +1 @@ +build --incompatible_enable_cc_toolchain_resolution diff --git a/bazel/test_external/WORKSPACE b/bazel/test_external/WORKSPACE index 4fe5772240..03f07f5070 100644 --- a/bazel/test_external/WORKSPACE +++ b/bazel/test_external/WORKSPACE @@ -10,3 +10,7 @@ deps() load("@emsdk//:emscripten_deps.bzl", "emscripten_deps") emscripten_deps() + +load("@emsdk//:toolchains.bzl", "register_emscripten_toolchains") + +register_emscripten_toolchains() diff --git a/bazel/toolchains.bzl b/bazel/toolchains.bzl new file mode 100644 index 0000000000..6d50b3d3d5 --- /dev/null +++ b/bazel/toolchains.bzl @@ -0,0 +1,2 @@ +def register_emscripten_toolchains(): + native.register_toolchains(str(Label("//emscripten_toolchain:cc-toolchain-wasm"))) From e8606a7e3bfb86e86831f43db19ee639f3996532 Mon Sep 17 00:00:00 2001 From: Trevor Hickey Date: Mon, 14 Nov 2022 16:32:13 -0500 Subject: [PATCH 33/50] remove "name" attribute from bazel rules (#1131) --- bazel/emscripten_toolchain/wasm_cc_binary.bzl | 2 -- 1 file changed, 2 deletions(-) diff --git a/bazel/emscripten_toolchain/wasm_cc_binary.bzl b/bazel/emscripten_toolchain/wasm_cc_binary.bzl index 8e4b6fb6b9..c4b9c9d9ed 100644 --- a/bazel/emscripten_toolchain/wasm_cc_binary.bzl +++ b/bazel/emscripten_toolchain/wasm_cc_binary.bzl @@ -163,7 +163,6 @@ def _wasm_cc_binary_legacy_impl(ctx): ) _wasm_cc_binary = rule( - name = "wasm_cc_binary", implementation = _wasm_cc_binary_impl, attrs = dict( _WASM_BINARY_COMMON_ATTRS, @@ -193,7 +192,6 @@ def _wasm_binary_legacy_outputs(name, cc_target): return outputs _wasm_cc_binary_legacy = rule( - name = "wasm_cc_binary", implementation = _wasm_cc_binary_legacy_impl, attrs = _WASM_BINARY_COMMON_ATTRS, outputs = _wasm_binary_legacy_outputs, From 01d3d782c8c8b5b227f786408af580db4829f9b3 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 17 Nov 2022 19:20:10 -0800 Subject: [PATCH 34/50] 3.1.26 (#1134) --- bazel/emscripten_deps.bzl | 2 +- bazel/emscripten_toolchain/toolchain.bzl | 4 ++-- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bazel/emscripten_deps.bzl b/bazel/emscripten_deps.bzl index cd592e9842..5068fe0c46 100644 --- a/bazel/emscripten_deps.bzl +++ b/bazel/emscripten_deps.bzl @@ -14,7 +14,7 @@ filegroup( "emscripten/cache/sysroot/include/c++/v1/**", "emscripten/cache/sysroot/include/compat/**", "emscripten/cache/sysroot/include/**", - "lib/clang/16.0.0/include/**", + "lib/clang/16/include/**", ]), ) diff --git a/bazel/emscripten_toolchain/toolchain.bzl b/bazel/emscripten_toolchain/toolchain.bzl index 130405bd52..58d9b6db57 100644 --- a/bazel/emscripten_toolchain/toolchain.bzl +++ b/bazel/emscripten_toolchain/toolchain.bzl @@ -911,7 +911,7 @@ def _impl(ctx): "-iwithsysroot" + "/include/compat", "-iwithsysroot" + "/include", "-isystem", - emscripten_dir + "/lib/clang/16.0.0/include", + emscripten_dir + "/lib/clang/16/include", ], ), # Inputs and outputs @@ -1073,7 +1073,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/16.0.0/include", + emscripten_dir + "/lib/clang/16/include", ] artifact_name_patterns = [] diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index c56944dc34..5c1bdc023c 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.26": struct( + hash = "4f68bb2a505c727bcf58195cf4da20592a6e92c8", + sha_linux = "82d24d5619c814ae99ef7243de428600c02e96dfc49c36e44753b1fce626766e", + sha_mac = "7b645979d8901f3153507561bbec10ecfeb197dca5914228715a74b760cf7eec", + sha_mac_arm64 = "d9c647fd70588bae71303a6c923df8a44ffe63e168b375d35bf6ceda21258fa1", + sha_win = "1ad49d69634ce2d1fe04614c18060a903c102e1dbc9dfdef3a03e52c189b4c92", + ), "3.1.25": struct( hash = "ff6babb041d0f31575cc16d15ef82c6222ca99b8", sha_linux = "c5ae6b4525845ea36bde89cbf4e1d03de87a2658862d76c6a53bbf8de7c67ff5", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index e4f150de22..009cbb75b1 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.25", + "latest": "3.1.26", "latest-sdk": "latest", "latest-arm64-linux": "3.1.21", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.26": "4f68bb2a505c727bcf58195cf4da20592a6e92c8", + "3.1.26-asserts": "4e2ffe94b04dbadfbca1687ab458d306b3414d13", "3.1.25": "ff6babb041d0f31575cc16d15ef82c6222ca99b8", "3.1.25-asserts": "6b19d6a8c30d7b83ba2193625fc12cce9ae0206b", "3.1.24": "54217a0950bb1dafe8808cc6207d378e323f9d74", From 8a1268ad8b503d350f2e502272a15ed7b66ec81e Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Mon, 21 Nov 2022 11:38:45 -0800 Subject: [PATCH 35/50] Update remote_docker version in CircleCI config (#1117) 20.10.17 is the current default. --- .circleci/config.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d6b89d30f..a5d7e20155 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 @@ -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 From edc4dc5b2094b549b129571115c5102c01151101 Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Mon, 21 Nov 2022 21:18:04 +0100 Subject: [PATCH 36/50] 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. --- docker/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index bc201e1daa..508d7b39b5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:focal AS stage_build +FROM ubuntu:jammy AS stage_build ARG EMSCRIPTEN_VERSION=tot ENV EMSDK /emsdk @@ -56,7 +56,7 @@ RUN echo "## Aggressive optimization: Remove debug symbols" \ # -------------------------------- STAGE DEPLOY -------------------------------- # ------------------------------------------------------------------------------ -FROM ubuntu:focal AS stage_deploy +FROM ubuntu:jammy AS stage_deploy COPY --from=stage_build /emsdk /emsdk @@ -105,7 +105,7 @@ RUN echo "## Update and install packages" \ build-essential \ make \ ant \ - libidn11 \ + libidn12 \ cmake \ openjdk-11-jre-headless \ # Standard Cleanup on Debian images From 87e02fcd31794ef3a8e762fd640922372ff28fd6 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Tue, 29 Nov 2022 18:34:57 -0800 Subject: [PATCH 37/50] 3.1.27 (#1139) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 5c1bdc023c..c67b63bc6f 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.27": struct( + hash = "48ce0b44015d0182fc8c27aa9fbc0a4474b55982", + sha_linux = "4dc872260c8f42a8e20c8612b2255adbd466fec54cfbe37b46eca4eb34a2b03f", + sha_mac = "40c3326147b162b8357efdc72476faaa6686338cff3e176680e361c2511453e8", + sha_mac_arm64 = "7b87610de966b84353c8c1ded8e12c034b5b913c093210ebd3b26320e2ac2990", + sha_win = "39bbfcb09ba7feb214518a67b1ff6d38bae065b416b4483834e4fdaef2316f8c", + ), "3.1.26": struct( hash = "4f68bb2a505c727bcf58195cf4da20592a6e92c8", sha_linux = "82d24d5619c814ae99ef7243de428600c02e96dfc49c36e44753b1fce626766e", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 009cbb75b1..f970287d94 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.26", + "latest": "3.1.27", "latest-sdk": "latest", "latest-arm64-linux": "3.1.21", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.27": "48ce0b44015d0182fc8c27aa9fbc0a4474b55982", + "3.1.27-asserts": "630810e5a312f57d17efbe384ed7e4299f796bc1", "3.1.26": "4f68bb2a505c727bcf58195cf4da20592a6e92c8", "3.1.26-asserts": "4e2ffe94b04dbadfbca1687ab458d306b3414d13", "3.1.25": "ff6babb041d0f31575cc16d15ef82c6222ca99b8", From 32fba7b7c439ad806dcd1903231611241966ce30 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 30 Nov 2022 16:32:26 -0800 Subject: [PATCH 38/50] Use constants for fixed paths. NFC (#1140) --- emsdk.py | 70 ++++++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/emsdk.py b/emsdk.py index 85e10d701d..df57423a4d 100644 --- a/emsdk.py +++ b/emsdk.py @@ -191,15 +191,13 @@ def to_unix_path(p): return p.replace('\\', '/') -def emsdk_path(): - return to_unix_path(os.path.dirname(os.path.realpath(__file__))) - +EMSDK_PATH = to_unix_path(os.path.dirname(os.path.realpath(__file__))) EMSDK_SET_ENV = "" if POWERSHELL: - EMSDK_SET_ENV = os.path.join(emsdk_path(), 'emsdk_set_env.ps1') + EMSDK_SET_ENV = os.path.join(EMSDK_PATH, 'emsdk_set_env.ps1') else: - EMSDK_SET_ENV = os.path.join(emsdk_path(), 'emsdk_set_env.bat') + EMSDK_SET_ENV = os.path.join(EMSDK_PATH, 'emsdk_set_env.bat') # Parses https://github.com/emscripten-core/emscripten/tree/d6aced8 to a pair (https://github.com/emscripten-core/emscripten, d6aced8) @@ -486,7 +484,7 @@ def sdk_path(path): if os.path.isabs(path): return path - return to_unix_path(os.path.join(emsdk_path(), path)) + return to_unix_path(os.path.join(EMSDK_PATH, path)) # Removes a single file, suppressing exceptions on failure. @@ -1615,7 +1613,7 @@ def to_native_path(p): # Finds and returns a list of the directories that need to be added to PATH for # the given set of tools. def get_required_path(active_tools): - path_add = [to_native_path(emsdk_path())] + path_add = [to_native_path(EMSDK_PATH)] for tool in active_tools: if hasattr(tool, 'activated_path'): path = to_native_path(tool.expand_vars(tool.activated_path)) @@ -1625,11 +1623,8 @@ def get_required_path(active_tools): # Returns the absolute path to the file '.emscripten' for the current user on # this system. -def dot_emscripten_path(): - return os.path.join(emsdk_path(), ".emscripten") - - -dot_emscripten = {} +EM_CONFIG_PATH = os.path.join(EMSDK_PATH, ".emscripten") +EM_CONFIG_DICT = {} def parse_key_value(line): @@ -1644,23 +1639,23 @@ def parse_key_value(line): return (key, '') -def load_dot_emscripten(): - dot_emscripten.clear() +def load_em_config(): + EM_CONFIG_DICT.clear() lines = [] try: - lines = open(dot_emscripten_path(), "r").read().split('\n') + lines = open(EM_CONFIG_PATH, "r").read().split('\n') except: pass for line in lines: try: key, value = parse_key_value(line) if value != '': - dot_emscripten[key] = value + EM_CONFIG_DICT[key] = value except: pass -def generate_dot_emscripten(active_tools): +def generate_em_config(active_tools): cfg = 'import os\n' cfg += "emsdk_path = os.path.dirname(os.getenv('EM_CONFIG')).replace('\\\\', '/')\n" @@ -1685,17 +1680,17 @@ def generate_dot_emscripten(active_tools): JS_ENGINES = [NODE_JS] ''' - cfg = cfg.replace("'" + emsdk_path(), "emsdk_path + '") + cfg = cfg.replace("'" + EMSDK_PATH, "emsdk_path + '") - if os.path.exists(dot_emscripten_path()): - backup_path = dot_emscripten_path() + ".old" - move_with_overwrite(dot_emscripten_path(), backup_path) + if os.path.exists(EM_CONFIG_PATH): + backup_path = EM_CONFIG_PATH + ".old" + move_with_overwrite(EM_CONFIG_PATH, backup_path) - with open(dot_emscripten_path(), "w") as text_file: + with open(EM_CONFIG_PATH, "w") as text_file: text_file.write(cfg) # Clear old emscripten content. - rmfile(os.path.join(emsdk_path(), ".emscripten_sanity")) + rmfile(os.path.join(EMSDK_PATH, ".emscripten_sanity")) path_add = get_required_path(active_tools) if not WINDOWS: @@ -1927,16 +1922,16 @@ def is_active(self): return len(deps) > 0 for key, value in activated_cfg.items(): - if key not in dot_emscripten: + if key not in EM_CONFIG_DICT: debug_print(str(self) + ' is not active, because key="' + key + '" does not exist in .emscripten') return False # all paths are stored dynamically relative to the emsdk root, so # normalize those first. - dot_emscripten_key = dot_emscripten[key].replace("emsdk_path + '", "'" + emsdk_path()) - dot_emscripten_key = dot_emscripten_key.strip("'") - if dot_emscripten_key != value: - debug_print(str(self) + ' is not active, because key="' + key + '" has value "' + dot_emscripten_key + '" but should have value "' + value + '"') + config_value = EM_CONFIG_DICT[key].replace("emsdk_path + '", "'" + EMSDK_PATH) + config_value = config_value.strip("'") + if config_value != value: + debug_print(str(self) + ' is not active, because key="' + key + '" has value "' + config_value + '" but should have value "' + value + '"') return False return True @@ -2013,7 +2008,7 @@ def install_sdk(self): if getattr(self, 'custom_install_script', None) == 'emscripten_npm_install': # upstream tools have hardcoded paths that are not stored in emsdk_manifest.json registry install_path = 'upstream' if 'releases-upstream' in self.version else 'fastcomp' - emscripten_dir = os.path.join(emsdk_path(), install_path, 'emscripten') + emscripten_dir = os.path.join(EMSDK_PATH, install_path, 'emscripten') # Older versions of the sdk did not include the node_modules directory # and require `npm ci` to be run post-install if not os.path.exists(os.path.join(emscripten_dir, 'node_modules')): @@ -2278,14 +2273,14 @@ def python_2_3_sorted(arr, cmp): def is_emsdk_sourced_from_github(): - return os.path.exists(os.path.join(emsdk_path(), '.git')) + return os.path.exists(os.path.join(EMSDK_PATH, '.git')) def update_emsdk(): if is_emsdk_sourced_from_github(): errlog('You seem to have bootstrapped Emscripten SDK by cloning from GitHub. In this case, use "git pull" instead of "emsdk update" to update emsdk. (Not doing that automatically in case you have local changes)') sys.exit(1) - if not download_and_unzip(emsdk_zip_download_url, emsdk_path(), clobber=False): + if not download_and_unzip(emsdk_zip_download_url, EMSDK_PATH, clobber=False): sys.exit(1) @@ -2547,7 +2542,7 @@ def process_tool_list(tools_to_activate): def write_set_env_script(env_string): - assert(CMD or POWERSHELL) + assert CMD or POWERSHELL open(EMSDK_SET_ENV, 'w').write(env_string) @@ -2562,7 +2557,7 @@ def set_active_tools(tools_to_activate, permanently_activate, system): print('Setting the following tools as active:\n ' + '\n '.join(map(lambda x: str(x), tools))) print('') - generate_dot_emscripten(tools_to_activate) + generate_em_config(tools_to_activate) # Construct a .bat or .ps1 script that will be invoked to set env. vars and PATH # We only do this on cmd or powershell since emsdk.bat/ps1 is able to modify the @@ -2630,12 +2625,11 @@ def adjusted_path(tools_to_activate, system=False, user=False): existing_path = win_get_environment_variable('PATH', system=system, user=user, fallback=True).split(ENVPATH_SEPARATOR) else: existing_path = os.environ['PATH'].split(ENVPATH_SEPARATOR) - emsdk_root_path = to_unix_path(emsdk_path()) existing_emsdk_tools = [] existing_nonemsdk_path = [] for entry in existing_path: - if to_unix_path(entry).startswith(emsdk_root_path): + if to_unix_path(entry).startswith(EMSDK_PATH): existing_emsdk_tools.append(entry) else: existing_nonemsdk_path.append(entry) @@ -2678,7 +2672,7 @@ def get_env_vars_to_add(tools_to_activate, system, user): info('') # A core variable EMSDK points to the root of Emscripten SDK directory. - env_vars_to_add += [('EMSDK', to_unix_path(emsdk_path()))] + env_vars_to_add += [('EMSDK', EMSDK_PATH)] for tool in tools_to_activate: config = tool.activated_config() @@ -2706,7 +2700,7 @@ def get_env_vars_to_add(tools_to_activate, system, user): em_cache_dir = os.path.join(config['EMSCRIPTEN_ROOT'], 'cache') env_vars_to_add += [('EM_CACHE', em_cache_dir)] if version < [1, 39, 13]: - env_vars_to_add += [('EM_CONFIG', os.path.normpath(dot_emscripten_path()))] + env_vars_to_add += [('EM_CONFIG', os.path.normpath(EM_CONFIG_PATH))] envs = tool.activated_environment() for env in envs: @@ -3020,7 +3014,7 @@ def extract_string_arg(name): activating = cmd == 'activate' args = [expand_sdk_name(a, activating=activating) for a in args] - load_dot_emscripten() + load_em_config() load_sdk_manifest() # Apply any overrides to git branch names to clone from. From bd7842e4bacafcfe22a1f7b16424aea6b46b1eb1 Mon Sep 17 00:00:00 2001 From: Robbert van Ginkel <570934+robbertvanginkel@users.noreply.github.com> Date: Tue, 6 Dec 2022 18:22:11 -0500 Subject: [PATCH 39/50] Add standalone_wasm feature to bazel emscripten_toolchain (#1145) --- bazel/emscripten_toolchain/toolchain.bzl | 8 ++++++++ bazel/emscripten_toolchain/wasm_cc_binary.bzl | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/bazel/emscripten_toolchain/toolchain.bzl b/bazel/emscripten_toolchain/toolchain.bzl index 58d9b6db57..2bddd56ccf 100644 --- a/bazel/emscripten_toolchain/toolchain.bzl +++ b/bazel/emscripten_toolchain/toolchain.bzl @@ -441,6 +441,9 @@ def _impl(ctx): name = "output_format_js", enabled = True, ), + feature( + name = "wasm_standalone", + ), ] crosstool_default_flag_sets = [ @@ -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 = [ diff --git a/bazel/emscripten_toolchain/wasm_cc_binary.bzl b/bazel/emscripten_toolchain/wasm_cc_binary.bzl index c4b9c9d9ed..416ccae08b 100644 --- a/bazel/emscripten_toolchain/wasm_cc_binary.bzl +++ b/bazel/emscripten_toolchain/wasm_cc_binary.bzl @@ -25,6 +25,9 @@ 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", @@ -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", ), From 63a63e1664d4b656994606c6e334d1e11e4d9f10 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 9 Dec 2022 09:29:19 -0800 Subject: [PATCH 40/50] 3.1.28 (#1149) --- bazel/emscripten_deps.bzl | 1 - bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bazel/emscripten_deps.bzl b/bazel/emscripten_deps.bzl index 5068fe0c46..b1dae17b6a 100644 --- a/bazel/emscripten_deps.bzl +++ b/bazel/emscripten_deps.bzl @@ -52,7 +52,6 @@ filegroup( name = "linker_files", srcs = [ "bin/clang{bin_extension}", - "bin/llc{bin_extension}", "bin/llvm-ar{bin_extension}", "bin/llvm-nm{bin_extension}", "bin/llvm-objcopy{bin_extension}", diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index c67b63bc6f..1fb1656def 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.28": struct( + hash = "30b9e46ddcea66e91530559379089002d8b692cf", + sha_linux = "c23426d8b6d94cea702542c39e3bcef9439425dd4bd03bcc172e291dbbe5ed0d", + sha_mac = "4cfb918fe3233a2b31e5734e85b2a365e634f4e8a83c4390e8595cb98ae6bd8c", + sha_mac_arm64 = "a47f1f09bc7bbd4952cf54445d4fbfae53623ecbfecee0506a637665c7b4ea4c", + sha_win = "4388d230871d5b1e15c2fd0db21a792ab2836f23d860475fe183c03c5db75c8c", + ), "3.1.27": struct( hash = "48ce0b44015d0182fc8c27aa9fbc0a4474b55982", sha_linux = "4dc872260c8f42a8e20c8612b2255adbd466fec54cfbe37b46eca4eb34a2b03f", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index f970287d94..42cb0fb353 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.27", + "latest": "3.1.28", "latest-sdk": "latest", "latest-arm64-linux": "3.1.21", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.28": "30b9e46ddcea66e91530559379089002d8b692cf", + "3.1.28-asserts": "19871a9ea4914d63749b8d4d170e27a8854cb565", "3.1.27": "48ce0b44015d0182fc8c27aa9fbc0a4474b55982", "3.1.27-asserts": "630810e5a312f57d17efbe384ed7e4299f796bc1", "3.1.26": "4f68bb2a505c727bcf58195cf4da20592a6e92c8", From 5b80c10e5660ac799580ded0d7c5e1a5f253c65e Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 19 Dec 2022 18:39:40 -0800 Subject: [PATCH 41/50] Upgrade to rules_nodejs 5.8.0 (#1150) Fixes https://github.com/emscripten-core/emsdk/issues/1020 --- bazel/deps.bzl | 30 +++++++++++++++++++------- bazel/emscripten_toolchain/BUILD.bazel | 7 +----- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/bazel/deps.bzl b/bazel/deps.bzl index 6632665bca..337f0bafcd 100644 --- a/bazel/deps.bzl +++ b/bazel/deps.bzl @@ -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"], + ) diff --git a/bazel/emscripten_toolchain/BUILD.bazel b/bazel/emscripten_toolchain/BUILD.bazel index 4486220b56..7b3f16237f 100644 --- a/bazel/emscripten_toolchain/BUILD.bazel +++ b/bazel/emscripten_toolchain/BUILD.bazel @@ -2,18 +2,13 @@ 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", ], ) From 0b2084f40444818e4478a93009e2dd4426e14762 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Tue, 3 Jan 2023 10:24:53 -0800 Subject: [PATCH 42/50] 3.1.29 (#1160) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 1fb1656def..2e758dd482 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.29": struct( + hash = "d949f1b99a477d4b0b54d95413df3688afa69d0a", + sha_linux = "d3f274446924c27082603170fab60ba78a2fb51360e5578fab4d9b5adab0fa9a", + sha_mac = "ed224c296efd22437f298f0fe0852613b0b1d48810b1b6d87b6b7e6beb589fe2", + sha_mac_arm64 = "af9bb86a7996bbbb36820e93dbc7f537ac23070e8730439b1e49792c4fc008e9", + sha_win = "6203f80273565a2ee6734bd33ad7bc6940ef709cbd593e70d6489e96c02ced25", + ), "3.1.28": struct( hash = "30b9e46ddcea66e91530559379089002d8b692cf", sha_linux = "c23426d8b6d94cea702542c39e3bcef9439425dd4bd03bcc172e291dbbe5ed0d", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index 42cb0fb353..b8a85e95b0 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.28", + "latest": "3.1.29", "latest-sdk": "latest", "latest-arm64-linux": "3.1.21", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.29": "d949f1b99a477d4b0b54d95413df3688afa69d0a", + "3.1.29-asserts": "9d1e32e66e4b5921efc1a45cdc68e8c522c42c32", "3.1.28": "30b9e46ddcea66e91530559379089002d8b692cf", "3.1.28-asserts": "19871a9ea4914d63749b8d4d170e27a8854cb565", "3.1.27": "48ce0b44015d0182fc8c27aa9fbc0a4474b55982", From 9b87e80f3a0035173e89229ca374eb6f83bc6a3d Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 3 Jan 2023 16:01:18 -0800 Subject: [PATCH 43/50] Pin Windows CI to Bazel 5.4.0 (#1163) --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a5d7e20155..d8f0e7a5ca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -211,6 +211,7 @@ jobs: environment: PYTHONUNBUFFERED: "1" EMSDK_NOTTY: "1" + USE_BAZEL_VERSION: "5.4.0" steps: - checkout - run: From 58904e9b74cd74e618903aa25245c8d830528cfe Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 5 Jan 2023 09:17:17 -0800 Subject: [PATCH 44/50] Remove reference to fastcomp-latest. NFC (#1164) fastcomp can only be install using explicit versions names so this name doesn't work. --- emsdk.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/emsdk.py b/emsdk.py index df57423a4d..34d7d8832b 100644 --- a/emsdk.py +++ b/emsdk.py @@ -3070,13 +3070,11 @@ def installed_sdk_text(name): if (LINUX or MACOS or WINDOWS) and (ARCH == 'x86' or ARCH == 'x86_64'): print('The *recommended* precompiled SDK download is %s (%s).' % (find_latest_version(), find_latest_hash())) print() - print('To install/activate it, use one of:') - print(' latest [default (llvm) backend]') - print(' latest-fastcomp [legacy (fastcomp) backend]') + print('To install/activate it use:') + print(' latest') print('') - print('Those are equivalent to installing/activating the following:') + print('This is equivalent to installing/activating:') print(' %s %s' % (find_latest_version(), installed_sdk_text(find_latest_sdk('upstream')))) - print(' %s-fastcomp %s' % (find_latest_version(), installed_sdk_text(find_latest_sdk('fastcomp')))) print('') else: print('Warning: your platform does not have precompiled SDKs available.') From f3bb209b8623ade1abad5d1c1ae711159d0764ae Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 9 Jan 2023 04:53:13 -0800 Subject: [PATCH 45/50] 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. --- emsdk.py | 147 ++++----------------------- emsdk_manifest.json | 243 ++------------------------------------------ test/test.py | 34 ------- test/test.sh | 4 +- 4 files changed, 25 insertions(+), 403 deletions(-) diff --git a/emsdk.py b/emsdk.py index 34d7d8832b..b789ea5297 100644 --- a/emsdk.py +++ b/emsdk.py @@ -886,7 +886,7 @@ def exe_suffix(filename): # The directory where the binaries are produced. (relative to the installation # root directory of the tool) -def fastcomp_build_bin_dir(tool): +def llvm_build_bin_dir(tool): build_dir = llvm_build_dir(tool) if WINDOWS and 'Visual Studio' in CMAKE_GENERATOR: old_llvm_bin_dir = os.path.join(build_dir, 'bin', decide_cmake_build_type(tool)) @@ -1108,92 +1108,6 @@ def xcode_sdk_version(): return subprocess.checkplatform.mac_ver()[0].split('.') -def build_fastcomp(tool): - debug_print('build_fastcomp(' + str(tool) + ')') - fastcomp_root = tool.installation_path() - fastcomp_src_root = os.path.join(fastcomp_root, 'src') - # Does this tool want to be git cloned from github? - if hasattr(tool, 'git_branch'): - success = git_clone_checkout_and_pull(tool.download_url(), fastcomp_src_root, tool.git_branch) - if not success: - return False - if hasattr(tool, 'clang_url'): - clang_root = os.path.join(fastcomp_src_root, 'tools/clang') - success = git_clone_checkout_and_pull(tool.clang_url, clang_root, tool.git_branch) - if not success: - return False - if hasattr(tool, 'lld_url'): - lld_root = os.path.join(fastcomp_src_root, 'tools/lld') - success = git_clone_checkout_and_pull(tool.lld_url, lld_root, tool.git_branch) - if not success: - return False - else: - # Not a git cloned tool, so instead download from git tagged releases - success = download_and_unzip(tool.download_url(), fastcomp_src_root, filename_prefix='llvm-e') - if not success: - return False - success = download_and_unzip(tool.windows_clang_url if WINDOWS else tool.unix_clang_url, os.path.join(fastcomp_src_root, 'tools/clang'), filename_prefix='clang-e') - if not success: - return False - - args = [] - - cmake_generator = CMAKE_GENERATOR - if 'Visual Studio 16' in CMAKE_GENERATOR: # VS2019 - # With Visual Studio 16 2019, CMake changed the way they specify target arch. - # Instead of appending it into the CMake generator line, it is specified - # with a -A arch parameter. - args += ['-A', 'x64' if tool.bitness == 64 else 'x86'] - elif 'Visual Studio' in CMAKE_GENERATOR and tool.bitness == 64: - cmake_generator += ' Win64' - - build_dir = llvm_build_dir(tool) - build_root = os.path.join(fastcomp_root, build_dir) - - build_type = decide_cmake_build_type(tool) - - # Configure - tests_arg = 'ON' if BUILD_FOR_TESTING else 'OFF' - - enable_assertions = ENABLE_LLVM_ASSERTIONS.lower() == 'on' or (ENABLE_LLVM_ASSERTIONS == 'auto' and build_type.lower() != 'release' and build_type.lower() != 'minsizerel') - - only_supports_wasm = hasattr(tool, 'only_supports_wasm') - if ARCH == 'x86' or ARCH == 'x86_64': - targets_to_build = 'X86' - elif ARCH == 'arm': - targets_to_build = 'ARM' - elif ARCH == 'aarch64': - targets_to_build = 'AArch64' - else: - # May have problems with emconfigure - targets_to_build = '' - if not only_supports_wasm: - if targets_to_build != '': - targets_to_build += ';' - targets_to_build += 'JSBackend' - args += ['-DLLVM_TARGETS_TO_BUILD=' + targets_to_build, '-DLLVM_INCLUDE_EXAMPLES=OFF', '-DCLANG_INCLUDE_EXAMPLES=OFF', '-DLLVM_INCLUDE_TESTS=' + tests_arg, '-DCLANG_INCLUDE_TESTS=' + tests_arg, '-DLLVM_ENABLE_ASSERTIONS=' + ('ON' if enable_assertions else 'OFF')] - if os.getenv('LLVM_CMAKE_ARGS'): - extra_args = os.environ['LLVM_CMAKE_ARGS'].split(',') - print('Passing the following extra arguments to LLVM CMake configuration: ' + str(extra_args)) - args += extra_args - - # MacOS < 10.13 workaround for LLVM build bug https://github.com/kripken/emscripten/issues/5418: - # specify HAVE_FUTIMENS=0 in the build if building with target SDK that is older than 10.13. - if MACOS and ('HAVE_FUTIMENS' not in os.getenv('LLVM_CMAKE_ARGS', '')) and xcode_sdk_version() < ['10', '13']: - print('Passing -DHAVE_FUTIMENS=0 to LLVM CMake configure to workaround https://github.com/kripken/emscripten/issues/5418. Please update to macOS 10.13 or newer') - args += ['-DHAVE_FUTIMENS=0'] - - success = cmake_configure(cmake_generator, build_root, fastcomp_src_root, build_type, args) - if not success: - return False - - # Make - success = make_build(build_root, build_type, 'x64' if tool.bitness == 64 else 'Win32') - return success - - -# LLVM git source tree migrated to a single repository instead of multiple -# ones, build_llvm() builds via that repository structure def build_llvm(tool): debug_print('build_llvm(' + str(tool) + ')') llvm_root = tool.installation_path() @@ -1758,10 +1672,9 @@ def expand_vars(self, str): if '%generator_prefix%' in str: str = str.replace('%generator_prefix%', cmake_generator_prefix()) str = str.replace('%.exe%', '.exe' if WINDOWS else '') - if '%fastcomp_build_dir%' in str: - str = str.replace('%fastcomp_build_dir%', llvm_build_dir(self)) - if '%fastcomp_build_bin_dir%' in str: - str = str.replace('%fastcomp_build_bin_dir%', fastcomp_build_bin_dir(self)) + if '%llvm_build_bin_dir%' in str: + str = str.replace('%llvm_build_bin_dir%', llvm_build_bin_dir(self)) + return str # Return true if this tool requires building from source, and false if this is a precompiled tool. @@ -2007,7 +1920,7 @@ def install_sdk(self): if getattr(self, 'custom_install_script', None) == 'emscripten_npm_install': # upstream tools have hardcoded paths that are not stored in emsdk_manifest.json registry - install_path = 'upstream' if 'releases-upstream' in self.version else 'fastcomp' + install_path = 'upstream' emscripten_dir = os.path.join(EMSDK_PATH, install_path, 'emscripten') # Older versions of the sdk did not include the node_modules directory # and require `npm ci` to be run post-install @@ -2033,9 +1946,7 @@ def install_tool(self): print("Installing tool '" + str(self) + "'..") url = self.download_url() - if hasattr(self, 'custom_install_script') and self.custom_install_script == 'build_fastcomp': - success = build_fastcomp(self) - elif hasattr(self, 'custom_install_script') and self.custom_install_script == 'build_llvm': + if hasattr(self, 'custom_install_script') and self.custom_install_script == 'build_llvm': success = build_llvm(self) elif hasattr(self, 'custom_install_script') and self.custom_install_script == 'build_ninja': success = build_ninja(self) @@ -2056,8 +1967,8 @@ def install_tool(self): success = emscripten_post_install(self) elif self.custom_install_script == 'emscripten_npm_install': success = emscripten_npm_install(self, self.installation_path()) - elif self.custom_install_script in ('build_fastcomp', 'build_llvm', 'build_ninja', 'build_ccache'): - # 'build_fastcomp' is a special one that does the download on its + elif self.custom_install_script in ('build_llvm', 'build_ninja', 'build_ccache'): + # 'build_llvm' is a special one that does the download on its # own, others do the download manually. pass elif self.custom_install_script == 'build_binaryen': @@ -2344,25 +2255,22 @@ def get_installed_sdk_version(): # Get a list of tags for emscripten-releases. def load_releases_tags(): tags = [] - tags_fastcomp = [] info = load_releases_info() for version, sha in sorted(info['releases'].items(), key=lambda x: version_key(x[0])): tags.append(sha) - # Only include versions older than 1.39.0 in fastcomp releases - if version_key(version) < (2, 0, 0): - tags_fastcomp.append(sha) if extra_release_tag: tags.append(extra_release_tag) # Explicitly add the currently installed SDK version. This could be a custom - # version (installed explicitly) so it might not be part of the main list loaded above. + # version (installed explicitly) so it might not be part of the main list + # loaded above. installed = get_installed_sdk_version() if installed and installed not in tags: tags.append(installed) - return tags, tags_fastcomp + return tags def load_releases_versions(): @@ -2390,7 +2298,7 @@ def load_sdk_manifest(): llvm_precompiled_tags_64bit = load_file_index_list('llvm-tags-64bit.txt') llvm_precompiled_tags = llvm_precompiled_tags_32bit + llvm_precompiled_tags_64bit binaryen_tags = load_legacy_binaryen_tags() - releases_tags, releases_tags_fastcomp = load_releases_tags() + releases_tags = load_releases_tags() def dependencies_exist(sdk): for tool_name in sdk.uses: @@ -2474,8 +2382,6 @@ def expand_category_param(param, category_list, t, is_sdk): expand_category_param('%precompiled_tag64%', llvm_precompiled_tags_64bit, t, is_sdk=False) elif '%binaryen_tag%' in t.version: expand_category_param('%binaryen_tag%', binaryen_tags, t, is_sdk=False) - elif '%releases-tag%' in t.version and 'fastcomp' in t.version: - expand_category_param('%releases-tag%', releases_tags_fastcomp, t, is_sdk=False) elif '%releases-tag%' in t.version: expand_category_param('%releases-tag%', releases_tags, t, is_sdk=False) else: @@ -2496,8 +2402,6 @@ def expand_category_param(param, category_list, t, is_sdk): expand_category_param('%precompiled_tag32%', llvm_precompiled_tags_32bit, sdk, is_sdk=True) elif '%precompiled_tag64%' in sdk.version: expand_category_param('%precompiled_tag64%', llvm_precompiled_tags_64bit, sdk, is_sdk=True) - elif '%releases-tag%' in sdk.version and 'fastcomp' in sdk.version: - expand_category_param('%releases-tag%', releases_tags_fastcomp, sdk, is_sdk=True) elif '%releases-tag%' in sdk.version: expand_category_param('%releases-tag%', releases_tags, sdk, is_sdk=True) else: @@ -2780,16 +2684,12 @@ def error_on_missing_tool(name): exit_with_error("tool or SDK not found: '%s'" % name) -def exit_with_fastcomp_error(): - exit_with_error('the fastcomp backend is not getting new builds or releases. Please use the upstream llvm backend or use an older version than 2.0.0 (such as 1.40.1).') - - def expand_sdk_name(name, activating): if 'upstream-master' in name: errlog('upstream-master SDK has been renamed upstream-main') name = name.replace('upstream-master', 'upstream-main') - if name in ('latest-fastcomp', 'latest-releases-fastcomp', 'tot-fastcomp', 'sdk-nightly-latest'): - exit_with_fastcomp_error() + if 'fastcomp' in name: + exit_with_error('the fastcomp backend is no longer supported. Please use an older version of emsdk (for example 3.1.29) if you want to install the old fastcomp-based SDK') if name in ('tot', 'sdk-tot', 'tot-upstream'): if activating: # When we are activating a tot release, assume that the currently @@ -2806,37 +2706,24 @@ def expand_sdk_name(name, activating): # check if it's a release handled by an emscripten-releases version, # and if so use that by using the right hash. we support a few notations, - # x.y.z[-(upstream|fastcomp_]) - # sdk-x.y.z[-(upstream|fastcomp_])-64bit + # x.y.z[-upstream] + # sdk-x.y.z[-upstream]-64bit # TODO: support short notation for old builds too? - backend = None + backend = 'upstream' fullname = name if '-upstream' in fullname: fullname = name.replace('-upstream', '') - backend = 'upstream' - elif '-fastcomp' in fullname: - fullname = fullname.replace('-fastcomp', '') - backend = 'fastcomp' version = fullname.replace('sdk-', '').replace('releases-', '').replace('-64bit', '').replace('tag-', '') sdk = 'sdk-' if not name.startswith('releases-') else '' releases_info = load_releases_info()['releases'] release_hash = get_release_hash(version, releases_info) if release_hash: # Known release hash - if backend == 'fastcomp' and version_key(version) >= (2, 0, 0): - exit_with_fastcomp_error() - if backend is None: - if version_key(version) >= (1, 39, 0): - backend = 'upstream' - else: - backend = 'fastcomp' full_name = '%sreleases-%s-%s-64bit' % (sdk, backend, release_hash) print("Resolving SDK version '%s' to '%s'" % (version, full_name)) return full_name if len(version) == 40: - if backend is None: - backend = 'upstream' global extra_release_tag extra_release_tag = version return '%sreleases-%s-%s-64bit' % (sdk, backend, version) diff --git a/emsdk_manifest.json b/emsdk_manifest.json index 345b2f38e7..6649fb5cc4 100644 --- a/emsdk_manifest.json +++ b/emsdk_manifest.json @@ -9,9 +9,9 @@ "url": "https://github.com/llvm/llvm-project.git", "custom_install_script": "build_llvm", "only_supports_wasm": true, - "activated_path": "%installation_dir%/%fastcomp_build_bin_dir%", - "activated_cfg": "LLVM_ROOT='%installation_dir%/%fastcomp_build_bin_dir%'", - "activated_env": "LLVM_ROOT=%installation_dir%/%fastcomp_build_bin_dir%;EMCC_WASM_BACKEND=1", + "activated_path": "%installation_dir%/%llvm_build_bin_dir%", + "activated_cfg": "LLVM_ROOT='%installation_dir%/%llvm_build_bin_dir%'", + "activated_env": "LLVM_ROOT=%installation_dir%/%llvm_build_bin_dir%;EMCC_WASM_BACKEND=1", "cmake_build_type": "Release" }, { @@ -23,68 +23,9 @@ "url": "https://github.com/llvm/llvm-project.git", "custom_install_script": "build_llvm", "only_supports_wasm": true, - "activated_path": "%installation_dir%/%fastcomp_build_bin_dir%", - "activated_cfg": "LLVM_ROOT='%installation_dir%/%fastcomp_build_bin_dir%'", - "activated_env": "LLVM_ROOT=%installation_dir%/%fastcomp_build_bin_dir%;EMCC_WASM_BACKEND=1", - "cmake_build_type": "Release" - }, - - { - "id": "clang", - "version": "tag-e%tag%", - "bitness": 32, - "append_bitness": false, - "windows_url": "https://github.com/emscripten-core/emscripten-fastcomp/archive/%tag%.zip", - "unix_url": "https://github.com/emscripten-core/emscripten-fastcomp/archive/%tag%.tar.gz", - "windows_clang_url": "https://github.com/emscripten-core/emscripten-fastcomp-clang/archive/%tag%.zip", - "unix_clang_url": "https://github.com/emscripten-core/emscripten-fastcomp-clang/archive/%tag%.tar.gz", - "custom_install_script": "build_fastcomp", - "activated_path": "%installation_dir%/%fastcomp_build_bin_dir%", - "activated_cfg": "LLVM_ROOT='%installation_dir%/%fastcomp_build_bin_dir%'", - "activated_env": "LLVM_ROOT=%installation_dir%/%fastcomp_build_bin_dir%;EMCC_WASM_BACKEND=0", - "cmake_build_type": "Release" - }, - { - "id": "fastcomp-clang", - "version": "tag-e%tag%", - "bitness": 64, - "append_bitness": false, - "windows_url": "https://github.com/emscripten-core/emscripten-fastcomp/archive/%tag%.zip", - "unix_url": "https://github.com/emscripten-core/emscripten-fastcomp/archive/%tag%.tar.gz", - "windows_clang_url": "https://github.com/emscripten-core/emscripten-fastcomp-clang/archive/%tag%.zip", - "unix_clang_url": "https://github.com/emscripten-core/emscripten-fastcomp-clang/archive/%tag%.tar.gz", - "custom_install_script": "build_fastcomp", - "activated_path": "%installation_dir%/%fastcomp_build_bin_dir%", - "activated_cfg": "LLVM_ROOT='%installation_dir%/%fastcomp_build_bin_dir%'", - "activated_env": "LLVM_ROOT=%installation_dir%/%fastcomp_build_bin_dir%;EMCC_WASM_BACKEND=0", - "cmake_build_type": "Release" - }, - { - "id": "fastcomp-clang", - "version": "master", - "bitness": 32, - "install_path": "clang/fastcomp", - "url": "https://github.com/emscripten-core/emscripten-fastcomp.git", - "clang_url": "https://github.com/emscripten-core/emscripten-fastcomp-clang.git", - "git_branch": "master", - "custom_install_script": "build_fastcomp", - "activated_path": "%installation_dir%/%fastcomp_build_bin_dir%", - "activated_cfg": "LLVM_ROOT='%installation_dir%/%fastcomp_build_bin_dir%'", - "activated_env": "LLVM_ROOT=%installation_dir%/%fastcomp_build_bin_dir%;EMCC_WASM_BACKEND=0", - "cmake_build_type": "Release" - }, - { - "id": "fastcomp-clang", - "version": "master", - "bitness": 64, - "install_path": "clang/fastcomp", - "git_branch": "master", - "url": "https://github.com/emscripten-core/emscripten-fastcomp.git", - "clang_url": "https://github.com/emscripten-core/emscripten-fastcomp-clang.git", - "custom_install_script": "build_fastcomp", - "activated_path": "%installation_dir%/%fastcomp_build_bin_dir%", - "activated_cfg": "LLVM_ROOT='%installation_dir%/%fastcomp_build_bin_dir%'", - "activated_env": "LLVM_ROOT=%installation_dir%/%fastcomp_build_bin_dir%;EMCC_WASM_BACKEND=0", + "activated_path": "%installation_dir%/%llvm_build_bin_dir%", + "activated_cfg": "LLVM_ROOT='%installation_dir%/%llvm_build_bin_dir%'", + "activated_env": "LLVM_ROOT=%installation_dir%/%llvm_build_bin_dir%;EMCC_WASM_BACKEND=1", "cmake_build_type": "Release" }, @@ -115,57 +56,7 @@ "activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten'", "emscripten_releases_hash": "%releases-tag%" }, - { - "id": "releases", - "version": "fastcomp-%releases-tag%", - "bitness": 64, - "arch": "x86_64", - "linux_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/%releases-tag%/wasm-binaries.tbz2", - "macos_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/%releases-tag%/wasm-binaries.tbz2", - "windows_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/win/%releases-tag%/wasm-binaries.zip", - "zipfile_prefix": "%releases-tag%-", - "install_path": "fastcomp", - "activated_path": "%installation_dir%/emscripten", - "activated_cfg": "LLVM_ROOT='%installation_dir%/fastcomp/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten';EMSCRIPTEN_NATIVE_OPTIMIZER='%installation_dir%/bin/optimizer%.exe%'", - "emscripten_releases_hash": "%releases-tag%" - }, - { - "id": "releases", - "version": "fastcomp-%releases-tag%", - "bitness": 64, - "arch": "aarch64", - "macos_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/%releases-tag%/wasm-binaries.tbz2", - "zipfile_prefix": "%releases-tag%-", - "install_path": "fastcomp", - "activated_path": "%installation_dir%/emscripten", - "activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten'", - "emscripten_releases_hash": "%releases-tag%" - }, - { - "id": "clang", - "version": "e%precompiled_tag32%", - "bitness": 32, - "arch": "x86", - "windows_url": "llvm/tag/win_64bit/emscripten-llvm-e%precompiled_tag32%.zip", - "macos_url": "llvm/tag/osx_64bit/emscripten-llvm-e%precompiled_tag32%.tar.gz", - "linux_url": "llvm/tag/linux_64bit/emscripten-llvm-e%precompiled_tag32%.tar.gz", - "activated_path": "%installation_dir%", - "activated_cfg": "LLVM_ROOT='%installation_dir%';EMSCRIPTEN_NATIVE_OPTIMIZER='%installation_dir%/optimizer%.exe%';BINARYEN_ROOT='%installation_dir%/binaryen'", - "activated_env": "LLVM_ROOT=%installation_dir%;EMSCRIPTEN_NATIVE_OPTIMIZER=%installation_dir%/optimizer%.exe%;BINARYEN_ROOT=%installation_dir%/binaryen;EMCC_WASM_BACKEND=0" - }, - { - "id": "fastcomp-clang", - "version": "e%precompiled_tag64%", - "bitness": 64, - "arch": "x86_64", - "windows_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/old/win/emscripten-llvm-e%precompiled_tag64%.zip", - "macos_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/old/mac/emscripten-llvm-e%precompiled_tag64%.tar.gz", - "linux_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/old/linux/emscripten-llvm-e%precompiled_tag64%.tar.gz", - "activated_path": "%installation_dir%", - "activated_cfg": "LLVM_ROOT='%installation_dir%';EMSCRIPTEN_NATIVE_OPTIMIZER='%installation_dir%/optimizer%.exe%';BINARYEN_ROOT='%installation_dir%/binaryen'", - "activated_env": "LLVM_ROOT=%installation_dir%;EMSCRIPTEN_NATIVE_OPTIMIZER=%installation_dir%/optimizer%.exe%;BINARYEN_ROOT=%installation_dir%/binaryen;EMCC_WASM_BACKEND=0" - }, { "id": "node", "version": "8.9.1", @@ -675,42 +566,6 @@ "uses": ["llvm-git-main-32bit", "emscripten-main-32bit", "binaryen-main-32bit"], "os": "linux" }, - { - "version": "fastcomp-tag-%tag%", - "bitness": 32, - "uses": ["fastcomp-clang-tag-e%tag%-32bit", "node-8.9.1-32bit", "python-2.7.13.1-32bit", "java-8.152-32bit", "emscripten-tag-%tag%-32bit", "binaryen-tag-%tag%-32bit"], - "os": "win", - "version_filter": [ - ["%tag%", ">", "1.37.22"] - ] - }, - { - "version": "fastcomp-tag-%tag%", - "bitness": 64, - "uses": ["fastcomp-clang-tag-e%tag%-64bit", "node-8.9.1-64bit", "python-2.7.13.1-64bit", "java-8.152-64bit", "emscripten-tag-%tag%-64bit", "binaryen-tag-%tag%-64bit"], - "os": "win", - "version_filter": [ - ["%tag%", ">", "1.37.22"] - ] - }, - { - "version": "fastcomp-tag-%tag%", - "bitness": 32, - "uses": ["fastcomp-clang-tag-e%tag%-32bit", "node-8.9.1-32bit", "emscripten-tag-%tag%-32bit", "binaryen-tag-%tag%-32bit"], - "os": "linux", - "version_filter": [ - ["%tag%", ">", "1.37.22"] - ] - }, - { - "version": "fastcomp-tag-%tag%", - "bitness": 64, - "uses": ["fastcomp-clang-tag-e%tag%-64bit", "node-8.9.1-64bit", "emscripten-tag-%tag%-64bit", "binaryen-tag-%tag%-64bit"], - "os": "unix", - "version_filter": [ - ["%tag%", ">", "1.37.22"] - ] - }, { "version": "releases-upstream-%releases-tag%", "bitness": 64, @@ -740,92 +595,6 @@ "uses": ["node-14.18.2-64bit", "python-3.9.2-nuget-64bit", "java-8.152-64bit", "releases-upstream-%releases-tag%-64bit"], "os": "win", "custom_install_script": "emscripten_npm_install" - }, - { - "version": "releases-fastcomp-%releases-tag%", - "bitness": 64, - "uses": ["node-14.18.2-64bit", "releases-fastcomp-%releases-tag%-64bit"], - "os": "linux", - "custom_install_script": "emscripten_npm_install" - }, - { - "version": "releases-fastcomp-%releases-tag%", - "bitness": 64, - "uses": ["node-14.18.2-64bit", "python-3.7.4-2-64bit", "releases-fastcomp-%releases-tag%-64bit"], - "os": "macos", - "arch": "x86_64", - "custom_install_script": "emscripten_npm_install" - }, - { - "version": "releases-fastcomp-%releases-tag%", - "bitness": 64, - "uses": ["node-14.18.2-64bit", "python-3.9.2-64bit", "releases-fastcomp-%releases-tag%-64bit"], - "os": "macos", - "arch": "aarch64", - "custom_install_script": "emscripten_npm_install" - }, - { - "version": "releases-fastcomp-%releases-tag%", - "bitness": 64, - "uses": ["node-14.18.2-64bit", "python-3.7.4-pywin32-64bit", "java-8.152-64bit", "releases-fastcomp-%releases-tag%-64bit"], - "os": "win", - "custom_install_script": "emscripten_npm_install" - }, - { - "version": "fastcomp-%precompiled_tag32%", - "bitness": 32, - "uses": ["fastcomp-clang-e%precompiled_tag32%-32bit", "node-8.9.1-32bit", "python-2.7.13.1-32bit", "java-8.152-32bit", "emscripten-%precompiled_tag32%"], - "os": "win", - "version_filter": [ - ["%precompiled_tag32%", ">", "1.37.22"] - ] - }, - { - "version": "fastcomp-%precompiled_tag64%", - "bitness": 64, - "uses": ["fastcomp-clang-e%precompiled_tag64%-64bit", "node-8.9.1-64bit", "python-2.7.13.1-64bit", "java-8.152-64bit", "emscripten-%precompiled_tag64%"], - "os": "win", - "version_filter": [ - ["%precompiled_tag64%", ">", "1.37.22"] - ] - }, - { - "version": "fastcomp-%precompiled_tag32%", - "bitness": 32, - "uses": ["fastcomp-clang-e%precompiled_tag32%-32bit", "node-8.9.1-32bit", "emscripten-%precompiled_tag32%"], - "os": "linux", - "version_filter": [ - ["%precompiled_tag32%", ">", "1.37.22"] - ] - }, - { - "version": "fastcomp-%precompiled_tag64%", - "bitness": 64, - "uses": ["fastcomp-clang-e%precompiled_tag64%-64bit", "node-8.9.1-64bit", "emscripten-%precompiled_tag64%"], - "os": "linux", - "version_filter": [ - ["%precompiled_tag64%", ">", "1.37.22"] - ] - }, - { - "version": "fastcomp-%precompiled_tag32%", - "bitness": 32, - "uses": ["fastcomp-clang-e%precompiled_tag32%-32bit", "node-8.9.1-32bit", "python-3.7.4-2-64bit", "emscripten-%precompiled_tag32%"], - "os": "macos", - "arch": "x86_64", - "version_filter": [ - ["%precompiled_tag32%", ">", "1.37.22"] - ] - }, - { - "version": "fastcomp-%precompiled_tag64%", - "bitness": 64, - "uses": ["fastcomp-clang-e%precompiled_tag64%-64bit", "node-8.9.1-64bit", "python-3.7.4-2-64bit", "emscripten-%precompiled_tag64%"], - "os": "macos", - "arch": "x86_64", - "version_filter": [ - ["%precompiled_tag64%", ">", "1.37.22"] - ] } ] } diff --git a/test/test.py b/test/test.py index f9766d0c22..1f633a132e 100755 --- a/test/test.py +++ b/test/test.py @@ -14,11 +14,9 @@ assert os.path.exists(emconfig) upstream_emcc = os.path.join('upstream', 'emscripten', 'emcc') -fastcomp_emcc = os.path.join('fastcomp', 'emscripten', 'emcc') emsdk = './emsdk' if WINDOWS: upstream_emcc += '.bat' - fastcomp_emcc += '.bat' emsdk = 'emsdk.bat' else: emsdk = './emsdk' @@ -164,35 +162,12 @@ def test_config_contents(self): print('test .emscripten contents') with open(emconfig) as f: config = f.read() - assert 'fastcomp' not in config assert 'upstream' in config def test_lib_building(self): print('building proper system libraries') do_lib_building(upstream_emcc) - def test_fastcomp(self): - print('test the last fastcomp release') - run_emsdk('install 1.40.1-fastcomp') - run_emsdk('activate 1.40.1-fastcomp') - - do_lib_building(fastcomp_emcc) - with open(emconfig) as f: - config = f.read() - assert config.count('LLVM_ROOT') == 1 - assert 'upstream' not in config - assert 'fastcomp' in config - - print('verify latest fastcomp version is fixed at 1.40.1') - checked_call_with_output(fastcomp_emcc + ' -v', '1.40.1', stderr=subprocess.STDOUT) - - def test_fastcomp_missing(self): - print('verify that attempting to use newer fastcomp gives an error') - fastcomp_error = 'the fastcomp backend is not getting new builds or releases. Please use the upstream llvm backend or use an older version than 2.0.0 (such as 1.40.1).' - failing_call_with_output(emsdk + ' install latest-fastcomp', fastcomp_error) - failing_call_with_output(emsdk + ' install tot-fastcomp', fastcomp_error) - failing_call_with_output(emsdk + ' install 2.0.0-fastcomp', fastcomp_error) - def test_redownload(self): print('go back to using upstream') run_emsdk('activate latest') @@ -221,21 +196,12 @@ def test_closure(self): # Specificlly test with `--closure` so we know that node_modules is working check_call(upstream_emcc + ' hello_world.c --closure=1') - def test_specific_old(self): - print('test specific release (old, using sdk-* notation)') - run_emsdk('install sdk-fastcomp-1.38.31-64bit') - run_emsdk('activate sdk-fastcomp-1.38.31-64bit') - def test_specific_version(self): print('test specific release (new, short name)') run_emsdk('install 1.38.33') print('another install, but no need for re-download') checked_call_with_output(emsdk + ' install 1.38.33', expected='Skipped', unexpected='Downloading:') run_emsdk('activate 1.38.33') - with open(emconfig) as f: - config = f.read() - assert 'upstream' not in config - assert 'fastcomp' in config def test_specific_version_full(self): print('test specific release (new, full name)') diff --git a/test/test.sh b/test/test.sh index 9d8171e79b..4ea91a3431 100755 --- a/test/test.sh +++ b/test/test.sh @@ -15,8 +15,8 @@ emcc -v # Install an older version of the SDK that requires EM_CACHE to be # set in the environment, so that we can test it is later removed -./emsdk install sdk-fastcomp-3b8cff670e9233a6623563add831647e8689a86b -./emsdk activate sdk-fastcomp-3b8cff670e9233a6623563add831647e8689a86b +./emsdk install sdk-1.39.15 +./emsdk activate sdk-1.39.15 source ./emsdk_env.sh which emcc emcc -v From 91f8563a9d1a4a0ec03bbb2be23485367d85a091 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 11 Jan 2023 16:38:04 -0800 Subject: [PATCH 46/50] 3.1.30 (#1167) --- bazel/revisions.bzl | 7 +++++++ emscripten-releases-tags.json | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index 2e758dd482..e55a49582b 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,13 @@ # DO NOT MODIFY EMSCRIPTEN_TAGS = { + "3.1.30": struct( + hash = "dc1fdcfd3f5b9d29cb1ebdf15e6e845bef9b0cc1", + sha_linux = "151d7afdfb728e1e55ed1d100e4d3fbd20925fd65f3c3b9e093061a2c89dcac7", + sha_mac = "f0cdbc676c58bce7a65572418fb1521665ed522d7d05ae90f0764b77801982bb", + sha_mac_arm64 = "fca4eaf8ff528bb9308e5e8d0cf2709713b99fc19d55c6578a6c8f3e66182f55", + sha_win = "3001101622d98b2af3e5209154f60bbe341d32f6178307c6c723e84b5fe08bdc", + ), "3.1.29": struct( hash = "d949f1b99a477d4b0b54d95413df3688afa69d0a", sha_linux = "d3f274446924c27082603170fab60ba78a2fb51360e5578fab4d9b5adab0fa9a", diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index b8a85e95b0..be06c022f5 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,6 +1,6 @@ { "aliases": { - "latest": "3.1.29", + "latest": "3.1.30", "latest-sdk": "latest", "latest-arm64-linux": "3.1.21", "latest-64bit": "latest", @@ -10,6 +10,8 @@ "latest-releases-upstream": "latest" }, "releases": { + "3.1.30": "dc1fdcfd3f5b9d29cb1ebdf15e6e845bef9b0cc1", + "3.1.30-asserts": "21cca44e843267533c3d0b258b46c37bd142a2d7", "3.1.29": "d949f1b99a477d4b0b54d95413df3688afa69d0a", "3.1.29-asserts": "9d1e32e66e4b5921efc1a45cdc68e8c522c42c32", "3.1.28": "30b9e46ddcea66e91530559379089002d8b692cf", From e309d9fa3f2d05db5d3e77ef7fe76e4e24fe4693 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 30 Jan 2023 17:19:58 +0100 Subject: [PATCH 47/50] Bump emscripten to 3.1.30 --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 0b114f1f0d..eb3520d136 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -6,7 +6,7 @@ 8.0.0 preview 2 - 3.1.12 + 3.1.30 2.0.23 3.1.12 7.0.2 From 29a3cb125263d6c6647f48a9bbe002ef4e87980b Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 30 Jan 2023 17:33:16 +0100 Subject: [PATCH 48/50] Bump clang version --- eng/emsdk.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/emsdk.proj b/eng/emsdk.proj index 8e4c2217f5..a96030d9c8 100644 --- a/eng/emsdk.proj +++ b/eng/emsdk.proj @@ -43,7 +43,7 @@ Command="$(PythonFileName) eng/sanitize.py $(RepoRoot)" /> + Condition="!Exists('$(UpstreamDirectory)\bin\clang-16') and !$([MSBuild]::IsOSPlatform(Windows))" /> Date: Mon, 30 Jan 2023 18:26:03 +0100 Subject: [PATCH 49/50] Do not include test directory --- eng/emsdk.proj | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/emsdk.proj b/eng/emsdk.proj index a96030d9c8..61af1c7d5d 100644 --- a/eng/emsdk.proj +++ b/eng/emsdk.proj @@ -87,6 +87,7 @@ Overwrite="true" /> + From 09b27bcdf4b8f928240fa7302dc225f1fd465f24 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 30 Jan 2023 18:31:51 +0100 Subject: [PATCH 50/50] Update eng/emsdk.proj MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Köplinger --- eng/emsdk.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/emsdk.proj b/eng/emsdk.proj index 61af1c7d5d..42b29f449d 100644 --- a/eng/emsdk.proj +++ b/eng/emsdk.proj @@ -41,7 +41,7 @@ - +