How to fix "could not compile dependency :bcrypt_elixir" error on Windows? - cygwin

I'm on Windows and I am trying to install the bcrypt_elixir module.
I get the following error:
$ mix phx.server
==> bcrypt_elixir
could not compile dependency :bcrypt_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile bcrypt_elixir", update it with "mix deps.update bcrypt_elixir" or clean it with "mix deps.clean bcrypt_elixir"
** (Mix) "nmake" not found in the path. If you have set the MAKE environment variable,
please make sure it is correct.
Here is a terminal screenshot of the error:
Here is my deps function from mix.exs:
defp deps do
[
{:phoenix, "~> 1.3.0"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.2"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 2.10"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.11"},
{:cowboy, "~> 1.0"},
{:comeonin, "~> 4.0"},
{:elixir_make, "~> 0.4.1"},
{:bcrypt_elixir, "~> 1.0"}
]
end

I faced same problem during distillery setup with my elixir project.
Installing package resolve issue as shown below.
I found bcrypt_elixir need to install make and build-essential from Elixir Forum.
platform:- ubuntu
$ sudo apt install make
$ sudo apt-get install build-essential

For Visual Studio 2019 (VS2019) :
cmd /K "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64

bcrypt_elixir uses Windows' NMake (cf. bcrypt_elixir's Makefile.win).
It seems like you don't have NMake installed.
From NMake's documentation:
NMAKE is included when you install Visual Studio or the Visual C++ command-line build tools. It's not available separately.
So you need to download Visual Studio in order to get NMake. Then you should be able to compile bcrypt_elixir.
If you already have NMake, make sure nmake.exe is located under a directory from your path.

In windows 10, you must add NMAKE to your path
After that you can run mix deps.compile until see message like this:
After that you must run cmd as suggest from nmake:
cmd /K "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
Run this command on cmd and run mix deps.compile normarly.

Actually looking at this a bit closer, since you're running Cygwin and trying to build bcrypt under Cygwin, nmake doesn't even enter into the question. You need to install make into Cygwin. Re-run the cygwin installer, select the Devel category and then under Devel look for make.
EDIT:
Ok, so if I had to guess I'd say either you need to
a.) Stop trying to build everything under the Cygwin prompt--if bcrypt_elixir is detecting that it's on Windows, it's going to look for nmake and nmake isn't part of Cygwin.
You didn't specify how you're looking for nmake but if I were you I'd try this from the C:\Program Files (x86) directory.
dir /s nmake.exe
Mind you run that from a Windows cmd prompt--it won't work from the Cygwin shell!
b.) Somehow set bcrypt_elixir to think it's on Linux so it looks for make (which is not the same as nmake).
Basically I think the simplest answer would be to try to run mix phx.server from a normal Windows cmd prompt and then go from there. Or if you need Linux, then install virtual box and put a Linux VM on the machine and proceed that way.

I found that, running on Windows, it was the latest version of erlang OTP, version 21,
that was causing the problem. I uninstalled this version and went for version 20 (which installs erlang 9.3 and latest version of Elixir then looks for this version when being compiled) and then bcrypt_elixir compiled al

This answer is for anyone running elixir directly on Windows, and using VS Code with the ElixirLS extension. These instructions should work for other Visual Studio versions besides 2022, just change the path to vcvars64.bat.
Install Visual Studio 2022.
Use the Visual Studio Installer to install the optional Desktop Development with C++ workload. This contains native C/C++ build tools, including nmake.exe.
Create a script in your home directory (C:\Users\UserName) ExVsCode.bat with the following (%1 is how you access the first command line argument, which will be the project directory):
cd %1
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat
code .
When you want to work on an elixir project in VS Code, open a command prompt (CMD.exe), move to your home directory if you're not there already, and run ExVsCode.bat C:\Users\Username\PathToProject to open VS Code with all the build tools available to ElixirLS and the integrated terminal.
Credit to exqlite documentation for some of this.
Note: the original question may concern Cygwin, but many people will find this answer who are running elixir directly on Windows, and a closed question that doesn't mention Cygwin or WSL already points here.

Related

Missing mfc140u.dll when trying to run windows application using Wine in Ubuntu

I want to run a c++ application written in vs2017 in Ubuntu 16.04. I've installed Wine version 3.0.3 as well as Winetricks version 20140817. When trying to run the application using 'wine app_name.exe' command, i get an error saying
002e:err:module:import_dll Library mfc140u.dll (which is needed by L"path_to_my_application_library") not found
I tried to install mfc140u via Winetrichs GUI using 'Install a Windows DLL or component' option but it seems not to be listed anywhere on the list of the available packages. Does anyone know how to make it available?
Make sure you are using the most up-to-date version of Wine (currently Wine 4). You can check by running:
wine --version
If you need to upgrade Wine, check out the instructions here.
That dll is a part of Visual C++ redistributable. You'll need to install it so the application will work. Instructions are here.
I don't use Wine, so there could be additional steps, but in the interest of helping:
I believe you need the appropriate version of the VC++ redistributable (Visual Studio C++ runtime). You need to install the version that the application you try to run was compiled with. Just start with the latest one and install and then install older versions if need be. MSDN Forums.
Download
vc_redist.x64.exe
from
https://www.microsoft.com/en-us/download/details.aspx?id=48145
from console run
wine uninstaller
uninstall any existing runtime version, then select "install" and browse for the vc_redist.x64.exe file, accept. Execute your Windows appplication

