diff --git a/.circleci/config.yml b/.circleci/config.yml index 71292f78d2..d8f0e7a5ca 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 @@ -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 @@ -193,7 +191,7 @@ jobs: test-bazel-mac: macos: - xcode: "12.2.0" + xcode: "12.5.1" environment: EMSDK_NOTTY: "1" HOMEBREW_NO_AUTO_UPDATE: "1" @@ -213,6 +211,7 @@ jobs: environment: PYTHONUNBUFFERED: "1" EMSDK_NOTTY: "1" + USE_BAZEL_VERSION: "5.4.0" steps: - checkout - run: 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/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_deps.bzl b/bazel/emscripten_deps.bzl index 01baa01351..b1dae17b6a 100644 --- a/bazel/emscripten_deps.bzl +++ b/bazel/emscripten_deps.bzl @@ -14,16 +14,36 @@ filegroup( "emscripten/cache/sysroot/include/c++/v1/**", "emscripten/cache/sysroot/include/compat/**", "emscripten/cache/sysroot/include/**", - "lib/clang/15.0.0/include/**", + "lib/clang/16/include/**", ]), ) filegroup( - name = "compiler_files", + name = "emcc_common", srcs = [ "emscripten/emcc.py", + "emscripten/emscripten.py", + "emscripten/emscripten-version.txt", + "emscripten/cache/sysroot_install.stamp", + "emscripten/src/settings.js", + "emscripten/src/settings_internal.js", + ] + glob( + include = [ + "emscripten/third_party/**", + "emscripten/tools/**", + ], + exclude = [ + "**/__pycache__/**", + ], + ), +) + +filegroup( + name = "compiler_files", + srcs = [ "bin/clang{bin_extension}", "bin/clang++{bin_extension}", + ":emcc_common", ":includes", ], ) @@ -31,24 +51,40 @@ filegroup( filegroup( name = "linker_files", srcs = [ - "emscripten/emcc.py", "bin/clang{bin_extension}", - "bin/llc{bin_extension}", "bin/llvm-ar{bin_extension}", "bin/llvm-nm{bin_extension}", "bin/llvm-objcopy{bin_extension}", "bin/wasm-emscripten-finalize{bin_extension}", "bin/wasm-ld{bin_extension}", "bin/wasm-opt{bin_extension}", - ] + glob(["emscripten/node_modules/**"]), + "bin/wasm-metadce{bin_extension}", + ":emcc_common", + ] + glob( + include = [ + "emscripten/cache/sysroot/lib/**", + "emscripten/node_modules/**", + "emscripten/src/**", + ], + ), ) filegroup( name = "ar_files", srcs = [ - "emscripten/emar.py", "bin/llvm-ar{bin_extension}", - ], + "emscripten/emar.py", + "emscripten/emscripten-version.txt", + "emscripten/src/settings.js", + "emscripten/src/settings_internal.js", + ] + glob( + include = [ + "emscripten/tools/**", + ], + exclude = [ + "**/__pycache__/**", + ], + ), ) """ diff --git a/bazel/emscripten_toolchain/BUILD.bazel b/bazel/emscripten_toolchain/BUILD.bazel index d101c67061..7b3f16237f 100644 --- a/bazel/emscripten_toolchain/BUILD.bazel +++ b/bazel/emscripten_toolchain/BUILD.bazel @@ -1,19 +1,14 @@ -load(":crosstool.bzl", "emscripten_cc_toolchain_config_rule") +load(":toolchain.bzl", "emscripten_cc_toolchain_config_rule") package(default_visibility = ["//visibility:public"]) -# Name depends on rules_nodejs version being used. -# https://github.com/emscripten-core/emsdk/issues/1020 -# https://github.com/bazelbuild/rules_nodejs/issues/3375 -node_files = "@nodejs_host//:node_files" if existing_rule("@nodejs_host//:node_files") else "@nodejs//:node_files" - filegroup( name = "common_files", srcs = [ "emscripten_config", "env.sh", "env.bat", - node_files, + "@nodejs//:node_files", ], ) @@ -86,6 +81,13 @@ cc_toolchain_suite( }, ) +toolchain( + name = "cc-toolchain-wasm", + target_compatible_with = ["@platforms//cpu:wasm32"], + toolchain = ":cc-compiler-wasm", + toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", +) + py_binary( name = "wasm_binary", srcs = ["wasm_binary.py"], diff --git a/bazel/emscripten_toolchain/crosstool.bzl b/bazel/emscripten_toolchain/toolchain.bzl similarity index 98% rename from bazel/emscripten_toolchain/crosstool.bzl rename to bazel/emscripten_toolchain/toolchain.bzl index a275cc0e8e..2bddd56ccf 100644 --- a/bazel/emscripten_toolchain/crosstool.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 = [ @@ -911,7 +914,7 @@ def _impl(ctx): "-iwithsysroot" + "/include/compat", "-iwithsysroot" + "/include", "-isystem", - emscripten_dir + "/lib/clang/15.0.0/include", + emscripten_dir + "/lib/clang/16/include", ], ), # Inputs and outputs @@ -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 = [ @@ -1073,7 +1081,7 @@ def _impl(ctx): emscripten_dir + "/emscripten/cache/sysroot/include/c++/v1", emscripten_dir + "/emscripten/cache/sysroot/include/compat", emscripten_dir + "/emscripten/cache/sysroot/include", - emscripten_dir + "/lib/clang/15.0.0/include", + emscripten_dir + "/lib/clang/16/include", ] artifact_name_patterns = [] @@ -1105,7 +1113,7 @@ emscripten_cc_toolchain_config_rule = rule( attrs = { "cpu": attr.string(mandatory = True, values = ["asmjs", "wasm"]), "em_config": attr.label(mandatory = True, allow_single_file = True), - "emscripten_binaries": attr.label(mandatory = True), + "emscripten_binaries": attr.label(mandatory = True, cfg = "exec"), "script_extension": attr.string(mandatory = True, values = ["sh", "bat"]), }, provides = [CcToolchainConfigInfo], diff --git a/bazel/emscripten_toolchain/wasm_cc_binary.bzl b/bazel/emscripten_toolchain/wasm_cc_binary.bzl index 9cf6328aff..c1aab75a33 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", @@ -32,7 +35,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", } @@ -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", ), @@ -163,7 +169,10 @@ def _wasm_cc_binary_legacy_impl(ctx): ) _wasm_cc_binary = rule( +<<<<<<< HEAD name = "wasm_cc_binary", +======= +>>>>>>> 3.1.30 implementation = _wasm_cc_binary_impl, attrs = dict( _WASM_BINARY_COMMON_ATTRS, @@ -193,7 +202,10 @@ def _wasm_binary_legacy_outputs(name, cc_target): return outputs _wasm_cc_binary_legacy = rule( +<<<<<<< HEAD name = "wasm_cc_binary", +======= +>>>>>>> 3.1.30 implementation = _wasm_cc_binary_legacy_impl, attrs = _WASM_BINARY_COMMON_ATTRS, outputs = _wasm_binary_legacy_outputs, diff --git a/bazel/revisions.bzl b/bazel/revisions.bzl index f3505bbedd..e55a49582b 100644 --- a/bazel/revisions.bzl +++ b/bazel/revisions.bzl @@ -2,6 +2,132 @@ # 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", + sha_mac = "ed224c296efd22437f298f0fe0852613b0b1d48810b1b6d87b6b7e6beb589fe2", + sha_mac_arm64 = "af9bb86a7996bbbb36820e93dbc7f537ac23070e8730439b1e49792c4fc008e9", + sha_win = "6203f80273565a2ee6734bd33ad7bc6940ef709cbd593e70d6489e96c02ced25", + ), + "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", + sha_mac = "40c3326147b162b8357efdc72476faaa6686338cff3e176680e361c2511453e8", + sha_mac_arm64 = "7b87610de966b84353c8c1ded8e12c034b5b913c093210ebd3b26320e2ac2990", + sha_win = "39bbfcb09ba7feb214518a67b1ff6d38bae065b416b4483834e4fdaef2316f8c", + ), + "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", + sha_mac = "d2581aaa7207f0d9dd9949247f0706bda8561e805d67aec166ed4f3b39c3a3fa", + sha_mac_arm64 = "dbcb76036a09248c2a839872c27b87b6d4ccc81e57add4e2a6f5e560a2c530fc", + sha_win = "3a86d98d934456a74ed06388c1487d95a0d5a3f31777636453f22e61d57d7fb1", + ), + "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", + sha_mac = "fd1c79475e47fd2f06ee9ba189e68309e443c2d3c56fd28163d1cd6f77047075", + sha_mac_arm64 = "66e57ee0962ec31056674b5681f91bd62f85b0bf1238a8d5b160660c0bf47292", + sha_win = "7c30b281abcc0ffb9e7575197f1ac0598a94c6cec36547b81554a97b792a9e75", + ), + "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", + sha_mac = "2a8d3d3ad721fec81ca1a4a581e4183b6e732e9905beb874531851846a05a367", + sha_mac_arm64 = "cf788a7bdc38bb40d01f94b2d46acafb0e2f02d8ee3b3d69541c114e467ee37f", + sha_win = "81518bba13f41717ffe6990b6d4a5af635d0c9d0f71a8d3bc0980cd0bc8f5f66", + ), + "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", + sha_mac = "6adb721340cb93b7a3efafbfd1d283842a39bb6f1390630b0806c8af26b66840", + sha_mac_arm64 = "429c9e3a79d32380f3dfee52b1001963edaa2e3035fce9f52ca87b08e1a2f26e", + sha_win = "0368eefb28f42799ce897020d0d10a4a27e1b69b650575d94deb268e402a3632", + ), + "3.1.18": struct( + hash = "49d45744895c7d7e28acd94a385d7ee361653b4a", + sha_linux = "6ef373c4ff3cdf33d7beecea47d4eaee7795693f8ca9469f33785cb9c54f40bb", + sha_mac = "ad0e645abdb6d3f0b6c6ad0ee70761010a712949c9b0b193aefc78ecbc3f1710", + sha_mac_arm64 = "68d0a1ec3e83e0415e24133c59e64206b83686712434c8c2e6792547cf654b1c", + sha_win = "96829a228f7c08fabd37833f7361614785aa39aa865beef06890ee8ede58dc66", + ), + "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", + sha_mac = "d05f4e997324d7f7d8561436677687d296893d6414f53930184fab272e4c6158", + sha_mac_arm64 = "36ab8da30698558a567c5c1c0e130b59f08cf4b29c9c5242f4ea60b449ecff17", + sha_win = "e1324c22c914ab7f62fe6d38a550de25b2232a723c80393fa8884a260c07766d", + ), + "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", + sha_mac = "567e9548f3fa7c1aa717821af4aaa7849a0f7217cb55eb7f66a06c898808fd96", + sha_mac_arm64 = "df8319aba8bc0d0c40ebec3c8f45e507c2a51a57df24826d4cab6f6cd75017ac", + sha_win = "6bfec6bf6a01e483a57e91f7223340a425f6ff711cbd32a08ed78002810d7882", + ), + "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/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"))) diff --git a/emscripten-releases-tags.json b/emscripten-releases-tags.json index e5f0140562..be06c022f5 100644 --- a/emscripten-releases-tags.json +++ b/emscripten-releases-tags.json @@ -1,7 +1,8 @@ { "aliases": { - "latest": "3.1.12", + "latest": "3.1.30", "latest-sdk": "latest", + "latest-arm64-linux": "3.1.21", "latest-64bit": "latest", "sdk-latest-64bit": "latest", "latest-upstream": "latest", @@ -9,6 +10,42 @@ "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", + "3.1.28-asserts": "19871a9ea4914d63749b8d4d170e27a8854cb565", + "3.1.27": "48ce0b44015d0182fc8c27aa9fbc0a4474b55982", + "3.1.27-asserts": "630810e5a312f57d17efbe384ed7e4299f796bc1", + "3.1.26": "4f68bb2a505c727bcf58195cf4da20592a6e92c8", + "3.1.26-asserts": "4e2ffe94b04dbadfbca1687ab458d306b3414d13", + "3.1.25": "ff6babb041d0f31575cc16d15ef82c6222ca99b8", + "3.1.25-asserts": "6b19d6a8c30d7b83ba2193625fc12cce9ae0206b", + "3.1.24": "54217a0950bb1dafe8808cc6207d378e323f9d74", + "3.1.24-asserts": "4c20c7393ca208c740c16a97dbf305ba52fea2bb", + "3.1.23": "bfd5e63a44ba4c8568cd8ac87c27b35e40732bf4", + "3.1.23-asserts": "77d2c744fe37fe0e22a51329fa23bab4b8ffa656", + "3.1.22": "990cee04a21caafc75955d736fb45791a7f2aeee", + "3.1.22-asserts": "d94fe69a037e93562d0bbe9d0372ce23f4ab1089", + "3.1.21": "a16a8bca2466eb144f7c93fa899c0272c8815dc3", + "3.1.21-asserts": "c7a387161b029621eb4d3dd57363b1393b4c50b2", + "3.1.20": "d92c8639f406582d70a5dde27855f74ecf602f45", + "3.1.20-asserts": "db0fd1cb7316675317d527b6ed4f4cc7005df9ec", + "3.1.19": "4c3772879a04140298c3abde90962d5567b5e2fc", + "3.1.19-asserts": "83c2ba526ec47139d29e1417ac23d15b37ead98a", + "3.1.18": "49d45744895c7d7e28acd94a385d7ee361653b4a", + "3.1.18-asserts": "cb7fa1dce4b04e35b78ec43499a7759f24c1e64d", + "3.1.17": "d27fef2070c86a218965da8b8b5df8b4425aa3bb", + "3.1.17-asserts": "19aab28a81be09863e86aba8ee4e20feaee31f6b", + "3.1.16": "fb1baf00423818052359cf9126e94bc71c39feb5", + "3.1.16-asserts": "61848bee5b330db5ad5f827352d453b5557757fa", + "3.1.15": "568a46a9fb7e1f1686a6f7216b3dc976f28d2a79", + "3.1.15-asserts": "a8a770a0a23d2279270bd28004c8c60b02d91fbb", + "3.1.14": "ade9d780ff17c88d81aa13860361743e3c1e1396", + "3.1.14-asserts": "b55548282b553fc0b922b82d97b80f256bf01d20", + "3.1.13": "bc44364b561cfde15c243a54e3b96ea12d7ea284", + "3.1.13-asserts": "6b8f75967b5d37fa898d217b560d571694eb5b13", "3.1.12": "a8c3b314d61e2bb98581d522f858132b2fc21488", "3.1.12-asserts": "0ec1936aa3cb809d96abfebcc5356cd0cb15f6b8", "3.1.11": "8c3a799341c01148692c52fda73bbba5e89c5727", 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.py b/emsdk.py index 1b5fc79a54..b789ea5297 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) @@ -136,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: @@ -182,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) @@ -477,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. @@ -527,7 +534,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) @@ -879,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)) @@ -1101,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() @@ -1606,7 +1527,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)) @@ -1616,11 +1537,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): @@ -1635,23 +1553,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" @@ -1676,17 +1594,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: @@ -1754,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. @@ -1918,16 +1835,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 @@ -2003,8 +1920,8 @@ 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') + 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 if not os.path.exists(os.path.join(emscripten_dir, 'node_modules')): @@ -2029,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) @@ -2052,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': @@ -2186,6 +2101,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])) @@ -2266,14 +2184,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) @@ -2337,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(): @@ -2383,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: @@ -2467,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: @@ -2489,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: @@ -2535,7 +2446,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) @@ -2550,7 +2461,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 @@ -2618,12 +2529,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) @@ -2660,14 +2570,13 @@ 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()))] - env_vars_to_add += [('EM_CONFIG', os.path.normpath(dot_emscripten_path()))] + env_vars_to_add += [('EMSDK', EMSDK_PATH)] for tool in tools_to_activate: config = tool.activated_config() @@ -2683,6 +2592,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 @@ -2691,6 +2603,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(EM_CONFIG_PATH))] envs = tool.activated_environment() for env in envs: @@ -2702,6 +2616,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)) @@ -2720,13 +2635,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: @@ -2754,9 +2669,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 in ('EM_CACHE', 'EM_CONFIG'): 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 @@ -2769,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 @@ -2795,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) @@ -3003,7 +2901,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. @@ -3059,13 +2957,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.') 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 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/eng/Versions.props b/eng/Versions.props index 39ca267629..243b595bfb 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -6,7 +6,7 @@ 8.0.0 preview 3 - 3.1.12 + 3.1.30 2.0.23 3.1.12 7.0.3 diff --git a/eng/clang-wrapper.sh b/eng/clang-wrapper.sh index ceedd91d2f..4a023e3591 100755 --- a/eng/clang-wrapper.sh +++ b/eng/clang-wrapper.sh @@ -2,12 +2,12 @@ # # This abomination of a script is meant to replace the symlinks -# pointing to the clang-15 binary and set the appropriate flags -# to avoid duplicating the 90MB clang-15 binary inside the nuget +# pointing to the clang-16 binary and set the appropriate flags +# to avoid duplicating the 90MB clang-16 binary inside the nuget # package. # CLANG_NAME=$(basename "$0") -CLANG_CC=$(dirname $0)/clang-15 +CLANG_CC=$(dirname $0)/clang-16 EXTRA_ARGS="" case $CLANG_NAME in diff --git a/eng/emsdk.proj b/eng/emsdk.proj index fbc6382102..de4991b0d1 100644 --- a/eng/emsdk.proj +++ b/eng/emsdk.proj @@ -41,9 +41,9 @@ - + + Condition="!Exists('$(UpstreamDirectory)\bin\clang-16') and !$([MSBuild]::IsOSPlatform(Windows))" /> + diff --git a/test/test.py b/test/test.py index deb7240082..1f633a132e 100755 --- a/test/test.py +++ b/test/test.py @@ -10,15 +10,13 @@ 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' 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 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")