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

Build fails on Node 16.4 ARM M1 #305

Closed
stevenmunro opened this issue Jun 29, 2021 · 38 comments
Closed

Build fails on Node 16.4 ARM M1 #305

stevenmunro opened this issue Jun 29, 2021 · 38 comments

Comments

@stevenmunro
Copy link

I note there are new ARM builds but trying yarn add argon2 fails on my system.

Big Sur 11.3
Node v16.4.0

Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.5
node-pre-gyp info using node@16.4.0 | darwin | arm64
node-pre-gyp info check checked for "/Volumes/Samsung 850PRO/NEXTJS_Sites/restaurant/node_modules/argon2/lib/binding/napi-v3/argon2.node" (not found)
node-pre-gyp http GET https://github.com/ranisalt/node-argon2/releases/download/v0.28.2/argon2-v0.28.2-napi-v3-darwin-arm64-unknown.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/ranisalt/node-argon2/releases/download/v0.28.2/argon2-v0.28.2-napi-v3-darwin-arm64-unknown.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for argon2@0.28.2 and node@16.4.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/ranisalt/node-argon2/releases/download/v0.28.2/argon2-v0.28.2-napi-v3-darwin-arm64-unknown.tar.gz
[...] 
@ranisalt
Copy link
Owner

ranisalt commented Jun 30, 2021

Odd, indeed there is no Darwin ARM64 build even though we have it in the pipeline

image

Meanwhile, try using npm rebuild argon2 --build-from-source to recompile it. You need a C++ compiler installed.

@ranisalt
Copy link
Owner

Indeed, we build for ARM64 and for OS X but not for OS X on ARM64 together. I don't even think it is feasible, as GitHub Actions run on x86 and the run-on-arm64 action does not support OS X. For the time being, you will have to rebuild from sources.

@nVitius
Copy link

nVitius commented Jul 30, 2021

There's an open issue for M1 support on github actions: actions/runner-images#2187

It looks like there hasn't been any updates on it since December of last year.

@SirawichDev
Copy link

so any updates about arm64 ?

@partyconfetti
Copy link

anything?

@power-f-GOD
Copy link

Anything?

@maxgfr
Copy link

maxgfr commented Jan 17, 2022

To solve this problem, I downgrade my node version to v14 by using nvm :

nvm install 14 
nvm use 14

@zikster3262
Copy link

zikster3262 commented Jan 22, 2022

any news ? Rebuild from source does not work unfortunately.

@Tooluloope
Copy link

Still fails on node v16.7.0

@ranisalt
Copy link
Owner