cargo-clone and cargo-edit don’t build on my Windows 10 PC

I installed Visual Studio C++ and Rust. Most things work fine, but building cargo-edit and cargo-clone fail. The error code hints at cmake missing but it's one of the items built ok. Windows 10 specific issue.
Thanks to help from the IRC #rust-beginners channel I found out that I needed to install cmake from cmake.org. Make sure you have it add itself to the path and restart your command prompt.
Cmake download

Configuring PyQt5, fatal error U1077

I'm trying to run the configure.py for PyQt5 from git bash, but it errors out, giving me a Fatal Error U1077. Some other people have encountered this problem, and I've been trying some of the stuff that other people have been saying, but I'm kind of new to this and it's pretty confusing.
The important section is "fatal error U1077: '.\cl.EXE' : return code '0x000135' " but I don't really know what that means.
Here are the complete steps to configure and install PyQt5 from source, you will need first to run command :
python configure.py
At this step, you did not install PyQt5, you only configured it (basically its installation dir, etc...), Do not specify your qmake path.
Next step is to source your environment variables by running in terminal :
"C:\Qt\Qt5.x.x\5.x\msvc2015\bin\qtenv2.bat"
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
Replace the x by your version of Qt. Keep the double quotes, windows does not like spaces ...
Be careful to specify your Visual Studio installation. In windows, "make" is substituted by "nmake" !
the second command will change your path to Visual Studio, just stay in the same terminal and return to your PyQt5 path.
Then you run :
nmake
nmake install
You may encounter an error when you compile QtNfc. Then use :
python configure.py --disable QtNfc
and re-compile everything.
Hope this will helps.
You don't need Git Bash to install PyQt5 on Windows you can use the Windows command prompt. Here is a step by step guide to install PyQt5 using Qt5.5 on Windows (if you are interested in a newer version you just need to adapt the paths):
Download and install Qt5.5.1 + Mingw32
Download and uncompress SIP
Download and uncompress PyQt5.5.1
Bring up command prompt window, navigate to the uncompressed SIP directory, and type the following:
> PATH=C:\Qt\5.5\mingw492_32\bin;C:\Qt\Tools\mingw492_32\bin;%PATH%
> python configure.py -p win32-g++
> mingw32-make
> mingw32-make install
Using the same command prompt window, navigate to the uncompressed PyQt5 directory, and type the following:
> python configure.py --spec win32-g++ --disable QtPositioning --no-qsci-api --no-designer-plugin --no-qml-plugin --confirm-license
> mingw32-make
> mingw32-make install
NOTE #1: that disabling QtPositioning is not really necessary, but sometime the compiler complains that it's not able to locate the qgeolocation.h header, so leave it disabled unless you really need it.
NOTE #2: To date, I was not able to compile the 5.7 version of PyQt5, not the 5.6 version (for some unexplainable errors that I couldn't solve). This is why I wrote this little installation tutorial using PyQt5.5.

how to compile lex/yacc files on windows "without cygwin"

We need to create .c file from .l (lax) and .y (yacc) file using visual studio 1o on windows 2008.
We cant use Cygwin at all.
Where does Flex and bison come into picture here ? Even Flex and Bison use cygwin internally or not ?
how are we supposed to go about it ?
You can download a windows version of flex from sourceforge and bison from sourceforge, you then need to add them to the PATH environment variable. Be sure not to have a space in the install directory (i.e. do not put in C:\Program Files\ etc). You can then build the output with CL from visual studio command line tools if you wish.
As previously mentioned MinGw is another option.
I have even made a YouTube Video showing the install of these packages!

Cygwin make package

I am trying to run android ndk-build command in the cygwin terminal.
When I do it is telling me ...
ERROR: Cannot find 'make' program. Please install Cygwin make package
or define the GNUMAKE variable to point to it.
The thing is, I believe I have all the cygwin packages installed. And other topics have suggested running installing and being sure to check the devel>make option as a package. Porblem is, is that there seems to be no make option in the devel package folder.
Does anyone have any insight on this?
NDK comes with its own make, the copy that comes with cygwin has quite a few incompatibilities. You don't need cygwin at all to run the latest versions of NDK (since r6, IIRC). I usually run ndk-build.cmd in a CMD window where cygwin is not on the PATH.

Resources