Compiling Stockfish on Windows

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

jpqy
Posts: 550
Joined: Thu Apr 24, 2008 9:31 am
Location: Belgium

Compiling Stockfish on Windows

Post by jpqy »

I need some help here..

I try the nice explenation on Stockfish support to try Compiling Stockfish on Windows!
http://support.stockfishchess.org/kb/ad ... on-windows

I have installed the needed programs..but i get stuck from here:
Now, open Command Prompt. If you have git installed, run git clone https://github.com/mcostalba/Stockfish.git and navigate to the src folder. If you don't have git installed, navigate to the src folder.

When i open Command Prompt and copy "git clone https://github.com/mcostalba/Stockfish.git" i get this:

'git' is not recognized as an internal or external command,operable program or batch file.

When i start up "Git Bash" program and do the same..the program begins with some work ,starting with Cloning into 'Stockfish' ...
get 5 more lines with 100%,Done.

But what i have to do then?
Type "make profile-build ARCH=x86-64-modern COMP=mingw
then i see:
sh.exe" : make: command not found

because i should first be in the src folder..

I have make print screens from it ,but i don't find a way to put them here.
When clicking on Img ..i can't upload a picture?

But okay..it's from Command Prompt it get wrong here..so if somebody know what i should do..please tell me ,but in very simple way that i can follow..because i don't know anything about compiling and is my first try!
With the thinking ,ok, explain looks easy to follow..and must work for me.
But missing a few steps i think..

JP.
syzygy
Posts: 5566
Joined: Tue Feb 28, 2012 11:56 pm

Re: Compiling Stockfish on Windows

Post by syzygy »

jpqy wrote:When i open Command Prompt and copy "git clone https://github.com/mcostalba/Stockfish.git" i get this:

'git' is not recognized as an internal or external command,operable program or batch file.
This means that the directory ("folder") containing git.exe is not listed in your PATH variable. Find the directory and add it to PATH. See the Stockfish compilation instructions you linked to for how to do that.
jpqy
Posts: 550
Joined: Thu Apr 24, 2008 9:31 am
Location: Belgium

Re: Compiling Stockfish on Windows

Post by jpqy »

Have at the PATH..was Done.

Environment Variables.. new System Variable
Variable name: PATH
Variable value: C:\MinGW\mingw64\bin;C:\MinGW\msys\1.0\bin

But Command Prompt don't recognize 'git' command ?

JP.

Okay Ronald ..i think to understand.. git is not in my PATH ,so how to at it?
It's installed in "C:\Program Files (x86)\Git\bin\sh.exe" --login -i
jpqy
Posts: 550
Joined: Thu Apr 24, 2008 9:31 am
Location: Belgium

Re: Compiling Stockfish on Windows

Post by jpqy »

I'am very excited..it works..my first compile from Stockfish is running and play chess now :!:

Problem was..i have just to restart my system to let the git recognize into Command Prompt..

And i tried the second time to see everything still works..with the understanding that i have to rename the Stockfish folder..so that he can upload the last source.

Next step..
I want to have the engine settings -> aggressiveness & cowardice back!!
Can someone help me what line i have to use like "make profile-build ARCH=x86-64-modern COMP=mingw" but with these 2 settings included!!

Would be a great help and appriciated!

JP.
User avatar
Eelco de Groot
Posts: 4565
Joined: Sun Mar 12, 2006 2:40 am
Full name:   

Re: Compiling Stockfish on Windows

Post by Eelco de Groot »

jpqy wrote:I'am very excited..it works..my first compile from Stockfish is running and play chess now :!:

Problem was..i have just to restart my system to let the git recognize into Command Prompt..

And i tried the second time to see everything still works..with the understanding that i have to rename the Stockfish folder..so that he can upload the last source.

Next step..
I want to have the engine settings -> aggressiveness & cowardice back!!
Can someone help me what line i have to use like "make profile-build ARCH=x86-64-modern COMP=mingw" but with these 2 settings included!!

Would be a great help and appriciated!

JP.
Congratulations for getting that to work Jean-Paul!! I hope someone can give some instructions how to do this properly, I am not really used to Stockfish on GitHub. But to give some hints how I would try this; I think that you now must have your own clone of Stockfish on GitHub and that you could make a fork with the changes that you want to make. Then you can compile the source again. There are three files in which you would have to make some changes. Basically it is only one patch and you have to revert the changes made in this patch: https://github.com/mcostalba/Stockfish/ ... b440861e2a

On this page https://github.com/mcostalba/Stockfish/ ... ter?page=4 it is a patch from january 4 called 'Retire 'Cowardice' and 'Aggressiveness' UCI options. The three files are polyglot.ini, evaluate.cpp and ucioption.cpp

One way to do it without making a fork first I think is go to your own copy of Stockfish on GitHub, open it so you can see all the commits. Then go to that particular commit, click on it and in GitHub you have an option to revert the commit.

In your copy then there should appear a new commit that reverts the old if everything goes right, and you can (re-)compile the changed sources just like you did with the regular Stockfish. I have never done such a revert yet but it should be fairly simple to do it this way. If you don't want to mess up your copy of Stockfish directly you first have to make a fork, give it a name and then with GitHub you should be able to make the same revert in the fork alone. The fork has all the same files and commits.

