Skip to content

Commit

Permalink
Prefer arm64 over aarch64 internally. NFC (#1246)
Browse files Browse the repository at this point in the history
This seems like more commonly known/used name for the architecture
these days.
  • Loading branch information
sbc100 authored Jun 27, 2023
1 parent c2260b4 commit 1d59cd2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
25 changes: 13 additions & 12 deletions emsdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,17 @@ 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:
exit_with_error('unknown machine architecture: ' + machine)


# Don't saturate all cores to not steal the whole system, but be aggressive.
CPU_CORES = int(os.getenv('EMSDK_NUM_CORES', max(multiprocessing.cpu_count() - 1, 1)))

Expand Down Expand Up @@ -254,7 +259,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 +1023,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 +1038,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 +1083,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 +1865,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 +2011,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 +2059,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
18 changes: 9 additions & 9 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 Down Expand Up @@ -336,7 +336,7 @@
{
"id": "node",
"version": "16.20.0",
"arch": "aarch64",
"arch": "arm64",
"bitness": 64,
"macos_url": "node-v16.20.0-darwin-arm64.tar.gz",
"linux_url": "node-v16.20.0-linux-arm64.tar.xz",
Expand Down Expand Up @@ -448,7 +448,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 @@ -691,7 +691,7 @@
"bitness": 64,
"uses": ["node-16.20.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

0 comments on commit 1d59cd2

Please sign in to comment.