Reputation: 49
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
wsl is not an option, also 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
Upvotes: 0
Views: 61
Reputation: 49
Sorry, Found the solution at the time but forgot to post here:
This applies to those who want to do this in windows natively without wsl or cygwin or any other tool. FYI git bash wont do too. It is hard to use solution that suggest porting Linux make tools into Windows. So here is the actual solution to make it work for using pheonix/elixir on windows.
First install Visual Studio https://visualstudio.microsoft.com/downloads/ then setup tools for desktop development or package that will come with nmake. ensure to have this folder afterwards
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\%YOUR_VERSION%\bin\Hostx64\x64
and ensure it has nmake in it. This explains why the error has that path in it, but that is just part of the solution.
To make it work, once that is set up and confirmed, go to
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build
replace 2022 with your respective visual studio year and run
vcvarsall.bat x64
Which sets up an environment for you to do make. WITHIN THE SAME SHELL! then do
mix deps.compile
which compiles your dependancies after which
after successful compile you can go on building the usual way, unless you have trouble and have to delete the build folder, symptom of this is when you run migration but starting the server iex mix -S phx.server
the site still complains you have not run your migrations and attempt of it brings an error of running migrations on existing ones. In case of such, delete build and you will need to repeat the steps so to rebuild all the artifacts within environment again, but after which you are free to go on as usual.
BTW this covers most of the hurdle working with phoenix on windows, the other is versioning but i found just the tool vfox. However it is yet able to fix versioning to per project,but the global switching is enough as most of the time you are working or running 1 server/project at a time. Also elixir verions are pretty flexible across several erlang versionings.
I could build a batch script*(.bat)* and mix command to go with it for this sometime or if someone can edit and provide it well then good too.. happy coding.
Upvotes: 0