-
Notifications
You must be signed in to change notification settings - Fork 703
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
Switch to arm64 version of python on arm64 macOS (M1) #921
Comments
@juj WDYT about doing this? |
@dschuff do you still have access to an M1 mac to try and do this? |
M1 should use arm64 version of python - it even ships with an arm64 version of python built-in. When I did the initial M1 support, I did test that if bootstrapping using a M1 version of python, emsdk will download/build a M1 version of python as well. But there are lots of x64 python installations that are available for Macs. I think the issue is that if one runs emsdk under a x64 emulated python for initial bootstrapping, then emsdk will think that the system is a x64 one and not a M1 one, and will then proceed to installing x64 versions of all the tools in the toolchain. (running x64 python under rosetta will have python advertise to the user code that the system is a x64 system even if it is in reality arm-based) |
I tried uninstalling Emcripten's x86_64 version of python3:
But it was immediately reinstalled by emsdk:
|
Can you do that again and see which version of python was used for your installation? I think running with |
Indeed, from looking at the manifest it looks like if you bootstrap with an arm64 version of python emsdk will install Perhaps we can/should switch to a different method of arch detection to avoid this issue? |
I believe that is because the python you that ended up being run with emsdk was a Rosetta x64 emulated one, hence it would take this path: Line 118 in 2b3e0b9
If the executing python was a arm64 one, it should take this path: Line 122 in 2b3e0b9
I hesitated to change that on the first run, anticipating that maybe someone who installs x64 versions of python would actually have a reason for that and wanted to be running x64 variants deliberately (to avoid a bug?). Though maybe that does not make sense. We should be able to detect arm64 host from within python by running |
On a clean/stock install of a M1 Mac Mini, I did observe that the system python was native arm64, and then subsequently emsdk installing there would get a full M1 version of all tools after the PR that added arm64 variant of python. Back when authoring that, there didn't exist official arm64 version of node.js (so node would be the only tool that'd remain under rosetta), though that may have changed by now. Maybe users have e.g. homebrew or macports or other installations of python that have downloaded a x64 version. Or some other source? |
It looks like I had a very old version (so old it wasn't listed unless I ran
I don't know whether this is related to the target anomaly, but the It appears the architecture problems I've been facing are entirely caused by upgrading from older versions and won't affect new installations. The node version installed by emsdk is still x86_64. I do have a homebrew version of node that is arm64 native. |
OK, I think I will close this for now. We could switch to using a python-process-external way of detecting the arch.. but it seems like this would only effect some folks and there is a work around so its not urgent. |
…ten-core#921) emsdk.py started reading files out of the tool directories but in servicing we aren't bumping the version in emsdk_manifest.json so they weren't found. Don't include the patch version in the tool directories to fix this.
Currently we are using the x86_64 (emulated) version of python on arm64 macOS which then detects that architecture as x86_64 and downloads the x86_64 binaries even though we have usable arm binaries since #816.
See: emscripten-core/emscripten#14031
The text was updated successfully, but these errors were encountered: