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

[BUG] ** (UndefinedFunctionError) function Argon2.Base.hash_password/3 is undefined (module Argon2.Base is not available) #39

Open
medikent opened this issue Dec 10, 2019 · 49 comments

Comments

@medikent
Copy link

Environment

Current behavior

mix ecto.setup crashes with the following error:

[error] Process #PID<0.755.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) lib/argon2/base.ex:19: Argon2.Base.init/0
    (kernel) code_server.erl:1340: anonymous fn/1 in :code_server.handle_on_load/5
[warn] 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]}, {:code_server, :"-handle_on_load/5-fun-0-", 1, [file: 'code_server.erl', line: 1340]}]}

** (UndefinedFunctionError) function Argon2.Base.hash_password/3 is undefined (module Argon2.Base is not available)
    (argon2_elixir) Argon2.Base.hash_password("john_doe", <<132, 208, 122, 4, 176, 119, 50, 178, 233, 162, 230, 117, 153, 129, 11, 130>>, [])
    (argon2_elixir) lib/argon2.ex:140: Argon2.add_hash/2
    (exampleapp) lib/exampleapp/schemas/organization/organization_user.ex:41: ExampleApp.Schemas.Organization.OrganizationUser.hash_password/1
    (exampleapp) lib/exampleapp/schemas/organization/organization_user.ex:34: ExampleApp.Schemas.Organization.OrganizationUser.create_changeset/2
    (exampleapp) lib/exampleapp/contexts/organization/organization_user.ex:29: ExampleApp.Contexts.Organization.OrganizationUser.create_public/1
    (exampleapp) lib/exampleapp/contexts/organization/organization_user.ex:15: ExampleApp.Contexts.Organization.OrganizationUser.create/2
    priv/repo/seeds.exs:53: (file)
    (elixir) lib/code.ex:813: Code.require_file/2
    (mix) lib/mix/tasks/run.ex:145: Mix.Tasks.Run.run/5
    (mix) lib/mix/tasks/run.ex:85: Mix.Tasks.Run.run/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/task.ex:365: Mix.Task.run_alias/3
    (mix) lib/mix/task.ex:292: Mix.Task.run/2
    (mix) lib/mix/task.ex:365: Mix.Task.run_alias/3
    (mix) lib/mix/task.ex:292: Mix.Task.run/2

Expected behavior

App should start up and use Argon2 effectively.

Additional information

Dependencies:

defp deps do
    [
      {:absinthe, "~> 1.4"},
      {:absinthe_phoenix, "~> 1.4"},
      {:absinthe_plug, "~> 1.4"},
      {:argon2_elixir, "~> 2.0"},
      {:comeonin, "~> 5.1"},
      {:cors_plug, "~> 2.0"},
      {:credo, "~> 1.1", only: [:dev, :test], runtime: false},
      {:dialyxir, "~> 1.0.0-rc.7", only: [:dev], runtime: false},
      {:ecto_sql, "~> 3.0"},
      {:elixir_uuid, "~> 1.2"},
      {:faker, "~> 0.13.0"},
      {:gettext, "~> 0.11"},
      {:jason, "~> 1.0"},
      {:joken, "~> 2.2"},
      {:mox, "~> 0.5.1", only: [:dev, :test]},
      {:phoenix, "~> 1.4.7"},
      {:phoenix_ecto, "~> 4.0"},
      {:phoenix_pubsub, "~> 1.1"},
      {:plug_cowboy, "~> 2.0"},
      {:postgrex, ">= 0.0.0"},
      {:scrivener_ecto, "~> 2.2"},
      {:mix_test_watch, "~> 1.0.2", only: :dev, runtime: false},
      {:triplex, "~> 1.3"}
    ]
  end
@medikent
Copy link
Author

This may be fixed by #40

@riverrun
Copy link
Owner

One small thing - you don't need to add comeonin to the dependencies anymore, as it is a dependency of argon2_elixir.

I notice that you are using docker. Have you read the deployment section in the comeonin wiki?

@medikent
Copy link
Author

Yes, I tried everything there and got the exact same error.

@riverrun
Copy link
Owner

You could also try running (cd deps/argon2_elixir && make clean && make) to force a rebuild of the argon2 binary - see #9 for more information.

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.

@medikent
Copy link
Author

That worked for me. Will the referenced PR #40 solve this?

@riverrun
Copy link
Owner

riverrun commented Jan 7, 2020

I will close this issue now. If you have any other issues, just let me know.

@riverrun riverrun closed this as completed Jan 7, 2020
@medikent
Copy link
Author

medikent commented Jan 7, 2020

The problem is still there. We are not ready to close this issue.
The published code, as it stands, still causes this issue as stated in the current behavior.

@riverrun
Copy link
Owner

riverrun commented Jan 8, 2020

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.

@riverrun riverrun reopened this Jan 8, 2020
@riverrun
Copy link
Owner

First, please make sure that the _build and deps folders have been added to .dockerignore - as recommended in the wiki and this issue.

If that does not work, try adding RUN cd deps/comeonin && make clean && make to the Dockerfile - as suggested in this issue.

And if that does not work, try running (cd deps/bcrypt_elixir && make clean && make) && mix deps.compile - as suggested here.

Let me know how you get on.

@moxley
Copy link

moxley commented Mar 16, 2020

Part of the problem is that the deps/argon2_elixir/priv directory exists as part of the argon2_elixir package.

In the elixir_make API docs, it says:

The "priv" directory must not exist in the source code"

https://hexdocs.pm/elixir_make/Mix.Tasks.Compile.ElixirMake.html#module-compilation-artifacts-and-working-with-priv-directories

Yet, the priv directory exists from the very beginning. The argon2_nif.so file will not build for the local system because elixir_make has determined that it is already built.

It doesn't look like this issue can be fixed with a PR. The priv directory needs to be removed as part of the packaging process. The mix.exs file is where to specify the files to include in the package, but it looks correct.

Workaround

This is what I had to do to get argon2_elixir working in Ubuntu:

mix deps.clean argon2_elixir
mix deps.get
rm -rf deps/argon2_elixir/priv

From there, you can compile the project and run it.

@riverrun
Copy link
Owner

@moxley thanks for the input. About the priv directory, it is created by the Makefile, so I might need to update the Makefile. I will look into this further and see how it needs to be updated.

@moxley
Copy link

moxley commented Mar 17, 2020

@riverrun: Correct. The priv directory is created by make, which is invoked by elixir_make. That's not the issue. The issue is that when you publish the package, you need to ensure that the priv directory is excluded from it.

@riverrun
Copy link
Owner

@moxley the priv directory is excluded. I just checked it.

@moxley
Copy link

moxley commented Mar 17, 2020

@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 argon2_elixir compiles, one step of the compilation builds a shared object file (argon2_nif.so) and saves it to deps/argon2_elixir/priv/argon2_nif.so. In another step, Mix copies the priv folder to _build/${MIX_ENV}/lib/argon2_elixir/priv. That works fine for local development. But when I build a release in Docker running Ubuntu, a Docker volume pulls everything in from deps/*, including the priv folder, into the running Docker container. elixir_make sees the priv folder already exists, so it skips running make, and Mix copies the priv folder to _build/prod/lib/argon2_elixir/priv. Now the production build has a argon2_nif.so file built for the wrong system.

@riverrun
Copy link
Owner

For use with Docker, you need to add the _build and deps directories to the .dockerignore file. This is mentioned in the wiki and this issue.

@moxley
Copy link

moxley commented Mar 17, 2020

@riverrun: The problem with not including the _build and deps directories is that it deletes any caching created during the release compilation. That makes release build times much longer. The workaround I gave above eliminates only the argon2_elixir cache, and it leaves all the other cache intact.

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.

@AlphaHydrae
Copy link

AlphaHydrae commented Jun 4, 2020

Hi, I'm having a similar issue in my project when running my test suite:

09:48:20.132 [error] Process #PID<0.670.0> raised an exception
** (ArgumentError) argument error
    :erlang.load_nif(:erlang, :apply)
    (argon2_elixir 2.3.0) lib/argon2/base.ex:120: Argon2.Base.load_nif/0
    (argon2_elixir 2.3.0) lib/argon2/base.ex:14: Argon2.Base.init/0
    (kernel 7.0) code_server.erl:1355: anonymous fn/1 in :code_server.handle_on_load/5
09:48:20.132 [error] Process #PID<0.677.0> raised an exception
** (ArgumentError) argument error
    :erlang.load_nif(:erlang, :apply)
    (argon2_elixir 2.3.0) lib/argon2/base.ex:120: Argon2.Base.load_nif/0
    (argon2_elixir 2.3.0) lib/argon2/base.ex:14: Argon2.Base.init/0
    (kernel 7.0) code_server.erl:1355: anonymous fn/1 in :code_server.handle_on_load/5
09:48:20.144 [warn] The on_load function for module Elixir.Argon2.Base returned:
{:badarg, [{:erlang, :load_nif, [:erlang, :apply], []}, {Argon2.Base, :load_nif, 0, [file: 'lib/argon2/base.ex', line: 120]}, {Argon2.Base, :init, 0, [file: 'lib/argon2/base.ex', ...]}, {:code_server, :"-handle_on_load/5-fun-0-", 1, [...]}]}



  1) test insert a newly created account (MyProject.Projections.UserAccountProjectionTest)
     apps/my_project/test/projections/user_account_projection_test.exs:9
     ** (UndefinedFunctionError) function Argon2.Base.hash_password/3 is undefined (module Argon2.Base is not available)
     code: event = Fixtures.build(:user_account_created)
     stacktrace:
       (argon2_elixir 2.3.0) Argon2.Base.hash_password("letmein-0", <<111, 139, 105, 183, 131, 13, 178, 200, 106, 167, 181, 99, 199, 161, 77, 49>>, [])
       (my_project 0.1.0) test/support/fixtures.ex:22: MyProject.Fixtures.user_account_created_factory/1
       test/projections/user_account_projection_test.exs:10: (test)

It happens regularly, at least 1 in 10 times when running my test suite. Neither deleting _build and deps, nor cd deps/argon2_elixir && make clean && make solves the issue.

I also tried the other solution mentioned after deleting _build and it did not work either:

mix deps.clean argon2_elixir
mix deps.get
rm -rf deps/argon2_elixir/priv
  • Dependency:

    "argon2_elixir": {:hex, :argon2_elixir, "2.3.0", "e251bdafd69308e8c1263e111600e6d68bd44f23d2cccbe43fcb1a417a76bc8e", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "28ccb63bff213aecec1f7f3dde9648418b031f822499973281d8f494b9d5a3b3"},
    
  • Erlang/OTP: 23.0.2

  • Elixir: 1.10.3-otp-23

  • OS: macOS Mojave 10.14.6

@riverrun
Copy link
Owner

@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.

@hl
Copy link

hl commented Jun 10, 2020

@AlphaHydrae I have the same issue and what works for me is running mix deps.compile argon2_elixir --force

@bcat-eu
Copy link

bcat-eu commented Jun 10, 2020

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.

@josevalim
Copy link

josevalim commented Jun 11, 2020

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.

@AlphaHydrae
Copy link

Thanks @riverrun, @hl & @josevalim.

mix deps.compile argon2_elixir --force did not solve the issue. It just happened again after 5 runs of my test suite.

I will try the new Erlang/OTP release as soon as it's out.

@anthonator
Copy link

@josevalim was this fixed in OTP 23.0.3?

@josevalim
Copy link

Yes.

@anthonator
Copy link

@riverrun looks like this can be closed

@AlphaHydrae
Copy link

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.

@bcat-eu
Copy link

bcat-eu commented Aug 10, 2020

It was erts bug OTP-16704 here http://erlang.org/download/OTP-23.0.3.README, works now for me as well.

@Caayu
Copy link

Caayu commented Dec 8, 2020

Part of the problem is that the deps/argon2_elixir/priv directory exists as part of the argon2_elixir package.

In the elixir_make API docs, it says:

The "priv" directory must not exist in the source code"

https://hexdocs.pm/elixir_make/Mix.Tasks.Compile.ElixirMake.html#module-compilation-artifacts-and-working-with-priv-directories

Yet, the priv directory exists from the very beginning. The argon2_nif.so file will not build for the local system because elixir_make has determined that it is already built.

It doesn't look like this issue can be fixed with a PR. The priv directory needs to be removed as part of the packaging process. The mix.exs file is where to specify the files to include in the package, but it looks correct.

Workaround

This is what I had to do to get argon2_elixir working in Ubuntu:

mix deps.clean argon2_elixir
mix deps.get
rm -rf deps/argon2_elixir/priv

From there, you can compile the project and run it.

Worked for me

@kalouo
Copy link

kalouo commented Feb 15, 2021

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 asdf) and using MacBook pro with an M1 chip.

Erlang/OTP 23 [erts-11.1.7] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
Elixir 1.11.3 (compiled with Erlang/OTP 23)

I have deleted the _build file and tried to execute the above steps – but it's not working.

I can see it recreating the /priv file on mix compile or mix test.

The error log is as follows:

 ** (UndefinedFunctionError) function Argon2.Base.hash_password/3 is undefined (module Argon2.Base is not available)
...
  (argon2_elixir 2.3.0) lib/argon2/base.ex:19: Argon2.Base.init/0
         (kernel 7.2) code_server.erl:1355: anonymous fn/1 in :code_server.handle_on_load/5
     17:09:07.761 [error] Process #PID<0.20439.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.

Would appreciate any insights.... thanks

@riverrun
Copy link
Owner

@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.

@kalouo
Copy link

kalouo commented Feb 15, 2021

Thanks for the prompt reply @riverrun

I upgraded as suggested:

 defp deps do
    [
      ...
      {:argon2_elixir, "~> 2.4"},
      ...
    ]
  end

This also effected updates for comeonin and elixir_make in the lock file.

I ran everything again after mix.deps clean --all and deleting the _build folder – unfortunately it didn't do the trick and getting the same error ... :-(

@kalouo
Copy link

kalouo commented Feb 15, 2021

(tried with and without the solution said to have worked above)

@kalouo
Copy link

kalouo commented Feb 16, 2021

Still have not figured this out. I can see argon2 compiling as below:

==> argon2_elixir
mkdir -p /Users/kalouo/Desktop/exchange-api/_build/dev/lib/argon2_elixir/priv
cc -g -O3 -pthread -Wall -Wno-format-truncation -I"/Users/kalouo/.asdf/installs/erlang/23.2.3/erts-11.1.7/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/kalouo/Desktop/exchange-api/_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

@riverrun
Copy link
Owner

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

@santoshD93
Copy link

I am facing the same issue as @kalouo

@paridin
Copy link

paridin commented Jul 30, 2021

I was facing the same issue, in my case.

I used VS Code terminal to compile in my Macbook Air M1 Chipset, which causes the related error module Argon2.Base is not available, to solve it, I downloaded the right version of VS Code VSCode-darwin-arm64 | Apple Silicon the default download is the VSCode-darwin-universal.

@wilkinson4
Copy link

I am also experiencing this issue on a 13" M1 macbook pro. Has anyone figured out a solution?

@wilkinson4
Copy link

When I run mix deps.compile I get the same issue as #40 .

@felipero
Copy link

@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.

@wilkinson4
Copy link

@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
arch -x86_64 zsh

Change back to Arm arch
arch -arm64 zsh

@felipero
Copy link

I didn't do that. I just run iterm with no arch change. My homebrew is also set to use the arm architecture too.

@maxmannen
Copy link

maxmannen commented Sep 27, 2021

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?
Running on Mac m1

@etern
Copy link

etern commented Jan 1, 2022

For me on win10, choose the right arch(x64/x86) Command Prompt for VS can solve the problem.

Although erl.exe is 32-bt executable, argon2_nif.dll must be compiled to 64-bit library to load normally, don't know why.

@riverrun
Copy link
Owner

riverrun commented Jan 4, 2022

@etern thanks for the info. Glad to hear you got it working.

@jeremy2009
Copy link

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

@ItzaMi
Copy link

ItzaMi commented May 3, 2022

Having the same issue.
I'm using Erlang/OTP 24, Elixir v1.13.3 and {:argon2_elixir, "~> 3.0"}.

I can do mix phx.server but doing a mutation requiring argon2_elixir throws me

[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

@josevalim
Copy link

After you delete _build and deps, can you paste the output of “mix compile”? Do you see argon being compiled, including the C files?

@ItzaMi
Copy link

ItzaMi commented May 4, 2022

@josevalim , this is the output from my mix deps.compile

===> 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

@josevalim
Copy link

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 env to see if there is an environment variable or something in your system affecting compilation, but it does feel like the issue is with the produced artifact.

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

No branches or pull requests