No development from Github on supporting M1 for Actions, so no progress on this issue yet :(

@partyconfetti
Copy link

partyconfetti commented Jan 27, 2022

The package sharp has an ARM build, it says MacStadium but maybe you can try it out? You can checkout the commit here: lovell/sharp@21d1a7c

Also seems like MacStadium is supporting open source projects! https://www.macstadium.com/opensource

@Nantris
Copy link

Nantris commented Mar 1, 2022

Thanks for all the hard work @ranisalt! Any update on this?

Any possibility this could accelerate the timeline? Looks very promising and apparently usable today. hkratz/gha-runner-osx-arm64#2

Collection of some other related threads: gitx/gitx#289


Currently node-argon2 is the only dependency holding us back from support for Apple M1 platforms, so please let me know if there's anything we can do to help!

@ranisalt
Copy link
Owner

ranisalt commented Mar 4, 2022

@slapbox definitely, will keep track of these in order to support ARM64 OS X as soon as possible.

@partyconfetti
Copy link

partyconfetti commented Mar 4, 2022

Note on node-gyp fails. Apparently, I've been using my old .npmrc file from my old non-M1 computer, and it had a node_gyp=[definitely not existing path] line in it. This was preventing yarn from building the package.
Hope this helps someone!

@Moebits
Copy link

Moebits commented Apr 6, 2022

This still doesn't install on M1 Macs a year later.

I hope that this is given a higher priority. In the meantime I guess I'll use bcrypt.

@Nantris
Copy link

Nantris commented Apr 6, 2022

@Tenpi in theory you should be able to build the package from source on M1 machines. It's really just those of us without M1 machines that are out of luck for now.

@ranisalt
Copy link
Owner

ranisalt commented Apr 6, 2022

This still doesn't install on M1 Macs a year later.

You should be able to install it from source as @slapbox mentioned. It is a priority to get it working decently on every major platform but this project doesn't really have the resources to do so swiftly :(

@Nantris
Copy link

Nantris commented Apr 6, 2022

M1 chips have made trouble for many projects. It's hardly something node-argon2 is alone in.

Is there anything the users of this project can do to help accelerate the process?

@ranisalt
Copy link
Owner

ranisalt commented Apr 7, 2022

Donate a M1 to me so I can work around that 😆 but seriously, I applied to MacStadium as per @partyconfetti suggestion, and hopefully the workflow used by sharp can be just copy-pasted.

@gpetrov
Copy link

gpetrov commented May 7, 2022

Compiling arm64 images for Darwin (Mac) is also possible on intel with cross compilation.

Check some of the other projects that does that already, like: https://github.com/lovell/sharp-libvips/blob/main/.github/workflows/build-release.yml

How it is done: lovell/sharp-libvips#74

@Nantris
Copy link

Nantris commented May 21, 2022

@ranisalt - Does this get us any closer? actions/runner#1618 (comment)

@Nantris
Copy link

Nantris commented Jun 16, 2022

@ranisalt did you ever hear back about your MacStadium application? Any news on this generally?

I hate to keep bumping this thread, but I also dislike that our installer size is 500mb for macOS users (certainly not saying that's your fault - I am very grateful for your work.) I'm eagerly anticipating the day node-argon2 can have a prebuilt binary for ARM-based macOS devices.

@ranisalt
Copy link
Owner

@slapbox I got an approval from MacStadium a couple of days ago, but I'm on vacation for this week, after that I'll be able to work on it - and it shouldn't be very long since you guys helped a lot already :)

If you prefer, you can open a pull request configuring it and I will set up the token when needed.

@Shiinoya
Copy link

Shiinoya commented Jun 24, 2022

If you can afford to upgrade, using Node 18.1.0 fixed the issue for me. Rebuilding from source wasn't doing the trick.

@Nantris
Copy link

Nantris commented Aug 9, 2022

Any updates @ranisalt? Not to rush you of course; I super appreciate that you even shared this project to begin with! A few macOS users are dismayed at the giant size of the dual-architecture installer we're distributing in the meanwhile which got this back on my radar.

If I had any experience with MacStadium I'd be happy to help with a PR, but sadly I haven't got a clue.

@ranisalt
Copy link
Owner

@slapbox I'm working on that now on the macos-m1 branch. MacStadium has answered me quite a while ago, but I was super busy changing jobs and now I'm setting up the runner to test, build & deploy the M1 (and possibly M2) versions.

@ranisalt
Copy link
Owner

Here we go! Please help me test v0.29.0

@Nantris
Copy link

Nantris commented Sep 7, 2022

Thank you so much for your outstanding work @ranisalt! I finally got a chance to give this a try and it's looking great!

@necm1
Copy link

necm1 commented Sep 19, 2022

Macbook Pro M2 2022 user here - still getting following error:
'node_modules/argon2/lib/binding/napi-v3/argon2.node' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)))

I tried it with using v0.29.0 but sadly it didn't work, even with v0.29.1


Fixed this by changing my architecture with following commands (using nvm):

necmi@MBP-von-Necmi gc-backend % arch -x86_64 zsh
necmi@MBP-von-Necmi gc-backend % nvm uninstall v16.14.2
Uninstalled node v16.14.2
necmi@MBP-von-Necmi gc-backend % nvm install v16.14.2

