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

Feature request: prebuilt module for darwin/arm64 (Apple M1) #118

Closed
malept opened this issue Sep 30, 2021 · 14 comments · Fixed by #126
Closed

Feature request: prebuilt module for darwin/arm64 (Apple M1) #118

malept opened this issue Sep 30, 2021 · 14 comments · Fixed by #126

Comments

@malept
Copy link
Contributor

malept commented Sep 30, 2021

Since more developers are starting to use Apple M1s for their development machines, it'd be great if there was a prebuilt binary for darwin-arm64 in addition to darwin-x64.

@blaenk
Copy link

blaenk commented Oct 30, 2021

I'm interested in this. I just got an M1 machine and can't build my electron project. I'm happy to help where I can on investigating this or pre-building a binary on my machine.

@jeffisfast
Copy link

+1 on this, I'm also unable to compile electron projects on a new iMac.

@malept
Copy link
Contributor Author

malept commented Oct 31, 2021

+1 on this, I'm also unable to compile electron projects on a new iMac.

Please don't add comments like this, that just spams folks who are subscribed to the issue. Instead use the 👍 reaction on the main issue, that will give a better indication of the number of people affected without the unnecessary notifications.

@blaenk
Copy link

blaenk commented Oct 31, 2021

Do any of you happen to have the homebrew GNU coreutils added to your PATH? Be careful, I'd double-check to see (echo $PATH and check for paths ending in gnubin for example) since it may have been a long while ago that you set that up.

I ask because I was investigating this yesterday to see if I could contribute a fix since it appeared like it should work since it uses node-gyp so even if a pre-built binary doesn't exist it should build it. Eventually during my investigation I realized that my GNU coreutils overrides were causing the issue. Removing them from my PATH allowed everything to work perfectly.

In case you need a reminder, the coreutils that come with macOS are BSD-variant vs the GNU coreutils one is more likely to find on Linux systems, so sometimes people install the coreutils package which is the GNU variant, but since the programs have the same name, they are given names with a g prefix, like e.g. gls rather than ls. So one thing one can optionally do is add certain directories to their PATH which basically have symlinks of the "real names" to the g-prefixed variants, e.g. ls → gls, so then when you invoke ls it'll invoke the GNU coreutils variant gls rather than the one that comes with macOS.

Overriding the coreutils is called out as a potentially dangerous thing to do for reasons like we are experiencing here: it could be that some scripts assume the BSD variants to be present on macOS, maybe they detect that they are on macOS so they use slightly different invocations of programs expecting them to be the BSD variants, or with different assumed behaviors/outcomes.

Anyway, it might be useful for you all to check and try building it again with npm install --build-from-source (of course make sure your changes to your PATH have taken effect).

It worked for me to build this package, but also I went back to my electron app that transitively depends on this via electron-rebuild and (notably) removed node_modules and re-ran (for me) yarn install, and everything worked perfectly without any modification necessary.

I'm going to have to figure out what the best path forward may be for the use of GNU coreutils on mac, in terms of ergonomics and safety with respect to breaking other apps, but at least it seems (for me at least) that this was the culprit here.

@jeffisfast
Copy link

Thanks blaenk!

Two things on note:

  1. Yes, I had gnu coreutils installed in my homebrew bin folder, not sure if I did it or something else required it. Removing homebrew's bin path from my PATH fixed it.
  2. My source tree was inside a folder that had a space in it (ie: /home/users/johnsmith/Big Electron Project/blah/) and the space was breaking some node module installs because they weren't quoting the entire path. Interestingly, this wasn't a problem with gnu coreutils in the path. Removing the space from the path solved the issue.

@QuiiBz
Copy link

QuiiBz commented Nov 27, 2021

Hello, I was wondering what's the status of this issue? I can't install electron-rebuild, so can't rebuild node-pty.

@AngryPowman
Copy link

Any updates on this? I am using M1 and can't build electron-rebuild , so can't rebuild electron-forge.

@blaenk
Copy link

blaenk commented Dec 8, 2021

@QuiiBz @AngryPowman did you check if by any chance you were experiencing what I described? I'm fully able to build this and by extension electron-rebuild on an M1 Mac with no problem.

@MaLIE2018 @MattBarkway you're all still running into issues? Aside from the coreutils issue which I explained, you should be able to build just fine.

@QuiiBz
Copy link

QuiiBz commented Dec 8, 2021

did you check if by any chance you were experiencing what I described?

Yes, I tried but that didn't work. I had to manually run this command to rebuild node-pty (so without electron-rebuild)

@blaenk
Copy link

blaenk commented Dec 8, 2021

Maybe you would like to share your PATH, because given that @jeffisfast and I are able to build without any issue whatsoever (builds super fast and cleanly), it may be something on your end, after all it was something on our end which was causing the issue to begin with.

And like the rest of you, I'm also talking about electron-rebuild (through electron-forge).

@MaLIE2018
Copy link

I solved it by installing node with x64 architecture on mac with m1 chip.

@blaenk
Copy link

blaenk commented Dec 9, 2021

Ah okay got it. I think some of us are interested in having native M1 builds so just installing x64 node and using Rosetta wasn't really an option.

Glad it works for you though.

@beorn
Copy link

beorn commented Jan 5, 2022

I solved it by installing node with x64 architecture on mac with m1 chip.

This isn't really a solution - and currently doesn't even work: electron/electron#32266

@QuiiBz
Copy link

QuiiBz commented Jan 6, 2022

The real solution would be to provide prebuilt binaries for Darwin arm64. I’ll certainly make a fork if this doesn’t happen in this repo, because I think it’s a blocker for many people (including me).

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 a pull request may close this issue.

7 participants