unable to use makefile with make command - makefile

when I cd to the path contains the makefile and run make command(from the MINGW64.exe) I get this error:
$ make
"C:\Program Files (x86)\CMake\bin\cmake.exe" -HC:\vmime-master -BC:\vmime-master\build --check-build-system CMakeFiles\Makefile.cmake 0
Microsoft Windows [Version 10.0.14393]
(c) ▒▒௮▒▒▒ ▒▒▒▒▒▒▒▒ (Microsoft Corporation), 2016. ▒▒ ▒ࠢ▒ ▒▒▒饭▒.
C:\vmime-master\build>
Really have no clue how to resolve this. The make file was generated by mingw makefiles from cmake.It looks like it switched somehow to the windows command shell(cmd).I'm using the msys2+mingw64 tools. Any idea or advice is highly appreciated. Thanks in advance!

Related

Why is my attempt to build OpenSSL on Windows using Visual Studio tools failing?

I am trying to build openssl libs. I cloned a repo from GitHub https://github.com/openssl/openssl
And now using a "command line" of Visual Studio 2013. This command line:
I use next commands:
cd C:\Programs\openssl - go to the folder with openssl repo
perl Configure VC-WIN64A --prefix=C:\Programs\openssl-build - actually, I have no idea what this command exectly do, but all manuals talks it need. This command has next output
And "Yes, I have 'Perl', of course I installed 'Perl'"
And the next (and the last) command, which I write ts just simple "nmake". The last becouse the output of this command has some "fatal errors", which doesn't let me continue installation
As you see, the main error is "fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'". As I know, the parametr machine type can be supplied in properties of Solution in Microsoft Visual Studio GUI, but how to set it from command line I have no idea, and openssl doesn't represented by Microsoft Visual Studio Solution, which can be open by MS Visual Studio.
So, maybe somebody knows how to set this property from command line, or, maybe, this error doesn't depends from this and somebody know how to solve this problem.
I hope for your help. Please, guys, second day I try to solve this, you are my last chance!!
Here is what I did. First, I opened a command prompt for 64-bit builds:
$ cl
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x64
Then, I downloaded the current 1.1 release tarball. There is no reason to mess with development versions unless you are actually developing OpenSSL and you are capable of debugging problems in development versions.
$ curl -O https://www.openssl.org/source/openssl-1.1.0e.tar.gz
$ tar xvf openssl-1.1.0e.tar.gz
$ cd openssl-1.1.0e
At this point, I read INSTALL which I recommend you also do instead of saying "I have no idea what this command exectly do". Once you read INSTALL, you will know what the command actually does.
$ perl Configure --prefix=%TEMP%\openssl VC-WIN64A
$ nmake
This gave me no errors, so I went ahead and issued
$ nmake test
which gave me
Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
set SRCTOP=.
set BLDTOP=.
set PERL=C:\opt\perl\5.24.1\bin\perl.exe
set OPENSSL_DEBUG_MEMORY=on
"C:\opt\perl\5.24.1\bin\perl.exe" ".\test\run_tests.pl"
test\recipes\01-test_abort.t ............ ok
test\recipes\01-test_sanity.t ........... ok
test\recipes\01-test_symbol_presence.t .. ok
...
test\recipes\90-test_sslapi.t ........... ok
test\recipes\90-test_threads.t .......... ok
test\recipes\90-test_v3name.t ........... ok
All tests successful.
Files=91, Tests=433, 100 wallclock secs ( 0.66 usr + 0.27 sys = 0.92 CPU)
Result: PASS
At this point, I am pretty certain nmake install would also have worked, but I did not want to replace anything on my system.
You do not have a Perl or programming related problem.
I think you forgot to run the ms\do_ms.bat file produced by the Configure script.
Below is the script that I use for building OpenSSL on my PC.
Prerequisites:
Install Perl on your PC. I think I used ActivePerl, but I suspect any version will do.
Install NASM. http://www.nasm.us/
Install Visual Studio
Then save the following script to file called bldenv.cmd
REM ######################################
REM MODIFY THESE VARIABLES BELOW TO POINT TO YOUR NASM, PERL, and VISUAL STUDIO PATHS
REM Base Variables
SET _BLD_NASM=c:\nasm\bin
SET _BLD_PERL=c:\perl64\bin
SET _BLD_VSTUDIO=c:\vstudio
REM ######################################
Echo Initializing the Visual Studio Build environment
call %_BLD_VSTUDIO%\VC\vcvarsall.bat x86
Echo adding Perl to Path
set PATH=%_BLD_PERL%;%PATH%
Echo Adding NASM to Path
set PATH=%_BLD_NASM%;%PATH%
echo #######################################
echo Build environment is ready
echo TO BUILD:
echo perl Configure VC-WIN32 (or perl Configure debug-VC-WIN32)
echo ms\do_nasm.bat
echo nmake -f ms\ntdll.mak (or nmake -f ms\nt.mak for a static lib)
echo #######################################
Then to build:
Open up a clean command shell window. Preferably your PATH environment is already "clean" and doesn't contain Visual Studio. Also your environment should not have any LIB or INCLUDE values set. (Type set at the command prompt. If you don't see an entry for LIB or INCLUDE yet that's good).
cd to the directory of your openssl sources. Copy the bldenv.cmd script above to this directory.
Run the script above (bldenv.cmd)
Then run: ms\do_nasm.bat
Followed by: nmake -f ms\ntdll.mak
That should do it.

