how to compile lex/yacc files on windows "without cygwin" - 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!

Related

scons environment configuration from Linux to Windows

I have a scons scrip that specifies Boost libraries. This script is specific to Linux.
env.Append(LINKFLAGS=['-lboost_program_options', '-lboost_filesystem', '-lboost_system'])
env.Append(CXXFLAGS=['-std=c++17', '-lboost_program_options', '-lboost_filesystem', '-lboost_system'])
env.Append(LIBS=['-lboost_program_options', '-lboost_filesystem', '-lboost_system' ])
I want to install the application on a Windows machine and have installed Boost on the Windows machine. But how to modify the scons script to point to Boost? The -std=c++17 is easy since Visual Studio can toggle standard from C/C++ Language in the Project setting. Don't know where to set boost_program_options, boost_filesystem, and boost_system in the script.
Some of this is incorrect for any platform. Here's what would be correct for linux.
env.Append(CXXFLAGS=['-std=c++17'])
env.Append(LIBS=['boost_program_options', 'boost_filesystem', 'boost_system' ])
Here's what would be correct for windows:
env.Append(CXXFLAGS=['/std:c++17'])
env.Append(LIBS=['boost_program_options', 'boost_filesystem', 'boost_system' ])
You should not specify -lLIBRARY_NAME anywhere for SCons.
Just the LIBRARY_NAME in LIBS.
You'll need to specify LIBPATH to point to the libraries on windows. (Or perhaps env['ENV']['PATH'] as well)

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

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.

mingw64 - the file has been downloaded incorrectly

I try to install MinGW-w64, but during install i got
the file has been downloaded incorrectly
I have 64 bit win10 and my option of installation:
I use that link sourceforge. and some commentators have same problem.
Any idea how to fix it?
Newer MinGW-w64 releases are now available at https://winlibs.com/ as standalone packages that don't need an installer. Just extract to a folder and start using. This also allows having multiple versions on your side by side (e.g. 32-bit and 64-bit).
This MinGW article addresses the issue. It's actually pretty simple to fix. The problem is with the Windows installer. What you need to do is download the MinGW zip archive directly (not the installer) and extract the files to something like C:\mingw and then add it to PATH in Environment Variables. Here's direct link to the SourceForge files you'll need.

OpenCV and CMake in Windows7: wrong include dir

I built my own OpenCV-2.4.10 libs for Windows 7 mingw:
1) download opencv-2.4.10 for Windows to f:\opencv-2.4.10\
2) cmake f:\opencv-2.4.10\source to f:\opencv-2.4.10\build\x86\mingw
3) generate f:\opencv-2.4.10\build\x86\mingw
4) mingw32-make f:\opencv-2.4.10\build\x86\mingw
When I create an eclipse project, I set the include dir to f:\opencv-2.4.10\build\include and lib dir to f:\opencv-2.4.10\build\x86\mingw\bin
Everything works fine. Now I want to process the same project on Windows and Ubuntu and I created a CMake project for this. Under Windows I can cmake my project but I can't compile because the include files can't be find. I found out, that in my CMake project the include dir is set to f:\opencv-2.4.10\source\include and not to f:\opencv-2.4.10\build\include, that has another directory structure.
Under Ubuntu the project is compiled and works. So I'm pretty sure, that the problem is with my OpenCV installation on Windows. What did I do wrong, since this is the proposed procedure by the opencv documentation?
f:\opencv-2.4.10\build\include
this holds the header files you want to include, it shouldn't matter if you are on windows or on Ubuntu

How can I build gettext 64bit dll on Windows.

I succeeded to build gettext 32bit dll on Windows.
I installed these.
gettext-0.18.11
mingw (include msys)
./configure --prefix=/mingw --enable-threads=win32 --enable-relocatable
cd gettext-runtime
make
But I don't know how to build 64bit dll.
Someone said I should use mingw64. Then I installed mingw64 and msys.
But I don't know how to do setting mingw64 and msys to build 64bit dll.
And I don't know gettext configure option to build 64bit dll.
Thanks.
Download latest MinGW-w64 targeting 64-bit (there are also targeting 32-bit, so be careful) here.
NOTE: As you added --enable-threads=win32, then probably you would be interested in the distribution with Win32 threading support, rather than POSIX, so be cautious when you choose which one to download.
Configure in almost the same way, but with addition of one option:
./configure --build=x86_64-w64-mingw32 --prefix=/mingw --enable-threads=win32 --enable-relocatable
Lean back. :)
First download gettex from here: https://mlocati.github.io/articles/gettext-iconv-windows.html
then add system var PATH: C:\Program Files\gettext-iconv\bin
afterwards
create in your project a folder that bears the note of
locale/
afterwards
add variable in settings.py: LOCALE_PATHS = (BASE_DIR + 'locale/', )
and
finally try to run
python manage.py makemessages -l fr

Resources