It should install (depending on your system) https://nodejs.org/dist/v18.9.0/node-v18.9.0-darwin-x64.tar.xz instead of https://nodejs.org/dist/v18.9.0/node-v18.9.0-darwin-arm64.tar.xz

@ranisalt
Copy link
Owner

@necm1 this is an upstream issue, it is @mapbox/node-pre-gyp that decides what prebuilt to install. Can you open an issue there and link back so we can track it?

@Nantris
Copy link

Nantris commented Sep 19, 2022

Standing by to smash the thumbs up button on that issue when you've created it @necm1.

@jodem
Copy link

jodem commented May 3, 2023

Updating to 0.29 (you can force sub lib to use 29 with override directive in package.json) worked like a charm, thanks.

@buildreactive
Copy link

Still seems to be failing? I notice homebrew has an argon2 install available for M1 silicon. Wondering if I can install that and somehow it works in my Elixir apps... in the meantime latest attempt to build:

17:32:23.289 [error] Process #PID<0.7222.0> raised an exception
** (RuntimeError) An error occurred when loading Argon2.
Make sure you have a C compiler and Erlang 20 installed.
If you are not using Erlang 20, either upgrade to Erlang 20 or
use bcrypt_elixir (version 0.12) or pbkdf2_elixir.
See the Comeonin wiki for more information.

    (argon2_elixir 3.1.0) lib/argon2/base.ex:19: Argon2.Base.init/0
    (kernel 8.5.4) code_server.erl:1317: anonymous fn/1 in :code_server.handle_on_load/5
17:32:23.290 [warning] The on_load function for module Elixir.Argon2.Base returned:
{%RuntimeError{
   message: "An error occurred when loading Argon2.\nMake sure you have a C compiler and Erlang 20 installed.\nIf you are not using Erlang 20, either upgrade to Erlang 20 or\nuse bcrypt_elixir (version 0.12) or pbkdf2_elixir.\nSee the Comeonin wiki for more information.\n"
 },
 [
   {Argon2.Base, :init, 0,
    [file: 'lib/argon2/base.ex', line: 19, error_info: %{...}]},
   {:code_server, :"-handle_on_load/5-fun-0-", 1,
    [file: 'code_server.erl', line: 1317]}
 ]}

Which is a really strange error at this stage...

@Firefly % elixir --version
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:20:20] [ds:20:20:10] [async-threads:1] [jit] [dtrace]

Elixir 1.14.4 (compiled with Erlang/OTP 25)

@ranisalt
Copy link
Owner

@buildreactive wrong repository? This one has nothing to do with Elixir or Erlang

@buildreactive
Copy link

buildreactive commented May 12, 2023

It's not an Elixir issue, it's a build issue related to argon2 (so... ya, maybe wrong repo? At first I thought this was the old "won't build M1" issue).

But updating here with solution anyhow.

Problem started when I added argon2 as a project dependency. Pulling in argon2 generates an error, and the error seems to be saying "you need a C compiler to compile argon2." (Which is silly, and a misdiagnosis, since I have a C compiler).

So... After a good bit of digging and experimenting... I found the problem is caused by having a space in the project path. Moving the project to a new path (with no space) fixes it – and all builds just fine now.

So... workaround: Don't use spaces. Ultimate fix(?): Find out why the build fusses over a space?

@Nantris
Copy link

Nantris commented May 14, 2023

Never using spaces in a project's path is generally good practice because it's just not worth the headaches that spaces can cause.

@ranisalt
Copy link
Owner

@buildreactive report that at riverrun/argon2_elixir, this repo is for the Javascript bindings for Argon2

@kadiryaren
Copy link

kadiryaren commented Oct 31, 2023

FOUND!

I found a solution. in my m2 pro cpu device after running pip3 install setuptools worked for argon.

Error occurs because of that if you use python 3.12+ distutils package doesnt maintained anymore. In 3.12 you should use
pip3 install setuptools to install package.

Dont ask me whats the relation between argon and python. I dont know. I saw ModuleNotFound error on argon installation.

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

No branches or pull requests