Skip to content
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

add support for macOS arm64, build wheels #92

Merged
merged 3 commits into from
Aug 19, 2022

Conversation

igrr
Copy link
Contributor

@igrr igrr commented Aug 19, 2022

This PR adds support for macOS arm64 platforms. Changes are as follows:

  1. Handle platform.machine() == arm64 for macOS.

    Upstream wasmtime releases use aarch64-macos as part of the file name. On aarch64 macOS, platform.machine() returns 'arm64' instead. With this change, download-wasmtime.py correctly downloads aarch64-macos binaries and _ffi.py correctly loads them.

  2. Build wheels for macOS arm64 in CI. This should close wasmtime arm64 wheel for mac m1 #79.

I ran tests on macOS-arm64 with python 3.8.9 using pytest, and two failures were reported:

FAILED tests/test_trap.py::TestTrap::test_frames - AssertionError: 1 != 3
FAILED tests/test_trap.py::TestTrap::test_frames_no_module - AssertionError: 0 != 1

(The PR is "draft" because of this failure.)

I have also tested a relatively simple project (astyle code formatter compiled to WebAssembly) with this branch, and it worked correctly.

igrr added 2 commits August 19, 2022 18:14
Upstream wasmtime releases use aarch64-macos as part of the file name.
On aarch64 macOS, platform.machine() returns 'arm64' instead.
With this change, download-wasmtime.py correctly downloads
aarch64-macos binaries and _ffi.py correctly loads them.
@igrr
Copy link
Contributor Author

igrr commented Aug 19, 2022

The test failures for other platforms are because of an incompatibility between pytest-flake8 and the recently released flake8 5.x. This should be fixed by tholo/pytest-flake8#88. In the meantime I can pin flake8 to 4.0.1 in setup.py.

pytest-flake8 is currently incompatible with 5.x flake8 releases.
This downgrades flake8 to an older version which still works.
@igrr igrr force-pushed the feature/macos_arm64 branch from 7234b95 to 3c46e7d Compare August 19, 2022 16:43
@alexcrichton
Copy link
Member

This all looks great to me, thanks!

I'm happy to merge as I think the test failures will be fixed in the next release of Wasmtime if you'd like

@igrr igrr marked this pull request as ready for review August 19, 2022 17:18
@igrr
Copy link
Contributor Author

igrr commented Aug 19, 2022

@alexcrichton Thanks for reviewing! If you don't mind the test failures, sure please go ahead and merge this.

My use case doesn't depend on trap functionality, so I'd be happy to see a new release of wasmtime-py with macOS arm64 wheels even in the current state.

@alexcrichton alexcrichton merged commit 0c6cf99 into bytecodealliance:main Aug 19, 2022
@igrr igrr deleted the feature/macos_arm64 branch August 19, 2022 17:22
@alexcrichton
Copy link
Member

Sounds good!

I think there's a Wasmtime release tomorrow actually, so this should get picked up tomorrow

@mogery
Copy link

mogery commented Aug 19, 2022

hi! this PR's changes aren't reflected in the README yet.

@igrr
Copy link
Contributor Author

igrr commented Aug 23, 2022

@alexcrichton looks like 0.40.0 was released, could you please tag the new version here as well?

@robtaylor
Copy link

just to confirm, if I bump VERSION to 0.40.0, download and build the wheel its all working for me on the M2 macbook pro

@alexcrichton
Copy link
Member

I'm doing the version bump in #93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wasmtime arm64 wheel for mac m1
4 participants