Skip to content

Merge emscripten 3.1.1 #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 62 commits into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
57b8067
Improve emscripten-releases-tags.txt to support mutliple aliases (#837)
sbc100 Jun 8, 2021
9fca470
bugfix: allow to install SDK binaries alone (#834)
fs-eire Jun 8, 2021
e2dc11e
2.0.24 (#839)
sbc100 Jun 10, 2021
c341e54
Error out on attempt to activate a missing tools (#838)
sbc100 Jun 16, 2021
bb3189b
Consistent error messages (#840)
sbc100 Jun 16, 2021
0eae457
Point zsh and csh users to the correct startup script (#843)
sbc100 Jun 17, 2021
eaa4951
Print sys.argv when link_wrapper.py is invoked incorrectly (#847)
attilaolah Jun 24, 2021
7f98396
Support linking with `-o filename` (#849)
Jun 28, 2021
5c0e31a
2.0.25 (#850)
sbc100 Jun 30, 2021
a3d65c8
2.0.26 (#858)
sbc100 Jul 26, 2021
6d1efad
2.0.26-lto (#861)
dschuff Jul 28, 2021
9532440
2.0.27 (#868)
dschuff Aug 13, 2021
793557c
2.0.28 (#871)
dschuff Aug 23, 2021
6a93224
Use `.json` extension for emscripten-releases-tags.json. NFC (#870)
sbc100 Aug 26, 2021
8ce2547
Add LTO build for 2.0.28 (#873)
dschuff Aug 26, 2021
e82ac4e
Small fix for Bazel instructions. (#875)
db81 Aug 26, 2021
f9dee66
Version 2.0.29 (#878)
dschuff Aug 28, 2021
e61ecfa
2.0.29-lto (#881)
dschuff Sep 2, 2021
68cfa87
Fix release name for 2.0.29-lto (#885)
dschuff Sep 7, 2021
cf70631
[Bazel] fix llvm bin path (#888)
bkotsopoulossc Sep 9, 2021
b362b17
Add arm64 fastcomp releases to emsdk_manifest.json (#891)
sbc100 Sep 9, 2021
b946a47
2.0.30 (#893)
dschuff Sep 15, 2021
deb6453
Fix error handling: untargz() in emsdk.py (#895)
matt9ucci Sep 20, 2021
4d84356
Fix passing -DLLVM_ENABLE_PROJECTS directive to CMake - it does not w…
juj Sep 25, 2021
c60dd3b
Fix emscripten-version parsing (#902)
sbc100 Sep 28, 2021
3891e7b
2.0.31 (#906)
sbc100 Oct 1, 2021
7f39d10
bazel: pass -g instead of -g4 for wasm_asan feature (#904)
walkingeyerobot Oct 13, 2021
773e4f9
Add embind example to Bazel docs (#910)
kjlubick Oct 14, 2021
f8615b4
Run buildifier on bazel/ (#913)
kjlubick Oct 19, 2021
4088244
Update build_bazel_rules_nodejs to fix closure compiles (#912)
kjlubick Oct 19, 2021
1c420fd
2.0.32 (#915)
sbc100 Oct 20, 2021
85d27a4
Improve flags in bazel example (#917)
kjlubick Oct 24, 2021
2b3e0b9
Add back node.js 12.18.1 packages for Windows 7 support. (#877)
juj Oct 27, 2021
99e5e02
Update CMAKE_OSX_DEPLOYMENT_TARGET from 10.11 to 10.14 (#924)
sbc100 Nov 1, 2021
69bc93a
Revert "Update CMAKE_OSX_DEPLOYMENT_TARGET from 10.11 to 10.14 (#924)"
sbc100 Nov 1, 2021
044d620
2.0.33 (#922)
sbc100 Nov 1, 2021
3acac70
2.0.34 (#925)
sbc100 Nov 4, 2021
eac57d9
Remove all vs-tool references (#931) (#931)
jmglogow Nov 14, 2021
d8a1fd7
Simplify and improve .dockerignore. NFC. (#934)
kleisauke Nov 17, 2021
2ec227a
Pass -Wno-unused-variable when building binaryen during CI (#938)
sbc100 Nov 22, 2021
846f683
3.0.0 (#939)
sbc100 Nov 22, 2021
c7305b4
Always output a tarball from cc_binary to simplify logic. (#936)
walkingeyerobot Dec 1, 2021
a7e4653
Canonical optimization levels in bazel toolchain (#940)
bkotsopoulossc Dec 6, 2021
3f30086
3.0.1 (#949)
sbc100 Dec 17, 2021
75ab7cf
Fix typo (#950)
toughengineer Dec 19, 2021
bb9a6a3
Optionally keep the downloaded archives (#930)
jmglogow Dec 20, 2021
774b871
Bazel Windows Support (#929)
zaucy Dec 20, 2021
faf9a33
Fix for windows checksum in bazel/revisions.bzl. NFC (#954)
sbc100 Dec 22, 2021
8e7b714
3.1.0 (#955)
sbc100 Dec 22, 2021
4764bfa
Add test and remove unused args (#951)
sbc100 Dec 23, 2021
060b48f
Correct typo in "emsdk help" message. (#959)
gregbuchholz Dec 26, 2021
82ad004
Remove unused argument. NFC (#952)
sbc100 Jan 5, 2022
135ab8c
Merge tag '2.0.34'
radekdoulik Jan 7, 2022
d232136
Bump EmscriptenVersion to 2.0.34
radekdoulik Jan 7, 2022
24e7881
Minor node version update v14.15.5 -> v14.18.2 (#953)
sbc100 Jan 9, 2022
2c09626
3.1.1 (#965)
sbc100 Jan 10, 2022
53d9e0d
Merge branch 'main' into pr-bump-emscripten-to-2-0-34
lewing Jan 28, 2022
d1aaffd
Fix bad edit
lewing Jan 28, 2022
6ef878b
Revert "[main] Bump Emscripten to 2.0.34 (#97)"
radekdoulik Feb 15, 2022
2f7513a
Merge remote-tracking branch 'rodo/pr-bump-emscripten-to-2-0-34'
radekdoulik Feb 15, 2022
04c09d1
Merge tag '3.1.1'
radekdoulik Feb 15, 2022
8da4c81
Bump version to 3.1.1
radekdoulik Feb 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
executor: bionic
environment:
EMSDK_NOTTY: "1"
# This is needed because the old gcc-7 that is installed on debian/bionic
# generates warnings about unused variables when doing C++17
# destructuring:
# https://github.com/WebAssembly/binaryen/issues/4353
CXXFLAGS: "-Wno-unused-variable"
# I don't know why circleci VMs pretent to have 36 cores but its a lie.
EMSDK_NUM_CORES: "4"
steps:
Expand Down Expand Up @@ -201,6 +206,28 @@ jobs:
brew install bazel
- run: test/test_bazel_mac.sh

test-bazel-windows:
executor:
name: win/vs2019
shell: powershell.exe -ExecutionPolicy Bypass
environment:
PYTHONUNBUFFERED: "1"
EMSDK_NOTTY: "1"
steps:
- checkout
- run:
name: Download Bazelisk
shell: powershell.exe
command: |
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest -Uri https://github.com/bazelbuild/bazelisk/releases/download/v1.10.1/bazelisk-windows-amd64.exe -OutFile ( New-Item -Path "temp\bazel\bazel.exe" -Force )
- run:
name: Run Tests
shell: powershell.exe
command: |
$env:Path += ";C:\Python27amd64;$pwd\temp\bazel"
.\test\test_bazel.ps1

workflows:
flake8:
jobs:
Expand Down Expand Up @@ -229,3 +256,6 @@ workflows:
test-bazel-mac:
jobs:
- test-bazel-mac
test-bazel-windows:
jobs:
- test-bazel-windows
33 changes: 16 additions & 17 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# Ignore all subdirectories
*/*
# Ignore everything
*

# Allow to run the test script inside the Docker container
!/docker/test_dockerimage.sh

# Ignore unnecessary files inside top-level directory
*.bat
*.csh
*.fish
*.ps1
*.pyc
.emscripten
.emscripten.old
.emscripten_cache
.emscripten_cache__last_clear
.emscripten_sanity
.emscripten_sanity_wasm
.flake8
emscripten-releases-tot.txt
README.md
# Allow license file
!LICENSE

# Allow necessary build files in top-level directory
!emscripten-releases-tags.json
!emsdk
!emsdk.py
!emsdk_env.sh
!emsdk_manifest.json

# Allow files required to install legacy versions
!legacy-binaryen-tags.txt
!legacy-emscripten-tags.txt
!llvm-tags-64bit.txt
1 change: 1 addition & 0 deletions bazel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bazel-*
10 changes: 5 additions & 5 deletions bazel/emscripten_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def emscripten_deps(emscripten_version = "latest"):

revision = EMSCRIPTEN_TAGS[version]

emscripten_url = "https://storage.googleapis.com/webassembly/emscripten-releases-builds/{}/{}/wasm-binaries.tbz2"
emscripten_url = "https://storage.googleapis.com/webassembly/emscripten-releases-builds/{}/{}/wasm-binaries.{}"

# This could potentially backfire for projects with multiple emscripten
# dependencies that use different emscripten versions
Expand All @@ -28,7 +28,7 @@ def emscripten_deps(emscripten_version = "latest"):
http_archive(
name = "emscripten_bin_linux",
strip_prefix = "install",
url = emscripten_url.format("linux", revision.hash),
url = emscripten_url.format("linux", revision.hash, "tbz2"),
sha256 = revision.sha_linux,
build_file = "@emsdk//emscripten_toolchain:emscripten.BUILD",
type = "tar.bz2",
Expand All @@ -38,7 +38,7 @@ def emscripten_deps(emscripten_version = "latest"):
http_archive(
name = "emscripten_bin_mac",
strip_prefix = "install",
url = emscripten_url.format("mac", revision.hash),
url = emscripten_url.format("mac", revision.hash, "tbz2"),
sha256 = revision.sha_mac,
build_file = "@emsdk//emscripten_toolchain:emscripten.BUILD",
type = "tar.bz2",
Expand All @@ -48,10 +48,10 @@ def emscripten_deps(emscripten_version = "latest"):
http_archive(
name = "emscripten_bin_win",
strip_prefix = "install",
url = emscripten_url.format("win", revision.hash),
url = emscripten_url.format("win", revision.hash, "zip"),
sha256 = revision.sha_win,
build_file = "@emsdk//emscripten_toolchain:emscripten.BUILD",
type = "tar.bz2",
type = "zip",
)

if "emscripten_npm_linux" not in excludes:
Expand Down
8 changes: 8 additions & 0 deletions bazel/emscripten_toolchain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ filegroup(
name = "common-script-includes",
srcs = [
"emar.sh",
"emar.bat",
"emcc.sh",
"emcc.bat",
"emscripten_config",
"env.sh",
"env.bat",
"@emsdk//:binaries",
"@emsdk//:node_modules",
"@nodejs//:node_files",
Expand All @@ -24,6 +27,7 @@ filegroup(
name = "link-emscripten",
srcs = [
"emcc_link.sh",
"emcc_link.bat",
"link_wrapper.py",
":common-script-includes",
"@emsdk//:binaries",
Expand Down Expand Up @@ -51,6 +55,10 @@ emscripten_cc_toolchain_config_rule(
cpu = "wasm",
em_config = "emscripten_config",
emscripten_binaries = "@emsdk//:binaries",
script_extension = select({
"@bazel_tools//src/conditions:host_windows": "bat",
"//conditions:default": "sh",
}),
)

cc_toolchain(
Expand Down
22 changes: 14 additions & 8 deletions bazel/emscripten_toolchain/crosstool.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,27 @@ def _impl(ctx):

builtin_sysroot = emscripten_dir + "/emscripten/cache/sysroot"

emcc_script = "emcc.%s" % ctx.attr.script_extension
emcc_link_script = "emcc_link.%s" % ctx.attr.script_extension
emar_script = "emar.%s" % ctx.attr.script_extension

################################################################
# Tools
################################################################
clang_tool = tool(path = "emcc.sh")
clang_tool = tool(path = emcc_script)
clif_match_tool = tool(path = "dummy_clif_matcher")
link_tool = tool(path = "emcc_link.sh")
archive_tool = tool(path = "emar.sh")
link_tool = tool(path = emcc_link_script)
archive_tool = tool(path = emar_script)
strip_tool = tool(path = "NOT_USED_STRIP_TOOL")

#### Legacy tool paths (much of this is redundant with action_configs, but
#### these are still used for some things)
tool_paths = [
tool_path(name = "ar", path = "emar.sh"),
tool_path(name = "ar", path = emar_script),
tool_path(name = "cpp", path = "/bin/false"),
tool_path(name = "gcc", path = "emcc.sh"),
tool_path(name = "gcc", path = emcc_script),
tool_path(name = "gcov", path = "/bin/false"),
tool_path(name = "ld", path = "emcc_link.sh"),
tool_path(name = "ld", path = emcc_link_script),
tool_path(name = "nm", path = "NOT_USED"),
tool_path(name = "objdump", path = "/bin/false"),
tool_path(name = "strip", path = "NOT_USED"),
Expand Down Expand Up @@ -572,9 +576,10 @@ def _impl(ctx):
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = ["-O3"],
flags = ["-O2"],
features = ["opt"],
),

# Users can override opt-level with semantic names...
flag_set(
actions = all_compile_actions +
Expand All @@ -598,7 +603,7 @@ def _impl(ctx):
flag_set(
actions = all_compile_actions +
all_link_actions,
flags = ["-O2"],
flags = ["-O0"],
features = ["fastbuild"],
),

Expand Down Expand Up @@ -1105,6 +1110,7 @@ emscripten_cc_toolchain_config_rule = rule(
"cpu": attr.string(mandatory = True, values = ["asmjs", "wasm"]),
"em_config": attr.label(mandatory = True, allow_single_file = True),
"emscripten_binaries": attr.label(mandatory = True),
"script_extension": attr.string(mandatory = True, values = ["sh", "bat"]),
},
provides = [CcToolchainConfigInfo],
)
5 changes: 5 additions & 0 deletions bazel/emscripten_toolchain/emar.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF

call external\emsdk\emscripten_toolchain\env.bat

py -3 %EMSCRIPTEN%\emar.py %*
5 changes: 5 additions & 0 deletions bazel/emscripten_toolchain/emcc.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF

call external\emsdk\emscripten_toolchain\env.bat

py -3 %EMSCRIPTEN%\emcc.py %*
5 changes: 5 additions & 0 deletions bazel/emscripten_toolchain/emcc_link.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF

call external\emsdk\emscripten_toolchain\env.bat

py -3 external\emsdk\emscripten_toolchain\link_wrapper.py %*
2 changes: 1 addition & 1 deletion bazel/emscripten_toolchain/emscripten_config
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ LLVM_ROOT = BINARYEN_ROOT + "/bin"
FROZEN_CACHE = True

system = platform.system()
nodejs_binary = "node.exe" if(system =="Windows") else "bin/node"
nodejs_binary = "bin/nodejs/node.exe" if(system =="Windows") else "bin/node"
NODE_JS = ROOT_DIR + "/external/nodejs_{}_amd64/{}".format(system.lower(), nodejs_binary)
5 changes: 5 additions & 0 deletions bazel/emscripten_toolchain/env.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF

set ROOT_DIR=%CD%
set EMSCRIPTEN=%ROOT_DIR%\%EM_BIN_PATH%\emscripten
set EM_CONFIG=%ROOT_DIR%\%EM_CONFIG_PATH%
19 changes: 8 additions & 11 deletions bazel/emscripten_toolchain/link_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
sys.argv[1] = '@' + new_param_filename

emcc_py = os.path.join(os.environ['EMSCRIPTEN'], 'emcc.py')
rtn = subprocess.call(['python3', emcc_py] + sys.argv[1:])
rtn = subprocess.call([sys.executable, emcc_py] + sys.argv[1:])
if rtn != 0:
sys.exit(1)

Expand Down Expand Up @@ -153,17 +153,14 @@
wasm_base,
'--add-section=external_debug_info=debugsection.tmp'])

# If we have more than one output file then create tarball
if len(files) > 1:
cmd = ['tar', 'cf', 'tmp.tar'] + files
subprocess.check_call(cmd, cwd=outdir)
os.rename(os.path.join(outdir, 'tmp.tar'), output_file)
elif len(files) == 1:
# Otherwise, if only have a single output than move it to the expected name
if files[0] != os.path.basename(output_file):
os.rename(os.path.join(outdir, files[0]), output_file)
else:
# Make sure we have at least one output file.
if not len(files):
print('emcc.py did not appear to output any known files!')
sys.exit(1)

# cc_binary must output exactly one file; put all the output files in a tarball.
cmd = ['tar', 'cf', 'tmp.tar'] + files
subprocess.check_call(cmd, cwd=outdir)
os.rename(os.path.join(outdir, 'tmp.tar'), output_file)

sys.exit(0)
28 changes: 6 additions & 22 deletions bazel/emscripten_toolchain/wasm_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

import argparse
import os
import subprocess
import sys
import tarfile


def ensure(f):
Expand All @@ -41,29 +40,14 @@ def main():
parser.add_argument('--output_path', help='The path to extract into.')
args = parser.parse_args()

args.archive = os.path.normpath(args.archive)

basename = os.path.basename(args.archive)
stem = basename.split('.')[0]

# Check the type of the input file
mimetype_bytes = subprocess.check_output(['file', '-Lb', '--mime-type', '--mime-encoding', args.archive])
mimetype = mimetype_bytes.decode(sys.stdout.encoding)

# If we have a tar, extract all files. If we have just a single file, copy it.
if 'tar' in mimetype:
subprocess.check_call(
['tar', 'xf', args.archive, '-C', args.output_path])
elif 'binary' in mimetype:
subprocess.check_call([
'cp',
args.archive,
os.path.join(args.output_path, stem + '.wasm')])
elif 'text' in mimetype:
subprocess.check_call([
'cp',
args.archive,
os.path.join(args.output_path, stem + '.js')])
else:
subprocess.check_call(['cp', args.archive, args.output_path])
# 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'))
Expand Down
13 changes: 4 additions & 9 deletions bazel/emscripten_toolchain/wasm_cc_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,10 @@ _wasm_transition = transition(
)

def _wasm_binary_impl(ctx):
cc_target = ctx.attr.cc_target[0]
args = ctx.actions.args()
args.add("--output_path", ctx.outputs.loader.dirname)
args.add_all("--archive", ctx.files.cc_target)

args = [
"--output_path={}".format(ctx.outputs.loader.dirname),
] + [
ctx.expand_location("--archive=$(location {})".format(
cc_target.label,
), [cc_target]),
]
outputs = [
ctx.outputs.loader,
ctx.outputs.wasm,
Expand All @@ -80,7 +75,7 @@ def _wasm_binary_impl(ctx):
ctx.actions.run(
inputs = ctx.files.cc_target,
outputs = outputs,
arguments = args,
arguments = [args],
executable = ctx.executable._wasm_binary_extractor,
)

Expand Down
26 changes: 25 additions & 1 deletion bazel/revisions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,35 @@
# DO NOT MODIFY

EMSCRIPTEN_TAGS = {
"3.1.1": struct(
hash = "5ee64de9809592480da01372880ea11debd6c740",
sha_linux = "ba94c5ecabacbedc89665a742c37c4c132c739aea46aa66fd744cb72b260c870",
sha_mac = "8b5f8cec55af0e6816a08d8d1e8b873f96d0e0504fdd6e8deb2fc024957d1aa7",
sha_win = "6cbe976aff6155cf1c48707f0520b5aa6a7770860e9b1964bfca3e5923ce7225",
),
"3.1.0": struct(
hash = "562e3a0af169e6dea5e6dbecac2255d67c2c8b94",
sha_linux = "0714344e32e244e6d44d9ea75937633ab1338e417a232fb66d6dcd7d4b704e8c",
sha_mac = "f6c1cad729ed799e1df09eacf5aa80cce9861d69ec6d9581c17e4ba8d9b064ce",
sha_win = "756c41cbcab4ae6077cca30834d16151392b8c19ab186c13d42d7d05d6d727cc",
),
"3.0.1": struct(
hash = "91b7a67a486d2430e73423a38d950d8a550826ed",
sha_linux = "25fd430268596229c4ac38e188d7c2b31f75c2ec8172b1351d763e37c830c6af",
sha_mac = "52ec2204115b727cc4de38b5eeae147eead12b299b98e5a88653d12958cae4d4",
sha_win = "0e072736b471c9a07cdf534ba4da46b3b6545b63c8a6cbb0ef7d544251e15092",
),
"3.0.0": struct(
hash = "7fbe748230f2ce99abbf975d9ad997699efb3153",
sha_linux = "10646b64daea15354f14f89f7e79937f420b77f31bda7c4b174de2474835950f",
sha_mac = "ebb17bc91c6a72ca06d17337d27aa1a2be4c9af4c68644c221712123f663b8ab",
sha_win = "0d4f2ff5d88a8eef5ed769ee4ffc5d5574143911d2e0079325cdc5206c9e9bb1",
),
"2.0.34": struct(
hash = "d8fc1b92dbc0ce8d740a7adb937c5137ba4755e0",
sha_linux = "a6304e3a52c172eb178c6f9817d74aa3ee411e97ef00bcae0884377799c49954",
sha_mac = "975ae11000100362baf19d161fec04d82e1f7c9fb7d43c43864ddd65a47f1780",
sha_win = "30f64dbc6425490157360439d40141feae359dbf586f59fa23185d7e009f3209",
sha_win = "8167a44bb895a0fdc153836bed91bf387be57f2dc1b8f103bf70e68923b61d39",
),
"2.0.33": struct(
hash = "cef8850d57278271766fb2163eebcb07354018e7",
Expand Down
Loading