Could anyone make me a Windows compile...?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27794
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Could anyone make me a Windows compile...?

Post by hgm »

I would like to have a state-of-the-art Windows compile (preferbly a 64- and a 32-bit) if the engine Sjaak II ( http://www.eglebbk.dds.nl/program/chess-download.html ), for the purpose of distributing it in a special-purpose WinBoard package (for mini-Shogi).

The binary Windows package provided by the author isn't really acceptable to me, as it is dependent on a number of quite large general-purpose libraries (the C++ standard library) that have to be distributed with it. I was hoping it would be possible to make a 'native' Windows compile that would make use of the standard C++ infra-structure of Windows, instead of providing its own.
Rein Halbersma
Posts: 741
Joined: Tue May 22, 2007 11:13 am

Re: Could anyone make me a Windows compile...?

Post by Rein Halbersma »

hgm wrote:I would like to have a state-of-the-art Windows compile (preferbly a 64- and a 32-bit) if the engine Sjaak II ( http://www.eglebbk.dds.nl/program/chess-download.html ), for the purpose of distributing it in a special-purpose WinBoard package (for mini-Shogi).

The binary Windows package provided by the author isn't really acceptable to me, as it is dependent on a number of quite large general-purpose libraries (the C++ standard library) that have to be distributed with it. I was hoping it would be possible to make a 'native' Windows compile that would make use of the standard C++ infra-structure of Windows, instead of providing its own.
Do you mean that statically linking in the dependencies gives a binary that is too large for your tastes?
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Could anyone make me a Windows compile...?

Post by mar »

hgm wrote:The binary Windows package provided by the author isn't really acceptable to me, as it is dependent on a number of quite large general-purpose libraries (the C++ standard library) that have to be distributed with it. I was hoping it would be possible to make a 'native' Windows compile that would make use of the standard C++ infra-structure of Windows, instead of providing its own.
Problem is Microsoft CRT is no longer a single dll (msvcrt.dll) and from what I understood they plan to drop support for it in the future so that people can't "abuse" it
(I wonder how they would do that though because a lot of 3rd party software depends on that).
It's also a bit tricky to compile for XP these days.
However each VS version comes with a zillion of runtime versions so you either have to include appropriate msvcrxx.dll or (and msvcpxx.dll) or force the users to donwload redistributable package (I guess neither is acceptable to you).
You could try linking statically instead (assuming Evert uses mingw, so using -static-glibc and -static-libstdc++ should do, hoping that linker will remove unreferenced functions).
Problem is VS lacks support for stdbool and other headers so I was unable to compile with msc/icc.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Could anyone make me a Windows compile...?

Post by Evert »

I actually use MinGW as a cross-compiler under Linux. I would static-link, but this actually fails on my system because for some reason the 64 bit static libraries are missing. If I find the time to sit down and update stuff on my system that will hopefully fix it.

It's also true that the code is a bit of a mix between C++ and C99, which works ok for GCC compilers (empirically anyway) but doesn't help with portability to other compilers (say MSVC). Perhaps fixing that would be a good thing, but without access to the compiler myself it's a bit tricky.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Could anyone make me a Windows compile...?

Post by Evert »

I may be able to look into updating my installed compiler package over the weekend, which will hopefully allow me to create static binaries under Linux. That should hopefully solve the problem of distributing a massive DLL.

For anyone who wants to help and try to compile SjaakII under Windows using MinGW: you'll need to link in the following files:

Code: Select all

   src/xboard.cc

   src/misc/aligned_malloc.c
   src/misc/cfgpath.c
   src/misc/genrand.c
   src/misc/keypressed.c
   src/misc/softexp.c

   src/eval/pst.cc

   src/rules/game.cc
   src/rules/move.cc
   src/rules/san.cc
   src/rules/squares.cc

   src/hash/hashkey.c
   src/hash/hashtable.c
   src/hash/evalhash.c

   src/timer/timer.c
and make sure include files are picked from include/. Files with a .c extension should probably be compiled as C rather than C++.

SjaakII comes with a CMake project file that can automate all of this (and allows you to configure some options), but you'll need CMake (and GNU Make). There is a GUI for this which I've never used, but if you set the generator to "MinGW Makefiles" it should build the correct makefile. From the command-line, "cmake -G "MinGW Makefiles"" should do the trick.
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Could anyone make me a Windows compile...?

Post by mar »

Unfortunately I'm having some problems with MinGW. I may try to change SjaakII to compile with msc and let you know if I succeed :)
User avatar
cdani
Posts: 2204
Joined: Sat Jan 18, 2014 10:24 am
Location: Andorra

Re: Could anyone make me a Windows compile...?

Post by cdani »

I tried hard to translate it to MSVC, but I simply don't have enough knowledge to do it.
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Could anyone make me a Windows compile...?

Post by mar »

I managed to compile with msc, but Sjaak is currently cycling in initialization code. So I either messed up or something is wrong with fallback bitboard code :)
Only real problem were VLAs which msc doesn't support, so I had to replace it with vector (but fortunately that was only initialization code so should be ok). I also had to write snprintf wrapper so that it matched what Sjaak was using.
EDIT: yes there was a bug in bitscan64 fallback code. Now I need to disable ANSI output :)
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Could anyone make me a Windows compile...?

Post by mar »

Ok I managed to compile with icc.
Experimental link is here (static linking, one executable ~1M):http://www.crabaware.com/sjaak/sjaakII_intel_32bit.zip
It's likely that it won't work on XP though (I may look into it later).
What bothers me is that node counts for analyse don't match Evert's compiles (!!).
However I've noticed that this 32-bit version (no hw popcnt, no prefetch) is on par (if not faster) than 64-bit SSE4.2 compile by Evert
(however because node counts are off by some, it's an unfair comparison).
I've also noticed the 64-bit version doesn't seem any faster than the 32-bit version, which seems strange.
I will upload the changes along with VS2012 project/solution in case someone would want to look into it. I'm not sure though Evert will like the changes ;)
mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Could anyone make me a Windows compile...?

Post by mar »

64-bit executable is here: http://www.crabaware.com/sjaak/sjaakII_intel_64bit.zip
Both seem to work on WinXP64 under VMWare so maybe...
The changes along with VS2012 project are here:
http://www.crabaware.com/sjaak/sjaakII_changes.zip
Last note: I don't know which macros need to be defined so these versions are without SMP, I'm not sure if something else is missing.
Also some 64-bit mode warnings are still there but I didn't bother to fix them.
EDIT: I ran cmake so there is probably some junk in CMakeFiles directory.