Compiling all latest versions of Honey on Win10/msys64

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

Moderators: hgm, Rebel, chrisw

JohnS
Posts: 215
Joined: Sun Feb 24, 2008 2:08 am

Compiling all latest versions of Honey on Win10/msys64

Post by JohnS »

The latest version of stockfish can always be compiled on Win10/msys64 using the instructions on https://github.com/glinscott/fishtest/w ... on-Windows.

Does anyone have a similar shell script to compile all the latest versions of Honey thanks.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Compiling all latest versions of Honey on Win10/msys64

Post by Dann Corbit »

It comes with the project:

Code: Select all

E:\chess\Stockfish-honey\src>type build.sh
#!/bin/bash
###  modify as appropriate for you system
### all builds have added features, 4 opening books can be used, adaptive ply,
### play by FIDE Elo ratings or CCRL Elo ratings
###

### time the compile process
set echo on
#DATE=$(shell date +"%m/%d/%y")
start=`date +%s`

#ARCH="ARCH=general-32"
#ARCH="ARCH=x86-32-old"
#ARCH="ARCH=x86-32"
#ARCH="ARCH=general-64"
#ARCH="ARCH=x86-64"
ARCH="ARCH=x86-64-modern"
#ARCH="ARCH=x86-64-bmi2"
#ARCH="ARCH=armv7"
#ARCH="ARCH=ppc-32"
#ARCH="ARCH=ppc-64comp"

#COMP="COMP=clang"
#COMP="COMP=gcc"
COMP="COMP=mingw"
#COMP="COMP=icc"

#BUILD="build"
BUILD="profile-build"

#make function
function mke() {
make -j $BUILD $ARCH $COMP "$@"
}

mke NOIR=yes && wait
mke BLUEFISH=yes FORTRESS_DETECT=yes && wait
mke BLUEFISH=yes && wait
mke HONEY=yes BLUEFISH=yes FORTRESS_DETECT=yes && wait
mke HONEY=yes BLUEFISH=yes && wait
mke HONEY=yes FORTRESS_DETECT=yes && wait
mke HONEY=yes && wait
mke WEAKFISH=yes && wait
mke FORTRESS_DETECT=yes && wait
mke

### The script code belows computes the bench nodes for each version, and updates the Makefile
### with the bench nodes and the date this was run.
echo ""
mv benchnodes.txt benchnodes_old.txt
echo "$( date +'Based on commits through %m/%d/%Y:')">> benchnodes.txt
echo "======================================================">> benchnodes.txt
grep -E 'searched|Nodes/second' *.bench  /dev/null >> benchnodes.txt
echo "======================================================">> benchnodes.txt
sed -i -e  's/^/### /g' benchnodes.txt
#rm *.nodes benchnodes.txt-e
echo "$(<benchnodes.txt)"
sed -i.bak -e '30,52d' ../src/Makefile
sed '29r benchnodes.txt' <../src/Makefile >../src/Makefile.tmp
mv ../src/Makefile.tmp ../src/Makefile


end=`date +%s`
runtime=$((end-start))
echo ""
echo Processing time $runtime seconds...
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: Compiling all latest versions of Honey on Win10/msys64

Post by JohnS »

Dann Corbit wrote: Fri Feb 28, 2020 9:44 pm It comes with the project:
Thanks Dann. Your version of build.sh works but Mike's original doesn't build all versions of honey because it is missing some wait statements. Have you told Mike of his error.

By the way do you know what the link for the wget command for the honey archive is that is equivalent to the stockfish one wget https://github.com/official-stockfish/S ... master.zip.
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: Compiling all latest versions of Honey on Win10/msys64

Post by MikeB »

JohnS wrote: Sat Feb 29, 2020 2:07 am
Dann Corbit wrote: Fri Feb 28, 2020 9:44 pm It comes with the project:
Thanks Dann. Your version of build.sh works but Mike's original doesn't build all versions of honey because it is missing some wait statements. Have you told Mike of his error.

By the way do you know what the link for the wget command for the honey archive is that is equivalent to the stockfish one wget https://github.com/official-stockfish/S ... master.zip.
My version does not error out on my system, but I would be happy to put the wait in. At one point it was in there and then one time I noticed wasn't getting any error with it out. I can't explain why.
Image
JohnS
Posts: 215
Joined: Sun Feb 24, 2008 2:08 am

Re: Compiling all latest versions of Honey on Win10/msys64

Post by JohnS »

MikeB wrote: Sat Feb 29, 2020 2:15 am
JohnS wrote: Sat Feb 29, 2020 2:07 am
Dann Corbit wrote: Fri Feb 28, 2020 9:44 pm It comes with the project:
Thanks Dann. Your version of build.sh works but Mike's original doesn't build all versions of honey because it is missing some wait statements. Have you told Mike of his error.

By the way do you know what the link for the wget command for the honey archive is that is equivalent to the stockfish one wget https://github.com/official-stockfish/S ... master.zip.
My version does not error out on my system, but I would be happy to put the wait in. At one point it was in there and then one time I noticed wasn't getting any error with it out. I can't explain why.
Interesting. Your version doesn't work for me.

I would like to make a complete script like the stockfish one to download the latest zip file and build all versions. That's why I asked about the path to the zip file.

Thanks.
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: Compiling all latest versions of Honey on Win10/msys64

Post by MikeB »

JohnS wrote: Sat Feb 29, 2020 2:52 am
MikeB wrote: Sat Feb 29, 2020 2:15 am
JohnS wrote: Sat Feb 29, 2020 2:07 am
Dann Corbit wrote: Fri Feb 28, 2020 9:44 pm It comes with the project:
Thanks Dann. Your version of build.sh works but Mike's original doesn't build all versions of honey because it is missing some wait statements. Have you told Mike of his error.

By the way do you know what the link for the wget command for the honey archive is that is equivalent to the stockfish one wget https://github.com/official-stockfish/S ... master.zip.
My version does not error out on my system, but I would be happy to put the wait in. At one point it was in there and then one time I noticed wasn't getting any error with it out. I can't explain why.
Interesting. Your version doesn't work for me.

I would like to make a complete script like the stockfish one to download the latest zip file and build all versions. That's why I asked about the path to the zip file.

Thanks.
I didn't realize SF hasd a script like that - can you post here?
Image
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: Compiling all latest versions of Honey on Win10/msys64

Post by MikeB »

JohnS wrote: Sat Feb 29, 2020 2:07 am
Dann Corbit wrote: Fri Feb 28, 2020 9:44 pm It comes with the project:
Thanks Dann. Your version of build.sh works but Mike's original doesn't build all versions of honey because it is missing some wait statements. Have you told Mike of his error.

By the way do you know what the link for the wget command for the honey archive is that is equivalent to the stockfish one wget https://github.com/official-stockfish/S ... master.zip.
Try this

Code: Select all

wget https://github.com/MichaelB7/Stockfish/archive/honey.zip
Image
JohnS
Posts: 215
Joined: Sun Feb 24, 2008 2:08 am

Re: Compiling all latest versions of Honey on Win10/msys64

Post by JohnS »

MikeB wrote: Sat Feb 29, 2020 3:15 am I didn't realize SF hasd a script like that - can you post here?
Mike
It's on the web page I linked. This is the one I use.

Code: Select all

#!/bin/bash
# makefish.sh

# install packages if not already installed
unzip -v &> /dev/null || pacman -S --noconfirm unzip
make -v &> /dev/null || pacman -S --noconfirm make
g++ -v &> /dev/null || pacman -S --noconfirm mingw-w64-x86_64-gcc

# uncomment to make a build working also for Windows XP and Windows server 2003
# wget http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-libwinpthread-git-7.0.0.5273.3e5acf5d-1-any.pkg.tar.xz
# wget http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-winpthreads-git-7.0.0.5273.3e5acf5d-1-any.pkg.tar.xz
# pacman -U --noconfirm mingw-w64-x86_64-libwinpthread-git-7.0.0.5273.3e5acf5d-1-any.pkg.tar.xz mingw-w64-x86_64-winpthreads-git-7.0.0.5273.3e5acf5d-1-any.pkg.tar.xz
# rm mingw-w64-x86_64-libwinpthread-git-7.0.0.5273.3e5acf5d-1-any.pkg.tar.xz mingw-w64-x86_64-winpthreads-git-7.0.0.5273.3e5acf5d-1-any.pkg.tar.xz

# download the Stockfish source code
wget https://github.com/official-stockfish/Stockfish/archive/master.zip
unzip master.zip
cd Stockfish-master/src

# find the CPU architecture
# CPU without popcnt and bmi2 instructions (e.g. older than Intel Sandy Bridge)
arch_cpu=x86-64
# CPU with popcnt instruction (e.g. Intel Sandy Bridge)
if [ "$(g++ -Q -march=native --help=target | grep mpopcnt | grep enabled)" ] ; then
  arch_cpu=x86-64-modern
# CPU with bmi2 instruction (e.g. Intel Haswell or newer)
elif [ "$(g++ -Q -march=native --help=target | grep mbmi2 | grep enabled)" ] ; then
  arch_cpu=x86-64-bmi2
fi

# build the fastest stockfish executable
# delete CXXFLAGS='-march=native' if you want distribute the executable
CXXFLAGS='-march=native' make -j profile-build ARCH=${arch_cpu} COMP=mingw
strip stockfish.exe
mv stockfish.exe ../../stockfish_${arch_cpu}.exe
make clean 
cd
JohnS
Posts: 215
Joined: Sun Feb 24, 2008 2:08 am

Re: Compiling all latest versions of Honey on Win10/msys64

Post by JohnS »

MikeB wrote: Sat Feb 29, 2020 3:18 am
Try this

Code: Select all

wget https://github.com/MichaelB7/Stockfish/archive/honey.zip
Thanks Mike - that works.
JohnS
Posts: 215
Joined: Sun Feb 24, 2008 2:08 am

Re: Compiling all latest versions of Honey on Win10/msys64

Post by JohnS »

Mike

This is what I came up with. Please feel free to change it and use it on your website as you see fit. Thanks to you and Dann for your help.

Code: Select all

#!/bin/bash
### modify as appropriate for your system
### all builds have added features, 4 opening books can be used, adaptive ply,
### play by FIDE Elo ratings or CCRL Elo ratings
###

### time the compile process
set echo on
#DATE=$(shell date +"%m/%d/%y")
start=`date +%s`

# install packages if not already installed
unzip -v &> /dev/null || pacman -S --noconfirm unzip
make -v &> /dev/null || pacman -S --noconfirm make
g++ -v &> /dev/null || pacman -S --noconfirm mingw-w64-x86_64-gcc

# remove old version of honey
rm honey.zip
rm -r Stockfish-honey

# download the honey source code
wget https://github.com/MichaelB7/Stockfish/archive/honey.zip
unzip honey.zip
cd Stockfish-honey/src

# find the CPU architecture
# CPU without popcnt and bmi2 instructions (e.g. older than Intel Sandy Bridge)
ARCH="ARCH=x86-64"
# CPU with popcnt instruction (e.g. Intel Sandy Bridge)
if [ "$(g++ -Q -march=native --help=target | grep mpopcnt | grep enabled)" ] ; then
  ARCH="ARCH=x86-64-modern"
# CPU with bmi2 instruction (e.g. Intel Haswell or newer)
elif [ "$(g++ -Q -march=native --help=target | grep mbmi2 | grep enabled)" ] ; then
  ARCH="ARCH=x86-64-bmi2"
fi

#BUILD="build
BUILD="profile-build"

#COMP="COMP=clang"
COMP="COMP=mingw"
#COMP="COMP=gcc"
#COMP="COMP=icc"

#make function
function mke() {
make -j $BUILD $ARCH $COMP "$@"
}

mke NOIR=yes && wait
mke BLUEFISH=yes FORTRESS_DETECT=yes && wait
mke BLUEFISH=yes && wait
mke HONEY=yes BLUEFISH=yes && wait
mke HONEY=yes FORTRESS_DETECT=yes && wait
mke HONEY=yes && wait
mke WEAKFISH=yes && wait
mke FORTRESS_DETECT=yes && wait
mke

### The script code below computes the bench nodes for each version, and updates the Makefile
### with the bench nodes and the date this was run.
echo ""
mv benchnodes.txt benchnodes_old.txt
echo "$( date +'Based on commits through %m/%d/%Y:')">> benchnodes.txt
echo "======================================================">> benchnodes.txt
grep -E 'searched|Nodes/second' *.bench  /dev/null >> benchnodes.txt
echo "======================================================">> benchnodes.txt
sed -i -e  's/^/### /g' benchnodes.txt
#rm *.nodes benchnodes.txt-e
echo "$(<benchnodes.txt)"
sed -i.bak -e '30,52d' ../src/Makefile
sed '29r benchnodes.txt' <../src/Makefile >../src/Makefile.tmp
mv ../src/Makefile.tmp ../src/Makefile
end=`date +%s`
runtime=$((end-start))
echo ""
echo Processing time $runtime seconds...