Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 12 additions & 12 deletions emsdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ def exit_with_error(msg):
elif machine.endswith('86'):
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'
else:
ARCH = 'arm64'
elif machine.startswith('arm'):
ARCH = 'arm'
else:
Expand Down Expand Up @@ -254,7 +258,7 @@ def vswhere(version):
program_files = os.environ['ProgramFiles']
vswhere_path = os.path.join(program_files, 'Microsoft Visual Studio', 'Installer', 'vswhere.exe')
# Source: https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022
tools_arch = 'ARM64' if ARCH == 'aarch64' else 'x86.x64'
tools_arch = 'ARM64' if ARCH == 'arm64' else 'x86.x64'
# The "-products *" allows detection of Build Tools, the "-prerelease" allows detection of Preview version
# of Visual Studio and Build Tools.
output = json.loads(subprocess.check_output([vswhere_path, '-latest', '-products', '*', '-prerelease', '-version', '[%s.0,%s.0)' % (version, version + 1), '-requires', 'Microsoft.VisualStudio.Component.VC.Tools.' + tools_arch, '-property', 'installationPath', '-format', 'json']))
Expand Down Expand Up @@ -1018,13 +1022,13 @@ def xcode_sdk_version():
def cmake_target_platform(tool):
# Source: https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html#platform-selection
if hasattr(tool, 'arch'):
if tool.arch == 'aarch64':
if tool.arch == 'arm64':
return 'ARM64'
elif tool.arch == 'x86_64':
return 'x64'
elif tool.arch == 'x86':
return 'Win32'
if ARCH == 'aarch64':
if ARCH == 'arm64':
return 'ARM64'
else:
return 'x64' if tool.bitness == 64 else 'Win32'
Expand All @@ -1033,7 +1037,7 @@ def cmake_target_platform(tool):
def cmake_host_platform():
# Source: https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html#toolset-selection
arch_to_cmake_host_platform = {
'aarch64': 'ARM64',
'arm64': 'ARM64',
'arm': 'ARM',
'x86_64': 'x64',
'x86': 'x86'
Expand Down Expand Up @@ -1078,7 +1082,7 @@ def build_llvm(tool):
targets_to_build = 'WebAssembly;X86'
elif ARCH == 'arm':
targets_to_build = 'WebAssembly;ARM'
elif ARCH == 'aarch64':
elif ARCH == 'arm64':
targets_to_build = 'WebAssembly;AArch64'
else:
targets_to_build = 'WebAssembly'
Expand Down Expand Up @@ -1860,10 +1864,6 @@ def install_tool(self):
elif hasattr(self, 'git_branch'):
success = git_clone_checkout_and_pull(url, self.installation_path(), self.git_branch)
elif url.endswith(ARCHIVE_SUFFIXES):
global ARCH
if WINDOWS and ARCH == 'aarch64':
errlog('No support for Windows on Arm, fallback to x64')
ARCH = 'x86_64'
success = download_and_unzip(url, self.installation_path(), filename_prefix=getattr(self, 'zipfile_prefix', ''))
else:
assert False, 'unhandled url type: ' + url
Expand Down Expand Up @@ -2010,7 +2010,7 @@ def find_latest_hash():

def resolve_sdk_aliases(name, verbose=False):
releases_info = load_releases_info()
if name == 'latest' and LINUX and ARCH == 'aarch64':
if name == 'latest' and LINUX and ARCH == 'arm64':
print("warning: 'latest' on arm64-linux may be slightly behind other architectures")
name = 'latest-arm64-linux'
while name in releases_info['aliases']:
Expand Down Expand Up @@ -2058,7 +2058,7 @@ def get_emscripten_releases_tot():
# may not be a build for the most recent ones yet; find the last
# that does.
arch = ''
if ARCH == 'aarch64':
if ARCH == 'arm64':
arch = '-arm64'
for release in recent_releases:
url = emscripten_releases_download_url_template % (
Expand Down
41 changes: 29 additions & 12 deletions emsdk_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"id": "releases",
"version": "%releases-tag%",
"bitness": 64,
"arch": "aarch64",
"arch": "arm64",
"macos_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/%releases-tag%/wasm-binaries-arm64.tbz2",
"linux_url": "https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/%releases-tag%/wasm-binaries-arm64.tbz2",
"zipfile_prefix": "%releases-tag%-",
Expand Down Expand Up @@ -96,7 +96,7 @@
{
"id": "node",
"version": "8.9.1",
"arch": "aarch64",
"arch": "arm64",
"bitness": 64,
"linux_url": "node-v8.9.1-linux-arm64.tar.xz",
"activated_path": "%installation_dir%/bin",
Expand Down Expand Up @@ -142,7 +142,7 @@
{
"id": "node",
"version": "12.18.1",
"arch": "aarch64",
"arch": "arm64",
"bitness": 64,
"linux_url": "node-v12.18.1-linux-arm64.tar.xz",
"activated_path": "%installation_dir%/bin",
Expand Down Expand Up @@ -190,7 +190,7 @@
{
"id": "node",
"version": "14.18.2",
"arch": "aarch64",
"arch": "arm64",
"bitness": 64,
"macos_url": "node-v14.18.2-darwin-x64.tar.gz",
"linux_url": "node-v14.18.2-linux-arm64.tar.xz",
Expand Down Expand Up @@ -239,7 +239,7 @@
{
"id": "node",
"version": "14.15.5",
"arch": "aarch64",
"arch": "arm64",
"bitness": 64,
"macos_url": "node-v14.15.5-darwin-x64.tar.gz",
"linux_url": "node-v14.15.5-linux-arm64.tar.xz",
Expand Down Expand Up @@ -288,7 +288,7 @@
{
"id": "node",
"version": "15.14.0",
"arch": "aarch64",
"arch": "arm64",
"bitness": 64,
"macos_url": "node-v15.14.0-darwin-x64.tar.gz",
"linux_url": "node-v15.14.0-linux-arm64.tar.xz",
Expand All @@ -297,8 +297,17 @@
"activated_cfg": "NODE_JS='%installation_dir%/bin/node%.exe%'",
"activated_env": "EMSDK_NODE=%installation_dir%/bin/node%.exe%"
},


{
"id": "node",
"version": "20.18.0",
"arch": "arm64",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of renaming everything from aarch64 to arm64, could this line have been renamed from arm64 to aarch64 instead? (so that no other changes but adding this one JSON entry here, and below for the SDK, would be needed?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, probably, I just thought it might be a good opportunity to consolidate the references since we use both in different places

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cherry-picked the change from upstream emscripten by the way: see here

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be a good opportunity to consolidate

The consolidation would be best to happen when we update to upstream code. Ideally we would just add the minimum amount of code that would be specific to mac arm 64 into our downstream fork.

But in the interest of saving time, let's go with this form.

"bitness": 64,
"macos_url": "node-v20.18.0-darwin-arm64.tar.gz",
"activated_path": "%installation_dir%/bin",
"activated_path_skip": "node",
"activated_cfg": "NODE_JS='%installation_dir%/bin/node%.exe%'",
"activated_env": "EMSDK_NODE=%installation_dir%/bin/node%.exe%"
},
{
"id": "python",
"version": "2.7.13.1",
Expand Down Expand Up @@ -400,7 +409,7 @@
"id": "python",
"version": "3.9.2",
"bitness": 64,
"arch": "aarch64",
"arch": "arm64",
"macos_url": "python-3.9.2-1-macos-arm64.tar.gz",
"activated_cfg": "PYTHON='%installation_dir%/bin/python3'",
"activated_env": "EMSDK_PYTHON=%installation_dir%/bin/python3;SSL_CERT_FILE=%installation_dir%/lib/python3.9/site-packages/certifi/cacert.pem"
Expand Down Expand Up @@ -605,11 +614,19 @@
"uses": ["python-3.9.2-nuget-64bit", "llvm-git-main-64bit", "node-15.14.0-64bit", "emscripten-main-64bit", "binaryen-main-64bit"],
"os": "win"
},
{
"version": "main",
"bitness": 64,
"uses": ["python-3.9.2-64bit", "llvm-git-main-64bit", "node-20.18.0-64bit", "emscripten-main-64bit", "binaryen-main-64bit"],
"os": "macos",
"arch": "arm64"
},
{
"version": "main",
"bitness": 64,
"uses": ["python-3.9.2-64bit", "llvm-git-main-64bit", "node-15.14.0-64bit", "emscripten-main-64bit", "binaryen-main-64bit"],
"os": "macos"
"os": "macos",
"arch": "x86_64"
},
{
"version": "main",
Expand Down Expand Up @@ -641,9 +658,9 @@
{
"version": "releases-%releases-tag%",
"bitness": 64,
"uses": ["node-15.14.0-64bit", "python-3.9.2-64bit", "releases-%releases-tag%-64bit"],
"uses": ["node-20.18.0-64bit", "python-3.9.2-64bit", "releases-%releases-tag%-64bit"],
"os": "macos",
"arch": "aarch64",
"arch": "arm64",
"custom_install_script": "emscripten_npm_install"
},
{
Expand Down