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 Darwin arm64 #424

Open
theophoric opened this issue Feb 23, 2021 · 10 comments
Open

Add support for Darwin arm64 #424

theophoric opened this issue Feb 23, 2021 · 10 comments
Labels
bug Something isn't working T-dev-tools

Comments

@theophoric
Copy link

theophoric commented Feb 23, 2021

Describe the bug
getBinary() in near-vm throws an error if run on M1 / Arm mac os. This exception is not necessary; near-vm-runner-standalone 1.1.0 runs fine on ARM macs.

To Reproduce
Run yarn install from any project that imports near-sdk-as on an m1 mac.

Expected behavior
It compiles.

Screenshots

$ yarn install
. . . 
near-vm/getBinary.js:17
throw new Error(`Unsupported platform: $

{type} 

$

{arch} 

`);
^

Error: Unsupported platform: Darwin arm64

Desktop (please complete the following information):

  • OS: Mac 11+, M1 / ARM mac mini
  • Version <= 2.2.0
@theophoric theophoric added the bug Something isn't working label Feb 23, 2021
@willemneal
Copy link
Contributor

Currently we don't generate the binary for m1, so this would fix the install but I'd fail when executing the VM. This binary is used in the simulation testing, which is a very limited tool and is deprecated in favor of near-sdk-sim. The new simulator aims to be compiled to Wasm, which will eliminate the need to create native binaries.

@danielwpz
Copy link

hey @willemneal , the issue is still there now. Shall we remove the dependency of near-vm?

@chrispanag
Copy link

Hello all, any plans on fixing that? As M1 Macbooks become more and more prolific, devs (like us) need to spend more time setting up a separate env (if that's available) etc.

Thanks for all the work up until now :)

@agileurbanite
Copy link

+1 facing this issue as well, this seems to be a dependency for a dependency on create-near-app which makes yarn dev fail

@agileurbanite
Copy link

seems related to: near/create-near-app#1260

@wilsonsilva
Copy link

It works. Follow this article: https://www.jurnalanas.com/node-js-mac-m1/

If you used asdf to install node, reinstall it using this command arch -x86_64 asdf install nodejs 17.4.0

This might also be useful: https://docs.near.org/docs/faq/developer-faq#4-building-smart-contracts-on-apple-m1-arm64

@agileurbanite
Copy link

Awesome thanks for that reference, we should consider adding a reference to that to the README.md in the repo. Created #693 so we can track it and issue a PR against it.

@agileurbanite
Copy link

Related to #693

@wottpal
Copy link

wottpal commented Jan 26, 2022

Even though that might work it shouldn't be considered good practice to switch the architecture of your node installation. This has performance implications and also adds another layer of complexity for newcomers with M1-devices. Instead arm64 should be supported everywhere.

I got create-near-app running on my M1 machine with just adding those dependencies manually via yarn add near-sdk-as asbuild and by ignoring the installation-error. yarn dev seems to run fine after that even without changing my node-arch.

@Doc-Failure
Copy link

With node v12.22.7, everything works smoothly, but I don't think that's a great workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working T-dev-tools
Projects
None yet
Development

No branches or pull requests

8 participants