Stuck compiling open source project that uses Qt. qmake never ends. Is it possible to download compiled files?

I am triying to compile on Windows this project: https://github.com/scantailor/
There is a detailed guide (https://github.com/scantailor/scantailor/blob/master/packaging/windows/readme.en.txt) but one process takes too time to finish. I am on point 7 (building scantailor dependencies).
The command is this:
C:\...\Qt\4.8.6\bin\qmake C:/.../Qt/4.8.6/\projects.pro -o Makefile -spec win32-msvc2008
I think that this creates the compiled libraries of Qt, but the problem is that this command took more than 6 hour without finish.
Is another way to obtain the compiled files?
I am using Windows 8.1 and Qt 4.8.6
UPDATE:
Stuck here (msv2008):
4>For tools\xmlpatternsvalidator\xmlpatternsvalidator.pro
4>For translations\translations.pro
4>Qt is now configured for building. Just run nmake.
4>To reconfigure, run nmake confclean and configure.
4>Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
4>Copyright (C) Microsoft Corporation. All rights reserved.
4> C:\legacy_programs\Qt\4.8.6\bin\qmake C:/legacy_programs/Qt/4.8.6/\projects.pro -o Makefile -spec win32-msvc2008
2>order.c
2>Generating Code...
You can't believe it. The problem was the Avast antivirus. This av blocks VS2008C++ and other related stuff. Hope this help. When I deactivated the AV the qmake started to rocks.

Unable to install Time:Piece module with cpan

I need to install the Time::Piece module in Perl. It's not there for some reason. When I use
cpan install Time::Piece
after some successful steps I get the error below
.....
Checking if your kit is complete...
Looks good
Unable to find a perl 5 (by these names: "My windows path variable contents here...i think"
Writing Makefile for Time::Piece
'nmake' is not recognized as an internal or external command,
operable program or batch file.
RJBS/Time-Piece-1.29.tar.gz
nmake -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Failed during this command:
RJBS/Time-Piece-1.29.tar.gz : make NO
cpan[2]>
Why is this happening ? Please help me to fix it.
I'll wait for an answer while I try to fix it myself. First problem -
'nmake' is not recognized as an internal or external command, operable program or batch file.
I used this solution
Windows 7 Control Panel, Programs and Features, Select Microsoft
Visual Studio 2008 Standard or Professional Edition application then
choose Uninstall/Change/Modify. This will bring you into Maintenance
Mode. Select C++ then check X64 Compilers and Tools.
I had Visual Studio Express and Visual Studio Professional 2013 (I don't remember how or why it's there on my system.) I followed the above instructions. The options were different: one had C++ mentioned in it - Microsoft Visual C++ 2013 Microsoft Foundation Class Libraries. So, I chose that one. Its a 600MB download and install.
I went to C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin and found nmake there. If you don't find it there, then you might find in Microsoft Visual Studio 10, 11 etc. Look for nmake there. Add the path for nmake to the PATH environment variable.
Now, I get a new error
NMAKE : fatal error U1073: don't know how to make 'C:/Program'
Stop.
RJBS/Time-Piece-1.29.tar.gz
nmake -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Failed during this command:
RJBS/Time-Piece-1.29.tar.gz : make NO
cpan[2]>
I'll try to fix this one too. By the way, #ikegami told me that installing to a path with no spaces (C:\progs\...) will solve my problem. I cannot install to another directory:
This version of Perl comes bundled with other software which must
install to the folder "C:\Program Files (x86)" which has a space in it. The
software needs to be in that path for some other things to work
correctly. Is there a simple way to edit the code which is trying to install the modules? I could make it parse the path by changing some
code. I am new to Perl though. Not sure if I'll be able to change
without causing harm .
EDIT -
I have both Active state perl 5.1.2 and perl 5.8 which are used by tool x and tool y (electric commander). Tool y has its own perl libraries which must be used in my code. So I am stuck with perl 5.8.
I just came to know this is due to issues with tool y. There is a workaround for this, but I am not able to understand it. Can you please help me to understand the workaround for windows ?
https://electriccloud.zendesk.com/hc/en-us/articles/202828073-KBEC-00180-Installing-Perl-modules-into-the-Commander-Perl-distribution
Which version of Perl are you running? what do you get if you run "perl -v" at a command prompt?
If the version number you get is 5.10 or higher, then Time::Piece should already be included with that version of Perl. If it's not, then your installation is broken in interesting ways and you should probably reinstall it from scratch.
If the version number you get is lower than 5.10 then you have a painfully old version of Perl installed and your best approach will be to upgrade to a newer version.

Rebar get-deps does not play well with msysgit 1.7.4 on Windows

Has anyone been successful with using rebar get-deps on Windows? Mine fails and complains about version numbers.
If you have been successful, which git did you use?
Rebar get-deps works on Windows. But:
bash.exe must not be in the PATH, so don't choose this option when install msysgit. Rebar thinks that cygwin is here but it is not :(
Rename git.cmd to git.bat in C:\Program Files (x86)\Git\cmd\. It is ugly hack but it seems that erl.exe can execute only exe and bat files not cmd
rebar (an Erlang build and packaging tool by Dave Smith, used by the Nitrogen project) doesn't seem to work well for Windows at the moment:
lang/erlang/nitrogen>make rel_inets
./rebar get-deps
==> rel (get-deps)
==> nitrogen (get-deps)
Pulling nitrogen_core from {git,"https://github.com/nitrogen/nitrogen_core.git",
"HEAD"}
ERROR: "c:\Program Files (x86)\Git\bin\bash.exe" -c
""c:\Program Files (x86)\Git\bin\git.exe" --version; echo _port_cmd_status_ $?"
failed with error: 127
make: *** [get-deps] Error 1
This thread doubt it works on Windows at all.
This recent irc trasncript mentions:
<Thesolonius>
and rebar generate of an application creates a bash script that we can't seem to run.
makes me wonder if our understanding of the correct setup environment is incorrect?
in our release, the script can't find "run_erl"
and we cannot find "run_erl" anywhere on the box
the same code runs just fine in linux
<drev1>
perhaps that needs to be run_erl.exe/
<Thesolonius>
there's no run_erl.*
<drev1>
oh hmm
<Thesolonius>
there's a start_erl.exe
but, if that name was the problem, it suggests rebar isn't targeting windows
during the "generate" command?
Which would lead me to ask if rebar can be given a hint as to it's current platform?
<drev1>
I'm not sure how much work has been done with rebar on windows
looks like start_erl is the Windows equivalent of run_erl
10:29 but it seems to take different command line arguments
<Thesolonius>
that's what we found too
<drev1>
my guess is you would need a Windows specific template for release generation
rather than the create-node template that ships with rebar

How to run a makefile in Windows?

I have some demos that I downloaded and they come with a Makefile.win and a Makefile.sgi. How can I run these in Windows to compile the demos?
You can install GNU make with chocolatey, a well-maintained package manager, which will add make to the global path and runs on all CLIs (powershell, git bash, cmd, etc…) saving you a ton of time in both maintenance and initial setup to get make running.
Install the chocolatey package manager for Windows
compatible to Windows 7+ / Windows Server 2003+
Run choco install make
I am not affiliated with choco, but I highly recommend it, so far it has never let me down and I do have a talent for breaking software unintentionally.
If you have Visual Studio, run the Visual Studio Command prompt from the Start menu, change to the directory containing Makefile.win and type this:
nmake -f Makefile.win
You can also use the normal command prompt and run vsvars32.bat (c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools for VS2008). This will set up the environment to run nmake and find the compiler tools.
Check out GnuWin's make (for windows), which provides a native port for Windows (without requiring a full runtime environment like Cygwin)
If you have winget, you can install via the CLI like this:
winget install GnuWin32.Make
Also, be sure to add the install path to your system PATH:
C:\Program Files (x86)\GnuWin32\bin
Check out cygwin, a Unix alike environment for Windows
Here is my quick and temporary way to run a Makefile
download make from SourceForge: gnuwin32
install it
go to the install folder
C:\Program Files (x86)\GnuWin32\bin
copy the all files in the bin to the folder that contains Makefile
libiconv2.dll libintl3.dll make.exe
open the cmd (you can do it with right click with shift) in the folder that contains Makefile and run
make.exe
done.
Plus, you can add arguments after the command, such as
make.exe skel
If you install Cygwin. Make sure to select make in the installer. You can then run the following command provided you have a Makefile.
make -f Makefile
https://cygwin.com/install.html
I use MinGW tool set which provides mingw32-make build tool, if you have it in your PATH system variables, in Windows Command Prompt just go into the directory containing the files and type this command:
mingw32-make -f Makefile.win
and it's done.
I tried all of the above. What helps me:
Download the mingw-get.
Setup it.
Add something like this C:\MinGW\bin to environment variables.
Launch (!important) git bash. Power shell, developer vs cmd, system cmd etc didn't help.
Type mingw-get into the command line.
After type mingw-get install mingw32-make.
Done! Now You might be able to use make-commands from any folder that contains Makefile.
With Visual Studio 2017 I had to add this folder to my Windows 10 path env variable:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64
There's also HostX86
If it is a "NMake Makefile", that is to say the syntax and command is compatible with NMake, it will work natively on Windows. Usually Makefile.win (the .win suffix) indicates it's a makefile compatible with Windows NMake. So you could try nmake -f Makefile.win.
Often standard Linux Makefiles are provided and NMake looks promising. However, the following link takes a simple Linux Makefile and explains some fundamental issues that one may encounter. It also suggests a few alternatives to handling Linux Makefiles on Windows.
Makefiles in Windows
Firstly, add path of visual studio common tools (c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools) into the system path. To learn how to add a path into system path, please check this website:
http://www.computerhope.com/issues/ch000549.htm. You just need to this once.
After that, whenever you need, open a command line and execute vsvars32.bat to add all required visual studio tools' paths into the system path.
Then, you can call nmake -f makefile.mak
PS: Path of visual studio common tools might be different in your system. Please change it accordingly.
I tried with cygwin & gnuwin, and didn't worked for me, I guess because the makefile used mainly specific linux code.
What it worked was use Ubuntu Bash for Windows 10. This is a Marvel if you come from MAC as it is my case:
To install the Ubuntu Bash: https://itsfoss.com/install-bash-on-windows/
Once in the console, to install make simply type "make" and it gives the instructions to download it.
Extras:
Useful enable copy / paste on bash: Copy Paste in Bash on Ubuntu on Windows
In my case the make called Maven, so I have to install it as well: https://askubuntu.com/questions/722993/unable-to-locate-package-maven
To access windows filesystem C: drive, for example: "cd /mnt/c/"
Hope it helps
Install msys2 with make dependency add both to PATH variable.
(The second option is GNU ToolChain for Windows. MinGW version has already mingw32-make included.)
Install Git Bash. Run mingw32-make from Git Bash.
If you have already installed the Windows GNU compiler (MinGW) from MSYS2 then make command comes pre-installed as wingw32-make. Always match cmake makefile generation with the correct make command. Mixing these generate problems.
MinGW makefile generation with MinGW make command
Visual Studio makefile generation with VS equivalent make command
And this is always possible as long as you have the source code. Just delete old build directory and start over by specifying this time the right parameter in cmake ,e.g.
mkdir build
cd build
cmake -G "MinGW MakeFiles" path/to/src/whereCMakeLists.txtInstructionsAre
mingw32-make
myProject.exe # RUN
I have encountered issues during compilation where multiple make commands interact. To prevent this just edit/remove the environmental variables that lead to different make commands. For example to prevent conflicts with mingw, keep only C:\msys64\mingw64\bin but remove C:\msys64\usr\bin. That other path contains the msys make and as I said you do not want to combine make commands during compilation.
Download from https://sourceforge.net/projects/gnuwin32/
Set the variable path in advance setting for recognize in command prompt (C:\Program Files (x86)\GnuWin32\bin)
So if you're using Vscode and Mingw then you should first make sure that the bin folder of the mingw is included in the environment path and it is preferred to change the mingw32-make.exe to make to ease the task and then create a makefile
and include this code in it .
all:
gcc -o filename filename.c
./filename
Then save the makefile and open Vscode Code terminal and write make. Then makefile will get executed.
I am assuming you added mingw32/bin is added to environment variables else please add it and I am assuming it as gcc compiler and you have mingw installer.
First step: download mingw32-make.exe from mingw installer, or please check mingw/bin folder first whether mingw32-make.exe exists or not, else than install it, rename it to make.exe.
After renaming it to make.exe, just go and run this command in the directory where makefile is located. Instead of renaming it you can directly run it as mingw32-make.
After all, a command is just exe file or a software, we use its name to execute the software, we call it as command.
For me installing ubuntu WSL on windows was the best option, that is the best tool for compiling makefile on windows. One thousand is better than Cygwin64, because to compile a makefile you will need another package and compile software like maybe gfortran, netcdf, etc, ect, in ubuntu WSL you can install all of these packages very easily and quickly ;)
The procedure I followed is;
I installed Gnuwin32's make using the installable.
Added the "make" path to the environmental variable PATH.
Verified the installation using "make --version"
Go to http://gnuwin32.sourceforge.net/packages/make.htm and download make-3.81.exe, install and add to Windows path.
May be it can work.
pip install Makefile

Resources