emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
2.92k stars 662 forks source link

Compatibility issue while installing emsdk 1.40.1 with M1 Mac #1327

Open Akash1684 opened 6 months ago

Akash1684 commented 6 months ago

Encountered compatibility issues installing emsdk 1.40.1 on my M1 Mac. The installation process fails with unexpected errors.

Installing tool 'releases-536568644fd67d53778f6111fdd5f64ad3f4c539-64bit'..
Error: Downloading URL 'https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/536568644fd67d53778f6111fdd5f64ad3f4c539/wasm-binaries-arm64.tar.xz': HTTP Error 404: Not Found
error: installation failed!

I understand there is no precompiled emsdk package for Apple's new M1 macs but wondering if there is any work around to install older version. I have a hard dependency on emsdk version 1.40.1

Akash1684 commented 6 months ago

Update: Tried enforcing EMSDK_ARCH=x86_64 as suggested in link to bypass the ARM check but facing following issue:

Done installing tool 'releases-536568644fd67d53778f6111fdd5f64ad3f4c539-64bit'.
Running post-install step: npm ci ...
Running post-install step: npm install google-closure-compiler-osx@20200224.0.0
Error running ['/Users/user/repos/emsdk/node/16.20.0_64bit/bin/npm', 'install', '--production', '--no-optional', 'google-closure-compiler-osx@20200224.0.0']:
npm WARN config production Use `--omit=dev` instead.
npm WARN config optional Use `--omit=optional` to exclude optional dependencies, or
npm WARN config `--include=optional` to include them.
npm WARN config 
npm WARN config     Default value does install optional deps unless otherwise omitted.
npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for google-closure-compiler-osx@20200224.0.0: wanted {"os":"darwin","arch":"x64,x86"} (current: {"os":"darwin","arch":"arm64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  x64,x86
npm ERR! notsup Actual OS:   darwin
npm ERR! notsup Actual Arch: arm64
Akash1684 commented 6 months ago

I was able to get emsdk v1.40.1 up and running on M1 mac by following steps:

Get the emsdk repo

git clone https://github.com/emscripten-core/emsdk.git

Enter that directory

cd emsdk

Enforcing EMSDK_ARCH=x86_64 in emsdk.py

Update arm64 to x86_64 in line: 148: https://github.com/emscripten-core/emsdk/blob/9347bc393b94a17b93450bbc98bc3f66cef2aeb0/emsdk.py#L148

Installing google-closure-compiler-osx through Rosetta 2.

Steps: https://www.cypress.io/blog/2021/01/20/running-cypress-on-the-apple-m1-silicon-arm-architecture-using-rosetta-2 (instructions are for cypress but works for google-closure-compiler)

Tip: easier would be to use Rosetta with iterm than cloning native terminal

sbc100 commented 6 months ago

We do have support for M1 macs in emsdk but only with newer versions of emsdk and 1.40.1, which is 3.5 years old, pre-dates that support.

I'm glad you found a workaround.

Can I ask why you have a hard dependency on such an old version? Perhaps we can help you update?

Akash1684 commented 6 months ago

Can I ask why you have a hard dependency on such an old version? Perhaps we can help you update?

We do have hard dependency on older version because of our testing setup which fails on newer version (2+). The workaround I mentioned works well for us.

Perhaps we can help you update?

Can you help us understand the changes involved?

sbc100 commented 6 months ago

Can you help us understand the changes involved?

Can you share the build failures you are seeing when attempting to use newer versions of emscripten? Perhaps close this issue and open a new one in the emscripten repo for that?