-
Notifications
You must be signed in to change notification settings - Fork 32
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
[BUG] ** (UndefinedFunctionError) function Argon2.Base.hash_password/3 is undefined (module Argon2.Base is not available) #39
Comments
This may be fixed by #40 |
One small thing - you don't need to add I notice that you are using docker. Have you read the deployment section in the comeonin wiki? |
Yes, I tried everything there and got the exact same error. |
You could also try running Let me know how you get on. I am afraid I might not be able to help you much over the next couple of weeks, as I am going away on a retreat later today. |
That worked for me. Will the referenced PR #40 solve this? |
I will close this issue now. If you have any other issues, just let me know. |
The problem is still there. We are not ready to close this issue. |
Sorry, I thought you said that forcing the rebuild worked for you. I closed the pull request because I am almost sure that that is not the answer. I will try to find out more information about how to set up this with Docker, as I think that is where the problem lies. |
First, please make sure that the If that does not work, try adding And if that does not work, try running Let me know how you get on. |
Part of the problem is that the In the
Yet, the It doesn't look like this issue can be fixed with a PR. The WorkaroundThis is what I had to do to get argon2_elixir working in Ubuntu:
From there, you can compile the project and run it. |
@moxley thanks for the input. About the |
@riverrun: Correct. The |
@moxley the |
@riverrun: Got it. My mistake. Thinking about this further, I wonder if this is a problem with all packages that need to build a nif. I develop my project in macOS, then build it on Ubuntu 18.04 running in Docker. When |
For use with Docker, you need to add the |
@riverrun: The problem with not including the I might try a different release build setup that involves creating a separate clone of my repo. This repo will only be used for building releases. That way, no special steps need to be take with caching. |
Hi, I'm having a similar issue in my project when running my test suite:
It happens regularly, at least 1 in 10 times when running my test suite. Neither deleting I also tried the other solution mentioned after deleting
|
@AlphaHydrae try asking about this on Stack Overflow or Elixirforum - there you might find users of Mac / Otp 23 who can help you more than I can. If any changes need to be made to this repository (in the code or documentation), please let me know. |
@AlphaHydrae I have the same issue and what works for me is running |
I have the same issue as @AlphaHydrae does, I'm on Ubuntu 20.04. It happens sometimes and only with async tests and across many projects - some use Argon, others Brcypt, but not on all setups - might have something to do with Ryzen CPU that has too many cores, I did not have that problem on the same projects with the old i7 4 core CPU. At the moment I made all the tests that have to do with Argon or Brcypt synchronous which seems to fix the issue. |
The issue @AlphaHydrae is running into is an issue with Erlang/OTP 23 which has been fixed master. So watch for the next Erlang/OTP 23 release. |
Thanks @riverrun, @hl & @josevalim.
I will try the new Erlang/OTP release as soon as it's out. |
@josevalim was this fixed in OTP 23.0.3? |
Yes. |
@riverrun looks like this can be closed |
I have verified that the issue appears to be fixed in my project with OTP 23.0.3. I can no longer reproduce the error. |
It was erts bug OTP-16704 here http://erlang.org/download/OTP-23.0.3.README, works now for me as well. |
Worked for me |
Hello. I seem to be having the same issue but the above isn't solving it for me. I am on Elixir 1.11.3 and Erlang 23.2.3 (both using
I have deleted the I can see it recreating the The error log is as follows:
Would appreciate any insights.... thanks |
@kalouo try updating to version 2.4. There were some changes to the Makefile, and they might solve your issue. Let me know how you get on. |
Thanks for the prompt reply @riverrun I upgraded as suggested:
This also effected updates for I ran everything again after |
(tried with and without the solution said to have worked above) |
Still have not figured this out. I can see argon2 compiling as below:
|
I will try to find out what I can, but you might get a better response by trying https://elixirforum.com/ and / or by opening an issue at https://github.com/elixir-lang/elixir_make |
I am facing the same issue as @kalouo |
I was facing the same issue, in my case. I used VS Code terminal to compile in my Macbook Air |
I am also experiencing this issue on a 13" M1 macbook pro. Has anyone figured out a solution? |
When I run |
@paridin @wilkinson4 I only get this error on M1 when I run it from an embedded terminal (VSCode, vim etc). When I run it from an iterm window everything work. Maybe this is a clue to work around it. |
What ultimately worked for me was switching my terminal to run in the Intel-based arch via this terminal command: Change to Intel arch Change back to Arm arch |
I didn't do that. I just run iterm with no |
Had the same issue but noticed a warning (make) because there was a space in one of the directory names.(Cloud folder set by the system). I moved everything to another folder and it worked...could this be a clue? |
For me on win10, choose the right arch(x64/x86) Although |
@etern thanks for the info. Glad to hear you got it working. |
Hi @riverrun same issue with this try to use Argon2.add_hash but returns function Argon2.Base.hash_password/3 is undefined (module Argon2.Base is not available). I'm using ubuntu 18.04 |
Having the same issue. I can do [error] Process #PID<0.692.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.0.0) lib/argon2/base.ex:19: Argon2.Base.init/0
(kernel 8.2) code_server.erl:1317: anonymous fn/1 in :code_server.handle_on_load/5
[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]}
]}
[error] #PID<0.688.0> running 123Web.Endpoint (connection #PID<0.679.0>, stream id 3) terminated
Server: localhost:4000 (http)
Request: POST /api/graphiql
** (exit) an exception was raised:
** (UndefinedFunctionError) function Argon2.Base.gen_salt/1 is undefined (module Argon2.Base is not available)
(argon2_elixir 3.0.0) Argon2.Base.gen_salt(16)
(argon2_elixir 3.0.0) lib/argon2.ex:77: Argon2.hash_pwd_salt/2
(123 0.1.0) lib/123/association/association.ex:83: 123.Association.validate_password_hash/1
(123 0.1.0) lib/123/association/association.ex:46: 123.Association.changeset/2
(123 0.1.0) lib/123/association/associations.ex:89: 123.Associations.create/1
(absinthe 1.7.0) lib/absinthe/resolution.ex:206: Absinthe.Resolution.call/2
(absinthe 1.7.0) lib/absinthe/phase/document/execution/resolution.ex:230: Absinthe.Phase.Document.Execution.Resolution.reduce_resolution/1
(absinthe 1.7.0) lib/absinthe/phase/document/execution/resolution.ex:185: Absinthe.Phase.Document.Execution.Resolution.do_resolve_field/3
(absinthe 1.7.0) lib/absinthe/phase/document/execution/resolution.ex:170: Absinthe.Phase.Document.Execution.Resolution.do_resolve_fields/6
(absinthe 1.7.0) lib/absinthe/phase/document/execution/resolution.ex:88: Absinthe.Phase.Document.Execution.Resolution.walk_result/5
(absinthe 1.7.0) lib/absinthe/phase/document/execution/resolution.ex:67: Absinthe.Phase.Document.Execution.Resolution.perform_resolution/3
(absinthe 1.7.0) lib/absinthe/phase/document/execution/resolution.ex:24: Absinthe.Phase.Document.Execution.Resolution.resolve_current/3
(absinthe 1.7.0) lib/absinthe/pipeline.ex:384: Absinthe.Pipeline.run_phase/3
(absinthe_plug 1.5.8) lib/absinthe/plug.ex:536: Absinthe.Plug.run_query/4
(absinthe_plug 1.5.8) lib/absinthe/plug.ex:290: Absinthe.Plug.call/2
(phoenix 1.6.6) lib/phoenix/router/route.ex:41: Phoenix.Router.Route.call/2
(phoenix 1.6.6) lib/phoenix/router.ex:355: Phoenix.Router.__call__/2
(123 0.1.0) lib/123_web/endpoint.ex:1: 123Web.Endpoint.plug_builder_call/2
(123 0.1.0) lib/plug/debugger.ex:136: 123Web.Endpoint."call (overridable 3)"/2
(123 0.1.0) lib/123_web/endpoint.ex:1: 123Web.Endpoint.call/2 I've tried this solution and tried the following steps rm -rf _build/* && rm -rf deps/* && mix deps.get && mix deps.compile Nothing seems to work |
After you delete _build and deps, can you paste the output of “mix compile”? Do you see argon being compiled, including the C files? |
@josevalim , this is the output from my ===> Analyzing applications...
===> Compiling yamerl
08:34:21.787 [info] Compiling file system watcher for Mac...
08:34:22.511 [info] Done.
==> file_system
Compiling 7 files (.ex)
Generated file_system app
==> connection
Compiling 1 file (.ex)
Generated connection app
==> nimble_parsec
Compiling 4 files (.ex)
Generated nimble_parsec app
==> bunt
Compiling 2 files (.ex)
Generated bunt app
==> gettext
Compiling 1 file (.yrl)
Compiling 1 file (.erl)
Compiling 21 files (.ex)
Generated gettext app
===> Analyzing applications...
===> Compiling ranch
===> Analyzing applications...
===> Compiling telemetry
===> Analyzing applications...
===> Compiling telemetry_poller
==> telemetry_metrics
Compiling 7 files (.ex)
Generated telemetry_metrics app
==> decimal
Compiling 4 files (.ex)
Generated decimal app
==> jason
Compiling 10 files (.ex)
Generated jason app
==> sobelow
Compiling 51 files (.ex)
warning: Macro.to_string/2 is deprecated. Use Macro.to_string/1 instead
Invalid call found at 2 locations:
lib/sobelow/print.ex:212: Sobelow.Print.print_code/2
lib/sobelow/print.ex:226: Sobelow.Print.print_file_path_code/2
Generated sobelow app
==> comeonin
Compiling 4 files (.ex)
Generated comeonin app
==> yaml_elixir
Compiling 6 files (.ex)
Generated yaml_elixir app
==> mix_audit
Compiling 16 files (.ex)
Generated mix_audit app
==> scrivener
Compiling 4 files (.ex)
Generated scrivener app
==> elixir_make
Compiling 1 file (.ex)
Generated elixir_make app
==> argon2_elixir
mkdir -p /Users/ruisousa/Desktop/Dev/123/123/_build/dev/lib/argon2_elixir/priv
cc -g -O3 -pthread -Wall -Wno-format-truncation -I"/opt/homebrew/Cellar/erlang/24.2.1/lib/erlang/erts-12.2.1/include" -Iargon2/include -Iargon2/src -Ic_src -dynamiclib -undefined dynamic_lookup argon2/src/argon2.c argon2/src/core.c argon2/src/blake2/blake2b.c argon2/src/thread.c argon2/src/encoding.c argon2/src/ref.c c_src/argon2_nif.c -o /Users/ruisousa/Desktop/Dev/123/123/_build/dev/lib/argon2_elixir/priv/argon2_nif.so
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.
Compiling 3 files (.ex)
Generated argon2_elixir app
==> db_connection
Compiling 14 files (.ex)
Generated db_connection app
==> credo
Compiling 242 files (.ex)
Generated credo app
==> credo_envvar
Compiling 1 file (.ex)
Generated credo_envvar app
==> credo_naming
Compiling 4 files (.ex)
Generated credo_naming app
==> ecto
Compiling 56 files (.ex)
Generated ecto app
==> dataloader
Compiling 4 files (.ex)
Generated dataloader app
==> absinthe
Compiling 1 file (.yrl)
Compiling 1 file (.erl)
Compiling 256 files (.ex)
Generated absinthe app
==> absinthe_error_payload
Compiling 6 files (.ex)
Generated absinthe_error_payload app
==> phoenix_pubsub
Compiling 11 files (.ex)
Generated phoenix_pubsub app
===> Analyzing applications...
===> Compiling cowlib
===> Analyzing applications...
===> Compiling cowboy
===> Analyzing applications...
===> Compiling cowboy_telemetry
==> mime
Compiling 1 file (.ex)
Generated mime app
==> postgrex
Compiling 64 files (.ex)
Generated postgrex app
==> ecto_sql
Compiling 26 files (.ex)
Generated ecto_sql app
==> table_rex
Compiling 7 files (.ex)
Generated table_rex app
==> ecto_psql_extras
Compiling 32 files (.ex)
Generated ecto_psql_extras app
==> scrivener_ecto
Compiling 2 files (.ex)
Generated scrivener_ecto app
==> plug_crypto
Compiling 5 files (.ex)
Generated plug_crypto app
==> plug
Compiling 1 file (.erl)
Compiling 41 files (.ex)
warning: System.stacktrace/0 is deprecated. Use __STACKTRACE__ instead
lib/plug/conn/wrapper_error.ex:26: Plug.Conn.WrapperError.reraise/3
Generated plug app
==> phoenix_html
Compiling 8 files (.ex)
Generated phoenix_html app
==> phoenix_view
Compiling 5 files (.ex)
Generated phoenix_view app
==> plug_cowboy
Compiling 5 files (.ex)
Generated plug_cowboy app
==> phoenix
Compiling 69 files (.ex)
Generated phoenix app
==> phoenix_live_view
Compiling 31 files (.ex)
Generated phoenix_live_view app
==> phoenix_live_dashboard
Compiling 40 files (.ex)
Generated phoenix_live_dashboard app
==> cors_plug
Compiling 1 file (.ex)
Generated cors_plug app
==> absinthe_plug
Compiling 18 files (.ex)
Generated absinthe_plug app
==> absinthe_phoenix
Compiling 9 files (.ex)
Generated absinthe_phoenix app
==> phoenix_ecto
Compiling 7 files (.ex)
Generated phoenix_ecto app I'm kinda new to Elixir so I'm unsure if this is looks as expected |
It looks expected. It can compile it successfully so the only issue I can think of is the one you linked, that somehow you are compiling to something that doesn't match the architecture of your system. You can run |
Environment
Debian:stretch (base image for Elixir 1.9: https://github.com/c0b/docker-elixir/blob/0d9f47458468a8bf1407374731cbec077ab6f895/1.9/Dockerfile)
Current behavior
mix ecto.setup
crashes with the following error:Expected behavior
App should start up and use Argon2 effectively.
Additional information
Dependencies:
The text was updated successfully, but these errors were encountered: