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 M1 Mac instructions for building WASM bindings #415

Closed
wants to merge 1 commit into from

Conversation

m-renaud
Copy link
Contributor

Description of change

The npm version of wasm-pack does not support the new Darwin arm64 architecture. For some reason installing through cargo works though, so suggest that as a workaround.

Links to any relevant issues

N/A

Type of change

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Fix

How the change has been tested

N/A - README.md change only.

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

The npm version of wasm-pack does not support the new Darwin arm64 architecture. For some reason installing through cargo works though, so suggest that as a workaround.
@m-renaud
Copy link
Contributor Author

m-renaud commented Oct 5, 2021

@cycraig can you review?

@cycraig
Copy link
Contributor

cycraig commented Oct 5, 2021

Unfortunately I am unable to verify the workaround as I do not have access to a Mac with an M1 chip; I can only offer general comments.

NOTE: If you're on an M1 Mac the npm install command below will fail due to missing support for the architecture in the npm version of wasm-pack. To work around this use cargo install wasm-pack and then go directly to the npm run step.

The developer would still have to run npm install (and have it fail) to get the rest of the packages right? It's a tiny bit ambiguous whether they can skip that step altogether, to me at least.

The message alone lacks some context or directions for more information. This is a long-standing issue with wasm-pack we should link to: rustwasm/wasm-pack#952 . I wonder if opening up an issue here (or leaving this PR open) instead of updating the README.md file would offer better visibility and give more context?

Is there any way for us to make it easier for new developers by checking if they're using an M1 Mac when they run npm install? E.g. introduce a custom install script where if node -p process.arch reports arm64 (or whatever architecture is reported for an M1 chip) it automatically runs cargo install wasm-pack for them or displays an error message with instructions?

Does emulating an x86 architecture also work around this issue? E.g. running arch -x86_64 zsh as per https://www.jurnalanas.com/node-js-mac-m1/

@cycraig cycraig mentioned this pull request Oct 10, 2021
1 task
@JelleMillenaar JelleMillenaar added the Wontfix This will not be worked on label Oct 29, 2021
@JelleMillenaar
Copy link
Collaborator

Won't fix atm, but we will add proper documentation in the future to the wiki if the problem persists. Until then, we can reference to this PR for a work-around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants