mingw error

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

viditchess
Posts: 20
Joined: Mon Feb 16, 2015 1:58 pm

mingw error

Post by viditchess »

Hello,
I tried to compile stockfish 8 for my machine using the instructions here http://support.stockfishchess.org/kb/ad ... on-windows

But, when I enter the make command I get the following error "make is not recognized as internal or external command, operable program or batch file"

Can anyone please guide me on fixing it?

Thanks!
Grandmaster 2617
Colin-G
Posts: 191
Joined: Mon Oct 31, 2016 6:30 pm
Location: England

Re: mingw error

Post by Colin-G »

viditchess wrote:Hello,
I tried to compile stockfish 8 for my machine using the instructions here http://support.stockfishchess.org/kb/ad ... on-windows

But, when I enter the make command I get the following error "make is not recognized as internal or external command, operable program or batch file"

Can anyone please guide me on fixing it?

Thanks!
When I compile other engines on Windows 10 using the free TDM-GCC-64 compiler, I have to use the command "mingw32-make" instead of just using "make"
The "make clean" command also becomes "mingw32-clean"
Dann Corbit
Posts: 12870
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: mingw error

Post by Dann Corbit »

I highly recommend CodeBlocks if you are using Mingw (works on Windows and non-windows platforms).

It is really good at helping your to configure your system for whatever compilers you have available.

Also, it is a lot easier to debug using CodeBlocks than using gdb, unless you have experience with gdb already. It is more like Visual Studio, in that it allows you to graphically step through the code.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
GONeill
Posts: 87
Joined: Sun Jun 15, 2014 6:40 am
Location: New Zealand
Full name: Graham O'Neill

Re: mingw error

Post by GONeill »

If you followed the instructions to install all the software OK, then it might just be your path not working. Here is my batch file for compiling Stockfish and copying it straight into my Arena folder.

You should edit the SET commands to suit your paths, and also the mingw32 line for the build you want. I have a "Copy makefile" section because I edit the normal makefile to have -march=native and to use SSE 4.2 as I find them slightly faster on my PC. You can delete that.

Compile.bat

Code: Select all

@echo off
TITLE Compile Stockfish source

REM ----------------------------------------------------------------------------------------
REM   complr=gcc    Use GCC compiler   (LTO build)
REM   complr=mingw  Use MinGW compiler (Static build)
REM ----------------------------------------------------------------------------------------
set complr=gcc

REM ----------------------------------------------------------------------------------------
REM   talk=0   Hide some text, no pauses during compilation
REM   talk=1   Show extra info and pause during compilation
REM ----------------------------------------------------------------------------------------
set talk=0

REM ----------------------------------------------------------------------------------------
REM   Program paths and names
REM ----------------------------------------------------------------------------------------
set mindir=D:\MinGW
set srcdir=D:\MinGW\Stockfish-master\src
set engdir=D:\Arena\Engines\Stockfish
set shtnam=stockfish
set cmpnam=stockfish.exe
set newnam=stockfish_9dev.exe

echo.
echo ---------------------
for /f "skip=1" %%D in ('WMIC os get LocalDateTime') do (set LIDATE=%%D & goto GOT_DATE)
:GOT_DATE
rem LIDATE fields:
rem     yymmdd  %LIDATE:~2,6%
rem     ccyy    %LIDATE:~0,4%
rem     mm      %LIDATE:~4,2%
rem     dd      %LIDATE:~6,2%
rem     hh      %LIDATE:~8,2%
rem     mm      %LIDATE:~10,2%
rem     ss      %LIDATE:~12,2%
set date1=%LIDATE:~2,6%
echo  Date is %date1%
echo ---------------------

echo.
echo ---------------------
echo  Set PATH
echo ---------------------
set PATH=%mindir%\mingw64\bin;%mindir%\msys\1.0\bin;%PATH%
if %talk%==1 echo %PATH%

cd %srcdir%
if %talk%==1 echo *** Compiler flags: ***
if %talk%==1 gcc -Q -march=native -mtune=native --help=target |egrep "(march|mtune|enabled)"
if %talk%==1 echo.
if %talk%==1 pause

echo.
echo ---------------------
echo  Copy MAKEFILE
echo ---------------------
copy %mindir%\MakeFile %srcdir%\*.*

echo.
echo -----------------------------
echo  Compile sources using %complr%
echo -----------------------------
mingw32-make profile-build ARCH=x86-64-bmi2 COMP=%complr% -j 8
if errorlevel 1 goto COMPERR 
if %talk%==1 echo.
if %talk%==1 pause

echo.
echo ---------------------
echo  Tidy and rename
echo ---------------------
strip %cmpnam%
if exist %shtnam%_%date1%.exe del %shtnam%_%date1%.exe /q
ren %cmpnam% %shtnam%_%date1%.exe
mingw32-make clean

echo.
echo ---------------------
echo  Copy to Arena
echo ---------------------
copy %srcdir%\%shtnam%*.exe %engdir%\*.*
for %%v in (%shtnam%*.exe) do del %%v /q
cd %engdir%
if exist "%newnam%" del "%newnam%" /q
copy %shtnam%_%date1%.exe "%newnam%"

echo.
echo DONE!
if %talk%==1 pause
goto ENDP

:COMPERR
echo.
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo !!!   Compilation error   !!!
echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
echo.
pause

:ENDP
Dann Corbit
Posts: 12870
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: mingw error

Post by Dann Corbit »

Besides using CodeBlocks (if you are already familiar with the Posix environment) then msys2 is a very good way to go.

You use the msys2 command window with a bash shell to do everything. Then building SF becomes very easy also.
https://sourceforge.net/projects/msys2/

The pacman tool also makes updating and finding packages really easy.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
JohnS
Posts: 215
Joined: Sun Feb 24, 2008 2:08 am

Re: mingw error

Post by JohnS »

Thanks Graham for this great batch file. Everything works perfectly.
viditchess
Posts: 20
Joined: Mon Feb 16, 2015 1:58 pm

Re: mingw error

Post by viditchess »

Thank you, everyone, for the responses!

Graham, I tried to make a batch file accordingly. But I get an error. I haven't tried this before so I am sure I am making some mistake!
I am attaching a screenshot of the error.

Can anyone tell me what is the mistake?
Image
Grandmaster 2617
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: mingw error

Post by Sven »

viditchess wrote:Thank you, everyone, for the responses!

Graham, I tried to make a batch file accordingly. But I get an error. I haven't tried this before so I am sure I am making some mistake!
I am attaching a screenshot of the error.

Can anyone tell me what is the mistake?
Image
In this section:

Code: Select all

echo.
echo ---------------------
echo  Copy MAKEFILE
echo ---------------------
copy %mindir%\MakeFile %srcdir%\*.*
try changing the last line into:

Code: Select all

copy %mindir%\MakeFile %srcdir%
EDIT: Maybe the same applies to this line:

Code: Select all

copy %srcdir%\%shtnam%*.exe %engdir%\*.*
which might be replaced by:

Code: Select all

copy %srcdir%\%shtnam%*.exe %engdir%
Not sure, though, since someone else had reported that the batch file listed above would work perfectly, and the "copy" command line might also work with this unusual (and redundant) "...\*.*" at the end.
JohnS
Posts: 215
Joined: Sun Feb 24, 2008 2:08 am

Re: mingw error

Post by JohnS »

Vidit, Sven:

I used

set srcdir=c:\engines\stockfish\src
set engdir=c:\engines\stockfish

in the batch file (no \ at the end).

So I agree with Sven on the extra \.
viditchess
Posts: 20
Joined: Mon Feb 16, 2015 1:58 pm

Re: mingw error

Post by viditchess »

Thanks for the reply! I made the changes, but I still get the same error.

In my previous computer, I used to follow the instructions on the website and it used to work. Strange that it won't work now.
Grandmaster 2617