riverrun / argon2_elixir

Elixir wrapper for the Argon2 password hashing algorithm
Apache License 2.0
229 stars 34 forks source link

Possibility to stop using symlinks for nif? #23

Closed olivermt closed 5 years ago

olivermt commented 5 years ago

Hi!

The current pattern of using symlink for priv folder for the built dlls/so breaks in the current format. I have not encountered other libs doing this as of yet.

The reason this is a problem is that I run vscode with elixir-ls from windows, so it compiles its own stuff to .elixir-ls. The way you compile in argon2_elixir means that you then create a dll in the priv folder and this is symlinked to the build folder in elixir-ls.

To make it run in wsl you then have to mix deps.compile argon2_elixir --force, because the dll is already compiled and symlinked to the windows side.

In general it feels a bit strange to symlink deps this way as it makes dep compiling less deterministic imo.

I haven't really looked at what it takes to alter this behaviour, but if its more than a few minutes effort I could look into doing a PR for this over xmas.

Cheers!

riverrun commented 5 years ago

Hi. I'm on holiday at the moment, but I will look at this issue when I get back home - on Wednesday.

riverrun commented 5 years ago

First, about the symlinking of the priv directory, as far as I am aware, that is part of the Elixir build process.

About the issue you are facing, what errors do you get if you do not run mix deps.compile argon2_elixir --force?

olivermt commented 5 years ago

Hi!

I am on vacay away from the I set up the reproducing for this, but paraphrased from my memory:

  1. iex phx.server compiles and runs as it should
  2. when the nif is attempted to be used it says the nif is not loaded

This is most likely because the nif is tagged as compiled when elixir-ls compiles it from windows, but there is only a dll, not the .so that linux requires.

riverrun commented 5 years ago

Ok. When you get back, if you could show me the error message, then I will be able to help you more.

Enjoy your vacation :)

olivermt commented 5 years ago

Thanks I did! (And I forgot this issue until I got deep enough in the mail pile)

I am not able to reproduce it now, when back on the proper computer. Will reopen if I figure out a way to reliably reproduce.