Here is a screenshot of the commit how it looks like in my GitHub copy of Stockfish:

Image

This to show the revert option, at the top of the screen.

Regards, Eelco
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Compiling Stockfish on Windows

Post by mcostalba »

jpqy wrote: Next step..
I want to have the engine settings -> aggressiveness & cowardice back!!
Can someone help me what line i have to use like "make profile-build ARCH=x86-64-modern COMP=mingw" but with these 2 settings included!!

Would be a great help and appriciated!
from git bash prompt type

Code: Select all

git checkout -f -b fun 2d60995c004e4ddf010
Now you have your beloved options back ! You can compile...

At any time, to come back to 'fun' branch, freshly created, just type

Code: Select all

git checkout fun
jpqy
Posts: 550
Joined: Thu Apr 24, 2008 9:31 am
Location: Belgium

Re: Compiling Stockfish on Windows

Post by jpqy »

Thanks Eelco for your nice explenation..i have to study that ;)
I must have luck to make or to let it make a compile for me..i have just follow Stockfish Support.
I did it now two times ,and i get a working Stockfish compile!

Now Marco..thank you very much..a one line code function to get back these settings is a dream..
So i start Git Bash
Type your line: git checkout -f -b fun 2d60995c004e4ddf010
Enter..and i get this:
fatal: Not a git repository (or any of the parent directories): .git

What do i wrong?
Do i have first to follow your first steps to make a compile till "strip stockfish.exe"?
and then put your line-code ->enter
Or have it to make that i have to go first to the right directory..but how to do that in Git Bash?

Just thinking..i have done everything in Command Prompt before..maybe i have to try it there in place off into Git Bash..

I will come back or Edit this message..

JP.
jpqy
Posts: 550
Joined: Thu Apr 24, 2008 9:31 am
Location: Belgium

Re: Compiling Stockfish on Windows

Post by jpqy »

Marco..yes in Command Prompt it did it :!:

So i started again from zero..removed the stockfish folder

Open Command Prompt
Type: git clone https://github.com/mcostalba/Stockfish.git
He begins to upload the last files (source i think)
When everything is done 100%
Type: git checkout -f -b fun 2d60995c004e4ddf010
Enter and i get/see: Switched to a new branch 'fun'
Then i change to cd stockfish ,cd src (to be in the right directory)
and type: make profile-build ARCH=x86-64-modern COMP=mingw
And he begins to make the compile..takes a time ,but goes fast i find!
After finish i type: strip stockfish.exe (makes the output stockfish file much smaller!)
And Done..i get my compile with my settings :!:
Install it in a ChessGui..and it plays even chess :lol:

Marco..thank you again..i think you know i have asked you a few times..you let me go the hard way ,that i have to do myself learn to make a compile..and it's always nice if it works finally.

I will exercise more..and start testing ofcourse with my settings :wink:

One more thing..every time i want to make a new compile..i rename my folder so that i run the steps again i get always last new source downloaded and make from this source a new compile with the last changes..

Thank you very much..happy tester :wink:

Kind regards,
Jean-Paul.
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: Compiling Stockfish on Windows

Post by ilari »

jpqy wrote: Marco..thank you again..i think you know i have asked you a few times..you let me go the hard way ,that i have to do myself learn to make a compile..and it's always nice if it works finally.

I will exercise more..and start testing ofcourse with my settings :wink:

One more thing..every time i want to make a new compile..i rename my folder so that i run the steps again i get always last new source downloaded and make from this source a new compile with the last changes..

Thank you very much..happy tester :wink:

Kind regards,
Jean-Paul.
Marco just told you how to go back in history to a time when the Cowardice and Aggressiveness options still existed, meaning that your custom builds will not get any of the new Stockfish improvements. If you want the bleeding edge stuff AND the Cowardice and Aggressiveness options you'll have to revert the commit that Eelco linked to. Then you can keep your own special branch up to date by rebasing it to the latest master and hoping that you don't get any nasty merge conflicts. If what I just said sounded like gibberish, then you'll also need to learn more about Git.
jpqy
Posts: 550
Joined: Thu Apr 24, 2008 9:31 am
Location: Belgium

Re: Compiling Stockfish on Windows

Post by jpqy »

I have followed Eelco idea..and install GitHub for windows..register myself and make a fork with Stockfish..and get same screen as Eelco when everything was setup..

Okay till here..but when i click on "revert commit" i get a window saying:
"You have unmerged files in your working directory.Resolve them and commit them before trying the revert again."

Have someone any idea what i should do?!
And if it's correct what Ilari say that i just go back in time and have a old version where i get these settings is ofcource not the meaning..i have them..
I want these 2 settings always in the new compiles..so then i need this "revert commit" or is there a other way Marco!?

Thanks again for your explenation!

Kind regards,
Jean-Paul.

PS: I think i have to make clear that i don't know anything about programming or this code i see says me nothing!
I just want to have these settings aggressiviness & cowardice into new compiles so that i can pass SF 121227 who is still my best Stockfish with changed setting! That's all..