Compile Pachi 11 on Windows
Posted: Sun Jan 03, 2016 8:22 pm
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
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