It is currently Fri Apr 26, 2024 5:33 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
Offline
 Post subject: Compile Pachi 11 on Windows
Post #1 Posted: Sun Jan 03, 2016 8:22 pm 
Dies in gote

Posts: 23
Liked others: 1
Was liked: 9
Compile Pachi 11 on Windows

If you want to compile Pachi 11 with MinGW on Windows,
try to follow these instructions:

- download and install mingw32-base and mingw32-pthreads-w32 dev

- there is a conflict between unistd.h and pthread.h, which causes the redefinition of 'struct timespec'
solution is to find mingw\include\parts\time.h, add #define HAVE_STRUCT_TIMESPEC
just after the timespec structure, and arrange #include <unistd.h> and #include <pthread.h> in your header
such that #include <unistd.h> is before #include <pthread.h>

- for regex.h, I simply comment out the line #include <regex.h> and all the relevant code of regex.h in chat.c

- the original Makefile fails, I don't know why, I use my own version of Makefile:

NAME=pachi
CXX=gcc
CXXFLAGS= -O3 -std=gnu99 -frename-registers -pthread -w
DEPS=make.dep
CXXSRCS=$(wildcard *.c) $(wildcard distributed/*.c) $(wildcard joseki/*.c) $(wildcard montecarlo/*.c) $(wildcard patternplay/*.c) $(wildcard patternscan/*.c) $(wildcard playout/*.c) $(wildcard random/*.c) $(wildcard replay/*.c) $(wildcard tactics/*.c) $(wildcard t-unit/*.c) $(wildcard uct/*.c) $(wildcard uct/policy/*.c)
HSRCS=$(wildcard *.h) $(wildcard distributed/*.h) $(wildcard joseki/*.h) $(wildcard montecarlo/*.h) $(wildcard patternplay/*.h) $(wildcard patternscan/*.h) $(wildcard playout/*.h) $(wildcard random/*.h) $(wildcard replay/*.h) $(wildcard tactics/*.h) $(wildcard t-unit/*.h) $(wildcard uct/*.h) $(wildcard uct/policy/*.h)
OBJS=$(CXXSRCS:.cpp=.o)

.PHONY: all clean

all: $(NAME) $(DEPS)

$(NAME): $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $^ -lws2_32 -lpthread

clean:
rm -f *.o make.dep

include $(DEPS)

make.dep: $(CXXSRCS) $(HSRCS)
$(CXX) -MM $(CXXSRCS) > make.dep

- with this Makefile you have to setup a correct path for the include files, for example,
for those files inside the directory "uct", "tactics" ...
you have to change #include "board.h" to #include "../board.h", #include "uct/uct.h" to #include "../uct/uct.h"
for those files inside the directory "uct\policy"
you have to change #include "board.h" to #include "../../board.h", #include "uct/tree.h" to #include "../../uct/tree.h"

- run mingw32-make on Makefile, run Pachi
command line options : pachi.exe -d 0 threads=1,pondering=0

Top
 Profile  
 
Offline
 Post subject: Re: Compile Pachi 11 on Windows
Post #2 Posted: Thu Apr 21, 2016 11:33 am 
Beginner

Posts: 11
Location: Near Cologne, Germany
Liked others: 8
Was liked: 1
Rank: dd Kyu
Online playing schedule: AGA, KGS randomly
Well, the 11.00 Binary for Windows can be downloaded at http://pachi.or.cz/.

Top
 Profile  
 
Offline
 Post subject: Re: Compile Pachi 11 on Windows
Post #3 Posted: Fri Apr 22, 2016 4:27 am 
Lives with ko

Posts: 129
Liked others: 20
Was liked: 17
Still it is helpful for all reasons why people want to create their own binaries :)

Top
 Profile  
 
Offline
 Post subject: Re: Compile Pachi 11 on Windows
Post #4 Posted: Fri Apr 22, 2016 10:12 am 
Beginner

Posts: 11
Location: Near Cologne, Germany
Liked others: 8
Was liked: 1
Rank: dd Kyu
Online playing schedule: AGA, KGS randomly
Sure - I mentioned that just for those who are confusing when trying to compile something by themselve ;-)

Top
 Profile  
 
Offline
 Post subject: Re: Compile Pachi 11 on Windows
Post #5 Posted: Sat Jun 04, 2016 2:21 am 
Beginner

Posts: 14
Liked others: 0
Was liked: 0
Rank: KGS 4 kyu
KGS: tvirlip
Tygem: gorlum
IGS: alexey
Wbaduk: foobar
DGS: tvirlip
I've compiled my own 64-bit version on Windows 10 in a very easy way. The steps are below.

1. Install msys2: https://msys2.github.io/ (when you'll follow the instructions, at some moment you will see the message that you need to change shortcuts for running msys; pay attention and comply!). Do follow instructions to the end!

2. When done, run Mingw64-win64-shell with one of the shortcuts you've just modified.

3. In msys shell install mingw64, for example, like this: pacman -S mingw-w64-x86_64-clang

4. Install make: pacman -S make

5. Install git: pacman -S git

6. Clone pachi sources: git clone https://github.com/pasky/pachi.git

7. Modify Makefile in the sources in the following manner: first, un-comment "WIN=1" line; then add "WIN_HAVE_NO_REGEX_SUPPORT=1" line after it.

8. Run make. It should build perfectly.

9. Now copy built pachi.exe and /mingw64/bin/libwinpthread-1.dll to some directory.

10. Optionally, download book.dat and pattern files, and put them to the same directory.

11. Those I the options I use to run pachi.exe (from Drago): "-d 0 -t 30 -f book.dat threads=2,maximize_score,max_tree_size=3072". Please notice, that with 32 bit version you cannot use so big tree size. Also notice, that if you make it bigger (say 4096) the whole thing just breaks, replying almost instantly with almost random moves :)

12. Enjoy!

Disclaimer: I've built pachi on Windows before, but in a much more complicated manner which I cannot remember now. With this version I didn't play enough so maybe there are problems lurking somewhere. You're warned.

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group