riverrun / argon2_elixir

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

Has absolutely anyone in the world managed to install this natively on windows? or have any work arounds #65

Open Whizboy-Arnold opened 1 month ago

Whizboy-Arnold commented 1 month ago

It starts with this error:


could not compile dependency :argon2_elixir, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile argon2_elixir --force", update it with "mix deps.update argon2_elixir" or clean it with "mix deps.clean argon2_elixir"
** (Mix) "nmake" not found in the path. If you have set the MAKE environment variable, please make sure it is correct.

After setting the MAKE env variable now i get

>mix deps.compile argon2_elixir --force
==> argon2_elixir
could not compile dependency :argon2_elixir, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile argon2_elixir --force", update it with "mix deps.update argon2_elixir" or clean it with "mix deps.clean argon2_elixir"
** (Mix) "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64" not found in the path. If you have set the MAKE environment variable, please make sure it is correct.

if i only have it on path and no MAKE i get


Microsoft (R) Program Maintenance Utility Version 14.41.34120.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        del /Q /F priv
Could Not Find d:\PROJECTS\HUGE\VerityIds\OTHERS\shif\deps\argon2_elixir\priv
        erl -noshell -eval "io:format(\"ERTS_INCLUDE_PATH=~ts/erts-~ts/include/\", [code:root_dir(), erlang:system_info(version)])." -s init stop > Makefile.auto.win
        nmake /                   /F Makefile.win priv\argon2_nif.dll

Microsoft (R) Program Maintenance Utility Version 14.41.34120.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        if NOT EXIST "priv" mkdir "priv"
        cl /O2 /EHsc /I"argon2\include" /I"argon2\src" /I"c:/Program Files/Erlang OTP/erts-13.2.2.6/include/" /LD /MD /Fepriv\argon2_nif.dll 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
Microsoft (R) C/C++ Optimizing Compiler Version 19.41.34120 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

argon2.c
argon2\src\argon2.c(18): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
core.c
argon2\src\core.c(20): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
blake2b.c
argon2\src\blake2\blake2b.c(18): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
thread.c
d:\PROJECTS\HUGE\VerityIds\OTHERS\shif\deps\argon2_elixir\argon2\src\thread.h(34): fatal error C1083: Cannot open include file: 'process.h': No such file or directory
encoding.c
argon2\src\encoding.c(18): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
ref.c
argon2\src\ref.c(18): fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
argon2_nif.c
c_src\argon2_nif.c(26): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
Generating Code...
NMAKE : fatal error U1077: 'cl /O2 /EHsc /I"argon2\include" /I"argon2\src" /I"c:/Program Files/Erlang OTP/erts-13.2.2.6/include/" /LD /MD /Fepriv\argon2_nif.dll 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' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'nmake /                   /F Makefile.win priv\argon2_nif.dll' : return code '0x2'
Stop.
could not compile dependency :argon2_elixir, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile argon2_elixir --force", update it with "mix deps.update argon2_elixir" or clean it with "mix deps.clean argon2_elixir"
** (Mix) Could not compile with "nmake" (exit status: 2).
One option is to install a recent version of
[Visual C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/)
either manually or using [Chocolatey](https://chocolatey.org/) -
`choco install VisualCppBuildTools`.

After installing Visual C++ Build Tools, look in the "Program Files (x86)"
directory and search for "Microsoft Visual Studio". Note down the full path
of the folder with the highest version number. Open the "run" command and
type in the following command (make sure that the path and version number
are correct):

    cmd /K "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64

This should open up a command prompt with the necessary environment variables
set, and from which you will be able to run the "mix compile", "mix deps.compile",
and "mix test" commands.

Another option is to install the Linux compatiblity tools from [MSYS2](https://www.msys2.org/).

After installation start the msys64 bit terminal from the start menu and install the
C/C++ compiler toolchain. E.g.:

  pacman -S --noconfirm pacman-mirrors pkg-config
  pacman -S --noconfirm --needed base-devel autoconf automake make libtool git \
    mingw-w64-x86_64-toolchain mingw-w64-x86_64-openssl mingw-w64-x86_64-libtool

This will give you a compilation suite nearly compatible with Unix' standard tools.

i am using: {:argon2_elixir, "~> 3.1"}, i am on windows with visual studio 2022 installed I have tried to use mingw and managed to install as said in the pacman commands as instructed and can do make --version and gcc --version but still cannot install anything

Whizboy-Arnold commented 1 month ago

it is also highly desirable i be on native, wsl is not an option currently

Whizboy-Arnold commented 1 month ago

alternatively is there a way to configure elixir to install alternative algorithm on windows or ignore the install fail on mix so on a linux environment it goes on with argon as default

riverrun commented 1 month ago

About getting this work on Windows, please ask at https://elixirforum.com/ There, it is more likely that you will be able to get useful feedback.

For alternative hashing functions, which do not require you to setup C locally, you could try https://github.com/riverrun/pbkdf2_elixir