riverrun / bcrypt_elixir

Bcrypt password hashing for Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apple Silicon Elixir 1.11.2 doesn't want to build 2.2.0

wallyfoo opened this issue · comments

Installed erlang 23.2.1 and exilir 1.11.3-otp-23 for Apple Silicon using asdf install latest.

Using comeonin associated with the phx-gen-auth libraries.

Deleted /deps and /_build.

mix deps.get
iex -S mix phx.server to rebuild.

When trying to authenticate or register in my phoenix app, comeonin can't find the bcrypt.nif and I get the following error:

** (RuntimeError) An error occurred when loading Bcrypt.
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 version 0.12 of bcrypt_elixir.
See the Comeonin wiki for more information.

    (bcrypt_elixir 2.2.0) lib/bcrypt/base.ex:17: Bcrypt.Base.init/0
    (kernel 7.2) code_server.erl:1355: anonymous fn/1 in :code_server.handle_on_load/5
[warn] The on_load function for module Elixir.Bcrypt.Base returned:
{%RuntimeError{
   message: "An error occurred when loading Bcrypt.\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 version 0.12 of bcrypt_elixir.\nSee the Comeonin wiki for more information.\n"
 },
 [
   {Bcrypt.Base, :init, 0, [file: 'lib/bcrypt/base.ex', line: 17]},
   {:code_server, :"-handle_on_load/5-fun-0-", 1,
    [file: 'code_server.erl', line: 1355]}
 ]}

Reverting back to my old Intel-compiled versions of Erlang and elixir (23.0.3 and 1.10.4-otp-2) and doing the delete/rebuild song and dance, the app compiles correctly, and authentication can resume.

Now, just switching to the M1 elixir with the intel erlang? That build works.

Not sure what exactly is going on, but it would appear that bcrypt_elixir 2.2.0 doesn't recognize something in the latest M1 build of erlang? Thought I should start here before heading over to comeonin.

I am not sure how much I can help you with this, but as it is related to the compiler, you might want to try opening an issue at elixir_make.

Another option is to ask a question at elixirforum. That way you will be able to reach out to more developers who might have had similar issues.

Let me know how you get on, and obviously if there are any changes needed here, I will happily implement them.

Closing as it seems that this was fixed in #30